From dc8d8fce581bff4640803f3db07f0c2df5e7e18f Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Wed, 22 Dec 2021 21:58:18 +0100 Subject: xtables: Move struct nft_xt_cmd_parse to xshared.h Preparing for shared use with legacy variants, move it to "neutral ground" and give it a more generic name. Signed-off-by: Phil Sutter --- iptables/nft-shared.h | 14 +------------- iptables/xshared.h | 12 ++++++++++++ iptables/xtables-eb-translate.c | 4 ++-- iptables/xtables-translate.c | 8 ++++---- iptables/xtables.c | 4 ++-- 5 files changed, 21 insertions(+), 21 deletions(-) (limited to 'iptables') diff --git a/iptables/nft-shared.h b/iptables/nft-shared.h index bcf8486e..4948aef7 100644 --- a/iptables/nft-shared.h +++ b/iptables/nft-shared.h @@ -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; diff --git a/iptables/xshared.h b/iptables/xshared.h index 2c05b0d7..dde94b73 100644 --- a/iptables/xshared.h +++ b/iptables/xshared.h @@ -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 */ diff --git a/iptables/xtables-eb-translate.c b/iptables/xtables-eb-translate.c index a6c86b65..86177024 100644 --- a/iptables/xtables-eb-translate.c +++ b/iptables/xtables-eb-translate.c @@ -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, }; diff --git a/iptables/xtables-translate.c b/iptables/xtables-translate.c index e2948c50..9d312b24 100644 --- a/iptables/xtables-translate.c +++ b/iptables/xtables-translate.c @@ -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, diff --git a/iptables/xtables.c b/iptables/xtables.c index ac864eb2..837b399a 100644 --- a/iptables/xtables.c +++ b/iptables/xtables.c @@ -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, }; -- cgit v1.2.3