]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
Fix 64bit kernel / 32bit userspace issue.
authorMartin Josefsson <gandalf@wlug.westbo.se>
Wed, 26 May 2004 15:58:07 +0000 (15:58 +0000)
committerMartin Josefsson <gandalf@wlug.westbo.se>
Wed, 26 May 2004 15:58:07 +0000 (15:58 +0000)
Sync header with kernel.

extensions/libipt_SAME.c
extensions/libipt_ULOG.c
include/linux/netfilter_ipv4/ipt_SAME.h
include/linux/netfilter_ipv4/ipt_ULOG.h

index e9c42a80e6edc2b55291bc7b27552c954529fa49..52a7e728ef3074c62f0a52e62189846b32f5617d 100644 (file)
@@ -7,7 +7,8 @@
 #include <iptables.h>
 #include <linux/netfilter_ipv4/ip_tables.h>
 #include <linux/netfilter_ipv4/ip_nat_rule.h>
-#include <linux/netfilter_ipv4/ipt_SAME.h>
+/* For 64bit kernel / 32bit userspace */
+#include "../include/linux/netfilter_ipv4/ipt_SAME.h"
 
 /* Function which prints out usage message. */
 static void
index 41ee99116c30a691b3df3e152ad13b385e40329b..5371911609a48842d7bd83c8be71ed28c6a4e7d8 100644 (file)
 #include <getopt.h>
 #include <iptables.h>
 #include <linux/netfilter_ipv4/ip_tables.h>
-#include <linux/netfilter_ipv4/ipt_ULOG.h>
-
-#define ULOG_DEFAULT_NLGROUP 1
-#define ULOG_DEFAULT_QTHRESHOLD 1
+/* For 64bit kernel / 32bit userspace */
+#include "../include/linux/netfilter_ipv4/ipt_ULOG.h"
 
 
 void print_groups(unsigned int gmask)
@@ -124,7 +122,11 @@ static int parse(int c, char **argv, int invert, unsigned int *flags,
                if (atoi(optarg) < 0)
                        exit_error(PARAMETER_PROBLEM,
                                   "Negative copy range?");
+#ifdef KERNEL_64_USERSPACE_32
+               loginfo->copy_range = (unsigned long long)atoll(optarg);
+#else
                loginfo->copy_range = atoi(optarg);
+#endif
                *flags |= IPT_LOG_OPT_CPRANGE;
                break;
        case 'B':
@@ -137,7 +139,11 @@ static int parse(int c, char **argv, int invert, unsigned int *flags,
                if (atoi(optarg) > ULOG_MAX_QLEN)
                        exit_error(PARAMETER_PROBLEM,
                                   "Maximum queue length exceeded");
+#ifdef KERNEL_64_USERSPACE_32
+               loginfo->qthreshold = (unsigned long long)atoll(optarg);
+#else
                loginfo->qthreshold = atoi(optarg);
+#endif
                *flags |= IPT_LOG_OPT_QTHRESHOLD;
                break;
        }
@@ -163,11 +169,19 @@ static void save(const struct ipt_ip *ip,
                printf("--ulog-nlgroup ");
                print_groups(loginfo->nl_group);
        }
+#ifdef KERNEL_64_USERSPACE_32
+       if (loginfo->copy_range)
+               printf("--ulog-cprange %llu ", loginfo->copy_range);
+
+       if (loginfo->qthreshold != ULOG_DEFAULT_QTHRESHOLD)
+               printf("--ulog-qthreshold %llu ", loginfo->qthreshold);
+#else
        if (loginfo->copy_range)
                printf("--ulog-cprange %d ", loginfo->copy_range);
 
        if (loginfo->qthreshold != ULOG_DEFAULT_QTHRESHOLD)
                printf("--ulog-qthreshold %d ", loginfo->qthreshold);
+#endif
 }
 
 /* Prints out the targinfo. */
@@ -179,11 +193,19 @@ print(const struct ipt_ip *ip,
            = (const struct ipt_ulog_info *) target->data;
 
        printf("ULOG ");
+#ifdef KERNEL_64_USERSPACE_32
+       printf("copy_range %llu nlgroup ", loginfo->copy_range);
+#else
        printf("copy_range %d nlgroup ", loginfo->copy_range);
+#endif
        print_groups(loginfo->nl_group);
        if (strcmp(loginfo->prefix, "") != 0)
                printf("prefix `%s' ", loginfo->prefix);
+#ifdef KERNEL_64_USERSPACE_32
+       printf("queue_threshold %llu ", loginfo->qthreshold);
+#else
        printf("queue_threshold %d ", loginfo->qthreshold);
+#endif
 }
 
 static
index 428b21378cde69b1f2792844fcde3d93519578ba..89ba22fa5b0e33b1a91e6e5ebf408d7f848d41a2 100644 (file)
@@ -8,12 +8,13 @@
 struct ipt_same_info
 {
        unsigned char info;
-
-       unsigned int rangesize;
-
-       unsigned int ipnum;
-
+       u_int32_t rangesize;
+       u_int32_t ipnum;
+#ifdef KERNEL_64_USERSPACE_32
+       u_int64_t placeholder;
+#else
        u_int32_t *iparray;
+#endif
 
        /* hangs off end. */
        struct ip_nat_range range[IPT_SAME_MAX_RANGE];
index 86a99ee7f614fdb35f6b5f40db1e6544358ba7eb..f267ab8e4ae9143cec0a417c1959e4088e23bab3 100644 (file)
@@ -1,4 +1,4 @@
-/* Header file for IP tables userspace logging, Version 1.8 
+/* Header file for IP tables userspace logging, Version 1.8
  *
  * (C) 2000-2002 by Harald Welte <laforge@gnumonks.org>
  * 
@@ -11,6 +11,9 @@
 #define NETLINK_NFLOG  5
 #endif
 
+#define ULOG_DEFAULT_NLGROUP   1
+#define ULOG_DEFAULT_QTHRESHOLD        1
+
 #define ULOG_MAC_LEN   80
 #define ULOG_PREFIX_LEN        32
 
 /* private data structure for each rule with a ULOG target */
 struct ipt_ulog_info {
        unsigned int nl_group;
+#ifdef KERNEL_64_USERSPACE_32
+       unsigned long long copy_range;
+       unsigned long long qthreshold;
+#else
        size_t copy_range;
        size_t qthreshold;
+#endif
        char prefix[ULOG_PREFIX_LEN];
 };