]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
xtables: Move struct nft_xt_cmd_parse to xshared.h
authorPhil Sutter <phil@nwl.cc>
Wed, 22 Dec 2021 20:58:18 +0000 (21:58 +0100)
committerPhil Sutter <phil@nwl.cc>
Wed, 12 Jan 2022 13:04:52 +0000 (14:04 +0100)
Preparing for shared use with legacy variants, move it to "neutral
ground" and give it a more generic name.

Signed-off-by: Phil Sutter <phil@nwl.cc>
iptables/nft-shared.h
iptables/xshared.h
iptables/xtables-eb-translate.c
iptables/xtables-translate.c
iptables/xtables.c

index bcf8486eb44c42838c3f3e0fda1706f1dd252e02..4948aef761d10b1c35046f7c4ba79b0c0efe23fb 100644 (file)
@@ -210,20 +210,8 @@ struct xtables_args {
        unsigned long long pcnt_cnt, bcnt_cnt;
 };
 
-struct nft_xt_cmd_parse {
-       unsigned int                    command;
-       unsigned int                    rulenum;
-       char                            *table;
-       const char                      *chain;
-       const char                      *newname;
-       const char                      *policy;
-       bool                            restore;
-       int                             verbose;
-       bool                            xlate;
-};
-
 void do_parse(struct nft_handle *h, int argc, char *argv[],
-             struct nft_xt_cmd_parse *p, struct iptables_command_state *cs,
+             struct xt_cmd_parse *p, struct iptables_command_state *cs,
              struct xtables_args *args);
 
 struct nftnl_chain_list;
index 2c05b0d7c4acef2f626f1c8d32bf0f8f922f30fb..dde94b7335f6aecaa575f07c025281c2f17feaa6 100644 (file)
@@ -262,4 +262,16 @@ int print_match_save(const struct xt_entry_match *e, const void *ip);
 void xtables_printhelp(const struct xtables_rule_match *matches);
 void exit_tryhelp(int status, int line) __attribute__((noreturn));
 
+struct xt_cmd_parse {
+       unsigned int                    command;
+       unsigned int                    rulenum;
+       char                            *table;
+       const char                      *chain;
+       const char                      *newname;
+       const char                      *policy;
+       bool                            restore;
+       int                             verbose;
+       bool                            xlate;
+};
+
 #endif /* IPTABLES_XSHARED_H */
index a6c86b6531e3fdcb30938a78906467d1089b27fe..86177024ec703a652f954d1b79047a1cdae08937 100644 (file)
@@ -152,7 +152,7 @@ static void print_ebt_cmd(int argc, char *argv[])
        printf("\n");
 }
 
-static int nft_rule_eb_xlate_add(struct nft_handle *h, const struct nft_xt_cmd_parse *p,
+static int nft_rule_eb_xlate_add(struct nft_handle *h, const struct xt_cmd_parse *p,
                                 const struct iptables_command_state *cs, bool append)
 {
        struct xt_xlate *xl = xt_xlate_alloc(10240);
@@ -191,7 +191,7 @@ static int do_commandeb_xlate(struct nft_handle *h, int argc, char *argv[], char
        int selected_chain = -1;
        struct xtables_rule_match *xtrm_i;
        struct ebt_match *match;
-       struct nft_xt_cmd_parse p = {
+       struct xt_cmd_parse p = {
                .table          = *table,
         };
 
index e2948c5009dd605841f32d8b4fba63e62bf474b1..9d312b244657e343a30fe883eb6472456b93eeeb 100644 (file)
@@ -150,7 +150,7 @@ const char *family2str[] = {
 };
 
 static int nft_rule_xlate_add(struct nft_handle *h,
-                             const struct nft_xt_cmd_parse *p,
+                             const struct xt_cmd_parse *p,
                              const struct iptables_command_state *cs,
                              bool append)
 {
@@ -186,11 +186,11 @@ err_out:
        return ret;
 }
 
-static int xlate(struct nft_handle *h, struct nft_xt_cmd_parse *p,
+static int xlate(struct nft_handle *h, struct xt_cmd_parse *p,
                 struct iptables_command_state *cs,
                 struct xtables_args *args, bool append,
                 int (*cb)(struct nft_handle *h,
-                          const struct nft_xt_cmd_parse *p,
+                          const struct xt_cmd_parse *p,
                           const struct iptables_command_state *cs,
                           bool append))
 {
@@ -248,7 +248,7 @@ static int do_command_xlate(struct nft_handle *h, int argc, char *argv[],
                            char **table, bool restore)
 {
        int ret = 0;
-       struct nft_xt_cmd_parse p = {
+       struct xt_cmd_parse p = {
                .table          = *table,
                .restore        = restore,
                .xlate          = true,
index ac864eb24a35ea39545bb08e8fa6c5604193b2e4..837b399aba5b3c209f191d79562991d6d0e58a6f 100644 (file)
@@ -187,7 +187,7 @@ static void check_inverse(struct nft_handle *h, const char option[],
 }
 
 void do_parse(struct nft_handle *h, int argc, char *argv[],
-             struct nft_xt_cmd_parse *p, struct iptables_command_state *cs,
+             struct xt_cmd_parse *p, struct iptables_command_state *cs,
              struct xtables_args *args)
 {
        struct xtables_match *m;
@@ -699,7 +699,7 @@ int do_commandx(struct nft_handle *h, int argc, char *argv[], char **table,
                bool restore)
 {
        int ret = 1;
-       struct nft_xt_cmd_parse p = {
+       struct xt_cmd_parse p = {
                .table          = *table,
                .restore        = restore,
        };