diff options
author | Phil Sutter <phil@nwl.cc> | 2019-10-17 22:26:50 +0200 |
---|---|---|
committer | Phil Sutter <phil@nwl.cc> | 2019-11-06 13:41:32 +0100 |
commit | 3c0e4590ffbca3b0153eaff3338b331de2fe737c (patch) | |
tree | 4ef5ba28f7fd33e2b66f5d36c00f5b6eb2f12eaa /iptables/xtables-restore.c | |
parent | 49d95c9002218645da157abdb91fd20c176b1c56 (diff) |
xtables-restore: Integrate restore callbacks into struct nft_xt_restore_parse
There's really no point in passing those as separate parameter. While
being at it, make them static const everywhere.
Signed-off-by: Phil Sutter <phil@nwl.cc>
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'iptables/xtables-restore.c')
-rw-r--r-- | iptables/xtables-restore.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/iptables/xtables-restore.c b/iptables/xtables-restore.c index 8d6cb7a9..341579bd 100644 --- a/iptables/xtables-restore.c +++ b/iptables/xtables-restore.c @@ -69,10 +69,10 @@ static const struct nft_xt_restore_cb restore_cb = { }; void xtables_restore_parse(struct nft_handle *h, - const struct nft_xt_restore_parse *p, - const struct nft_xt_restore_cb *cb) + const struct nft_xt_restore_parse *p) { const struct builtin_table *curtable = NULL; + const struct nft_xt_restore_cb *cb = p->cb; struct argv_store av_store = {}; char buffer[10240]; int in_table = 0; @@ -279,6 +279,7 @@ xtables_restore_main(int family, const char *progname, int argc, char *argv[]) int c; struct nft_xt_restore_parse p = { .commit = true, + .cb = &restore_cb, }; line = 0; @@ -383,7 +384,7 @@ xtables_restore_main(int family, const char *progname, int argc, char *argv[]) exit(EXIT_FAILURE); } - xtables_restore_parse(&h, &p, &restore_cb); + xtables_restore_parse(&h, &p); nft_fini(&h); fclose(p.in); @@ -427,6 +428,7 @@ int xtables_eb_restore_main(int argc, char *argv[]) { struct nft_xt_restore_parse p = { .in = stdin, + .cb = &ebt_restore_cb, }; bool noflush = false; struct nft_handle h; @@ -448,7 +450,7 @@ int xtables_eb_restore_main(int argc, char *argv[]) nft_init_eb(&h, "ebtables-restore"); h.noflush = noflush; - xtables_restore_parse(&h, &p, &ebt_restore_cb); + xtables_restore_parse(&h, &p); nft_fini(&h); return 0; @@ -467,11 +469,12 @@ int xtables_arp_restore_main(int argc, char *argv[]) { struct nft_xt_restore_parse p = { .in = stdin, + .cb = &arp_restore_cb, }; struct nft_handle h; nft_init_arp(&h, "arptables-restore"); - xtables_restore_parse(&h, &p, &arp_restore_cb); + xtables_restore_parse(&h, &p); nft_fini(&h); return 0; |