]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
Remove unnecessary IP_NAT_RANGE_PROTO_RANDOM ifdefs.
authorPatrick McHardy <kaber@trash.net>
Wed, 18 Apr 2007 12:56:05 +0000 (12:56 +0000)
committerPatrick McHardy <kaber@trash.net>
Wed, 18 Apr 2007 12:56:05 +0000 (12:56 +0000)
extensions/libipt_MASQUERADE.c
extensions/libipt_SAME.c
extensions/libipt_SNAT.c

index 48cff9a8412fa477e3998dba77f55f11829bad9c..17fc4f60a2c87fec4bb2541f55013eb1d767ecb9 100644 (file)
@@ -16,10 +16,8 @@ help(void)
 "MASQUERADE v%s options:\n"
 " --to-ports <port>[-<port>]\n"
 "                              Port (range) to map to.\n"
-#ifdef IP_NAT_RANGE_PROTO_RANDOM
 " --random\n"
 "                              Randomize source port.\n"
-#endif
 "\n"
 ,
 IPTABLES_VERSION);
@@ -27,9 +25,7 @@ IPTABLES_VERSION);
 
 static struct option opts[] = {
        { "to-ports", 1, 0, '1' },
-#ifdef IP_NAT_RANGE_PROTO_RANDOM
        { "random", 0, 0, '2' },
-#endif
        { 0 }
 };
 
@@ -109,11 +105,9 @@ parse(int c, char **argv, int invert, unsigned int *flags,
                parse_ports(optarg, mr);
                return 1;
 
-#ifdef IP_NAT_RANGE_PROTO_RANDOM
        case '2':
                mr->range[0].flags |=  IP_NAT_RANGE_PROTO_RANDOM;
                return 1;
-#endif
 
        default:
                return 0;
@@ -143,11 +137,8 @@ print(const struct ipt_ip *ip,
                printf(" ");
        }
 
-#ifdef IP_NAT_RANGE_PROTO_RANDOM
-       if (r->flags & IP_NAT_RANGE_PROTO_RANDOM) {
+       if (r->flags & IP_NAT_RANGE_PROTO_RANDOM)
                printf("random");
-       }
-#endif
 }
 
 /* Saves the union ipt_targinfo in parsable form to stdout. */
index 4bbed90865dffc724ddbcea3de5d6386f5369a08..1a37958026009af74cd1125c0d9b2daaf52ad485 100644 (file)
@@ -23,11 +23,8 @@ help(void)
 " --nodst\n"
 "                              Don't use destination-ip in\n"
 "                                         source selection\n"
-
-#ifdef IP_NAT_RANGE_PROTO_RANDOM
 " --random\n"
 "                              Randomize source port\n"
-#endif
 ,
 IPTABLES_VERSION);
 }
@@ -35,9 +32,7 @@ IPTABLES_VERSION);
 static struct option opts[] = {
        { "to", 1, 0, '1' },
        { "nodst", 0, 0, '2'},
-#ifdef IP_NAT_RANGE_PROTO_RANDOM
        { "random", 0, 0, '3' },
-#endif
        { 0 }
 };
 
@@ -88,9 +83,7 @@ parse_to(char *arg, struct ip_nat_range *range)
 
 #define IPT_SAME_OPT_TO                        0x01
 #define IPT_SAME_OPT_NODST             0x02
-#ifdef IP_NAT_RANGE_PROTO_RANDOM
-#      define IPT_SAME_OPT_RANDOM              0x04
-#endif
+#define IPT_SAME_OPT_RANDOM            0x04
 
 /* Function which parses command options; returns true if it
    ate an option */
@@ -101,9 +94,7 @@ parse(int c, char **argv, int invert, unsigned int *flags,
 {
        struct ipt_same_info *mr
                = (struct ipt_same_info *)(*target)->data;
-#ifdef IP_NAT_RANGE_PROTO_RANDOM
        int count;
-#endif
 
        switch (c) {
        case '1':
@@ -117,11 +108,10 @@ parse(int c, char **argv, int invert, unsigned int *flags,
                                   "Unexpected `!' after --to");
 
                parse_to(optarg, &mr->range[mr->rangesize]);
-#ifdef IP_NAT_RANGE_PROTO_RANDOM
+               /* WTF do we need this for? */
                if (*flags & IPT_SAME_OPT_RANDOM)
                        mr->range[mr->rangesize].flags 
                                |= IP_NAT_RANGE_PROTO_RANDOM;
-#endif
                mr->rangesize++;
                *flags |= IPT_SAME_OPT_TO;
                break;
@@ -135,13 +125,12 @@ parse(int c, char **argv, int invert, unsigned int *flags,
                *flags |= IPT_SAME_OPT_NODST;
                break;
 
-#ifdef IP_NAT_RANGE_PROTO_RANDOM
        case '3':       
                *flags |= IPT_SAME_OPT_RANDOM;
                for (count=0; count < mr->rangesize; count++)
                        mr->range[count].flags |= IP_NAT_RANGE_PROTO_RANDOM;
                break;
-#endif
+
        default:
                return 0;
        }
@@ -166,9 +155,7 @@ print(const struct ipt_ip *ip,
        int count;
        struct ipt_same_info *mr
                = (struct ipt_same_info *)target->data;
-#ifdef IP_NAT_RANGE_PROTO_RANDOM
        int random = 0;
-#endif
        
        printf("same:");
        
@@ -185,19 +172,15 @@ print(const struct ipt_ip *ip,
                        printf(" ");
                else
                        printf("-%s ", addr_to_dotted(&a));
-#ifdef IP_NAT_RANGE_PROTO_RANDOM
                if (r->flags & IP_NAT_RANGE_PROTO_RANDOM) 
                        random = 1;
-#endif
        }
        
        if (mr->info & IPT_SAME_NODST)
                printf("nodst ");
 
-#ifdef IP_NAT_RANGE_PROTO_RANDOM
        if (random)
                printf("random ");
-#endif
 }
 
 /* Saves the union ipt_targinfo in parsable form to stdout. */
index d52c1810c772d824975946fb986b188d489f0d3b..9979bbf4004f5ca874e92c97213425afe3bebbec 100644 (file)
@@ -9,9 +9,7 @@
 #include <linux/netfilter/nf_nat.h>
 
 #define IPT_SNAT_OPT_SOURCE 0x01
-#ifdef IP_NAT_RANGE_PROTO_RANDOM
-#      define IPT_SNAT_OPT_RANDOM 0x02
-#endif
+#define IPT_SNAT_OPT_RANDOM 0x02
 
 /* Source NAT data consists of a multi-range, indicating where to map
    to. */
@@ -28,9 +26,7 @@ help(void)
        printf(
 "SNAT v%s options:\n"
 " --to-source <ipaddr>[-<ipaddr>][:port-port]"
-#ifdef IP_NAT_RANGE_PROTO_RANDOM
 "[--random]"
-#endif
 "\n"
 "                              Address to map source to.\n"
 "                              (You can use this more than once)\n\n",
@@ -39,9 +35,7 @@ IPTABLES_VERSION);
 
 static struct option opts[] = {
        { "to-source", 1, 0, '1' },
-#ifdef IP_NAT_RANGE_PROTO_RANDOM
        { "random", 0, 0, '2' },
-#endif
        { 0 }
 };
 
@@ -175,14 +169,12 @@ parse(int c, char **argv, int invert, unsigned int *flags,
                                           "Multiple --to-source not supported");
                }
                *target = parse_to(optarg, portok, info);
-#ifdef IP_NAT_RANGE_PROTO_RANDOM
+               /* WTF do we need this for?? */
                if (*flags & IPT_SNAT_OPT_RANDOM)
                        info->mr.range[0].flags |=  IP_NAT_RANGE_PROTO_RANDOM;
-#endif
                *flags = IPT_SNAT_OPT_SOURCE;
                return 1;
 
-#ifdef IP_NAT_RANGE_PROTO_RANDOM
        case '2':
                if (*flags & IPT_SNAT_OPT_SOURCE) {
                        info->mr.range[0].flags |=  IP_NAT_RANGE_PROTO_RANDOM;
@@ -190,7 +182,6 @@ parse(int c, char **argv, int invert, unsigned int *flags,
                } else
                        *flags |= IPT_SNAT_OPT_RANDOM;
                return 1;
-#endif
 
        default:
                return 0;
@@ -223,11 +214,8 @@ static void print_range(const struct ip_nat_range *r)
                if (r->max.tcp.port != r->min.tcp.port)
                        printf("-%hu", ntohs(r->max.tcp.port));
        }
-#ifdef IP_NAT_RANGE_PROTO_RANDOM
-       if (r->flags & IP_NAT_RANGE_PROTO_RANDOM) {
+       if (r->flags & IP_NAT_RANGE_PROTO_RANDOM)
                printf(" random");
-       }
-#endif
 }
 
 /* Prints out the targinfo. */