]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
src: put shared option flags into xshared
authorJan Engelhardt <jengelh@medozas.de>
Mon, 7 Feb 2011 02:16:14 +0000 (03:16 +0100)
committerJan Engelhardt <jengelh@medozas.de>
Mon, 7 Feb 2011 02:16:14 +0000 (03:16 +0100)
This will be needed for the find_proto function.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
ip6tables.c
iptables.c
xshared.h

index ac376e239a2f208d00ab468c0371215e74cf38e8..7f8a8df64a79e2995f6ac59e821f22619c585eb2 100644 (file)
 static const char cmdflags[] = { 'I', 'D', 'D', 'R', 'A', 'L', 'F', 'Z',
                                 'Z', 'N', 'X', 'P', 'E', 'S' };
 
-#define OPT_NONE       0x00000U
-#define OPT_NUMERIC    0x00001U
-#define OPT_SOURCE     0x00002U
-#define OPT_DESTINATION        0x00004U
-#define OPT_PROTOCOL   0x00008U
-#define OPT_JUMP       0x00010U
-#define OPT_VERBOSE    0x00020U
-#define OPT_EXPANDED   0x00040U
-#define OPT_VIANAMEIN  0x00080U
-#define OPT_VIANAMEOUT 0x00100U
-#define OPT_LINENUMBERS 0x00200U
-#define OPT_COUNTERS   0x00400U
-#define NUMBER_OF_OPT  11
-static const char optflags[NUMBER_OF_OPT]
+#define NUMBER_OF_OPT  ARRAY_SIZE(optflags)
+static const char optflags[]
 = { 'n', 's', 'd', 'p', 'j', 'v', 'x', 'i', 'o', '0', 'c'};
 
 static struct option original_opts[] = {
index 4a3860aa998e2af9beaec3ceef12023058398304..0de656e9d9b3cca971bbde41276e235ddf6b3f6a 100644 (file)
 static const char cmdflags[] = { 'I', 'D', 'D', 'R', 'A', 'L', 'F', 'Z',
                                 'Z', 'N', 'X', 'P', 'E', 'S' };
 
-#define OPT_NONE       0x00000U
-#define OPT_NUMERIC    0x00001U
-#define OPT_SOURCE     0x00002U
-#define OPT_DESTINATION        0x00004U
-#define OPT_PROTOCOL   0x00008U
-#define OPT_JUMP       0x00010U
-#define OPT_VERBOSE    0x00020U
-#define OPT_EXPANDED   0x00040U
-#define OPT_VIANAMEIN  0x00080U
-#define OPT_VIANAMEOUT 0x00100U
-#define OPT_LINENUMBERS 0x00200U
-#define OPT_COUNTERS   0x00400U
 #define OPT_FRAGMENT    0x00800U
-#define NUMBER_OF_OPT  12
-static const char optflags[NUMBER_OF_OPT]
+#define NUMBER_OF_OPT  ARRAY_SIZE(optflags)
+static const char optflags[]
 = { 'n', 's', 'd', 'p', 'j', 'v', 'x', 'i', 'o', '0', 'c', 'f'};
 
 static struct option original_opts[] = {
index 11d95fe57e8c3d93e1dbe74ab64ed5a57a0d14ac..06d73ab982a0cfdb177a3e921ea2afd5bdda43df 100644 (file)
--- a/xshared.h
+++ b/xshared.h
@@ -5,6 +5,21 @@
 #include <linux/netfilter_ipv4/ip_tables.h>
 #include <linux/netfilter_ipv6/ip6_tables.h>
 
+enum {
+       OPT_NONE        = 0,
+       OPT_NUMERIC     = 1 << 0,
+       OPT_SOURCE      = 1 << 1,
+       OPT_DESTINATION = 1 << 2,
+       OPT_PROTOCOL    = 1 << 3,
+       OPT_JUMP        = 1 << 4,
+       OPT_VERBOSE     = 1 << 5,
+       OPT_EXPANDED    = 1 << 6,
+       OPT_VIANAMEIN   = 1 << 7,
+       OPT_VIANAMEOUT  = 1 << 8,
+       OPT_LINENUMBERS = 1 << 9,
+       OPT_COUNTERS    = 1 << 10,
+};
+
 struct xtables_rule_match;
 struct xtables_target;