summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ip6tables.c16
-rw-r--r--iptables.c16
-rw-r--r--xshared.h15
3 files changed, 19 insertions, 28 deletions
diff --git a/ip6tables.c b/ip6tables.c
index ac376e23..7f8a8df6 100644
--- a/ip6tables.c
+++ b/ip6tables.c
@@ -86,20 +86,8 @@
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[] = {
diff --git a/iptables.c b/iptables.c
index 4a3860aa..0de656e9 100644
--- a/iptables.c
+++ b/iptables.c
@@ -83,21 +83,9 @@
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[] = {
diff --git a/xshared.h b/xshared.h
index 11d95fe5..06d73ab9 100644
--- 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;