]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
Merge CMD_* defines
authorPhil Sutter <phil@nwl.cc>
Mon, 13 May 2019 13:32:01 +0000 (15:32 +0200)
committerPhil Sutter <phil@nwl.cc>
Wed, 30 Oct 2019 09:01:02 +0000 (10:01 +0100)
They are mostly identical, just xtables-arp ones differ slightly. Though
since they are internal use only and their actual value doesn't matter
(as long as it's a distinct bit), they can be merged anyway.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
iptables/ip6tables.c
iptables/iptables.c
iptables/nft-shared.h
iptables/xshared.h
iptables/xtables-arp.c
iptables/xtables.c

index f4ccfc60de95389415a13a8a15b3307c5f30e791..e48fdeb1248bdf5397289098981e6ef8667caafb 100644 (file)
 #define FALSE 0
 #endif
 
-#define CMD_NONE               0x0000U
-#define CMD_INSERT             0x0001U
-#define CMD_DELETE             0x0002U
-#define CMD_DELETE_NUM         0x0004U
-#define CMD_REPLACE            0x0008U
-#define CMD_APPEND             0x0010U
-#define CMD_LIST               0x0020U
-#define CMD_FLUSH              0x0040U
-#define CMD_ZERO               0x0080U
-#define CMD_NEW_CHAIN          0x0100U
-#define CMD_DELETE_CHAIN       0x0200U
-#define CMD_SET_POLICY         0x0400U
-#define CMD_RENAME_CHAIN       0x0800U
-#define CMD_LIST_RULES         0x1000U
-#define CMD_ZERO_NUM           0x2000U
-#define CMD_CHECK              0x4000U
-#define NUMBER_OF_CMD  16
 
 #define NUMBER_OF_OPT  ARRAY_SIZE(optflags)
 static const char optflags[]
index df371f410a9c2164dcdecfb97dce4c83fc380d91..255b61b11ec897a377335a36c6e09ebdb6d9fc37 100644 (file)
 #define FALSE 0
 #endif
 
-#define CMD_NONE               0x0000U
-#define CMD_INSERT             0x0001U
-#define CMD_DELETE             0x0002U
-#define CMD_DELETE_NUM         0x0004U
-#define CMD_REPLACE            0x0008U
-#define CMD_APPEND             0x0010U
-#define CMD_LIST               0x0020U
-#define CMD_FLUSH              0x0040U
-#define CMD_ZERO               0x0080U
-#define CMD_NEW_CHAIN          0x0100U
-#define CMD_DELETE_CHAIN       0x0200U
-#define CMD_SET_POLICY         0x0400U
-#define CMD_RENAME_CHAIN       0x0800U
-#define CMD_LIST_RULES         0x1000U
-#define CMD_ZERO_NUM           0x2000U
-#define CMD_CHECK              0x4000U
-#define NUMBER_OF_CMD  16
 
 #define OPT_FRAGMENT    0x00800U
 #define NUMBER_OF_OPT  ARRAY_SIZE(optflags)
index 8b073b18fb0d9c97672d9319e96a07f8ebabbdd8..e236a981119acfef4f0e411d67d05cc6c0957f0d 100644 (file)
@@ -199,23 +199,6 @@ struct xtables_args {
        unsigned long long pcnt_cnt, bcnt_cnt;
 };
 
-#define CMD_NONE               0x0000U
-#define CMD_INSERT             0x0001U
-#define CMD_DELETE             0x0002U
-#define CMD_DELETE_NUM         0x0004U
-#define CMD_REPLACE            0x0008U
-#define CMD_APPEND             0x0010U
-#define CMD_LIST               0x0020U
-#define CMD_FLUSH              0x0040U
-#define CMD_ZERO               0x0080U
-#define CMD_NEW_CHAIN          0x0100U
-#define CMD_DELETE_CHAIN       0x0200U
-#define CMD_SET_POLICY         0x0400U
-#define CMD_RENAME_CHAIN       0x0800U
-#define CMD_LIST_RULES         0x1000U
-#define CMD_ZERO_NUM           0x2000U
-#define CMD_CHECK              0x4000U
-
 struct nft_xt_cmd_parse {
        unsigned int                    command;
        unsigned int                    rulenum;
index 85bbfa1250aa3d81ba6449443f741fe6dc3f5047..b0738b042e95aaf99b3700b8efc2135145fd149f 100644 (file)
@@ -31,6 +31,26 @@ enum {
        OPT_COUNTERS    = 1 << 10,
 };
 
+enum {
+       CMD_NONE                = 0,
+       CMD_INSERT              = 1 << 0,
+       CMD_DELETE              = 1 << 1,
+       CMD_DELETE_NUM          = 1 << 2,
+       CMD_REPLACE             = 1 << 3,
+       CMD_APPEND              = 1 << 4,
+       CMD_LIST                = 1 << 5,
+       CMD_FLUSH               = 1 << 6,
+       CMD_ZERO                = 1 << 7,
+       CMD_NEW_CHAIN           = 1 << 8,
+       CMD_DELETE_CHAIN        = 1 << 9,
+       CMD_SET_POLICY          = 1 << 10,
+       CMD_RENAME_CHAIN        = 1 << 11,
+       CMD_LIST_RULES          = 1 << 12,
+       CMD_ZERO_NUM            = 1 << 13,
+       CMD_CHECK               = 1 << 14,
+};
+#define NUMBER_OF_CMD          16
+
 struct xtables_globals;
 struct xtables_rule_match;
 struct xtables_target;
index 79cc83d354fc50d5c54c4353fb0a726f16f2d453..88a7d534da4f17cacb541fd027206461332dfcd0 100644 (file)
@@ -62,26 +62,6 @@ typedef char arpt_chainlabel[32];
 #define FALSE 0
 #endif
 
-/* XXX: command defined by nft-shared.h do not overlap with these two */
-#undef CMD_CHECK
-#undef CMD_RENAME_CHAIN
-
-#define CMD_NONE               0x0000U
-#define CMD_INSERT             0x0001U
-#define CMD_DELETE             0x0002U
-#define CMD_DELETE_NUM         0x0004U
-#define CMD_REPLACE            0x0008U
-#define CMD_APPEND             0x0010U
-#define CMD_LIST               0x0020U
-#define CMD_FLUSH              0x0040U
-#define CMD_ZERO               0x0080U
-#define CMD_NEW_CHAIN          0x0100U
-#define CMD_DELETE_CHAIN       0x0200U
-#define CMD_SET_POLICY         0x0400U
-#define CMD_CHECK              0x0800U
-#define CMD_RENAME_CHAIN       0x1000U
-#define NUMBER_OF_CMD  13
-
 #define OPTION_OFFSET 256
 
 #define OPT_NONE       0x00000U
index bb76e6a7a1ce86bb6dce29cf2e8345e24df52ed1..805bd801fb06069401cdf71822bbbe13072e942e 100644 (file)
@@ -50,8 +50,6 @@
 #define FALSE 0
 #endif
 
-#define NUMBER_OF_CMD  16
-
 #define OPT_FRAGMENT   0x00800U
 #define NUMBER_OF_OPT  ARRAY_SIZE(optflags)
 static const char optflags[]