From 63c3dae305cf27cabe5577da5599ddc26f4af36c Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Mon, 6 Aug 2018 17:21:57 +0200 Subject: xtables: Implement arptables-{save,restore} This adds C implementations for arptables-save and -restore in compat layer based on the two perl scripts in legacy arptables repository. To share common code, introduce nft_init_arp() analogous to nft_init_eb() introduced earlier. Signed-off-by: Phil Sutter Signed-off-by: Florian Westphal --- iptables/xtables-restore.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'iptables/xtables-restore.c') diff --git a/iptables/xtables-restore.c b/iptables/xtables-restore.c index a76acfd4..d2b79208 100644 --- a/iptables/xtables-restore.c +++ b/iptables/xtables-restore.c @@ -529,3 +529,29 @@ int xtables_eb_restore_main(int argc, char *argv[]) return 0; } + +struct nft_xt_restore_cb arp_restore_cb = { + .chain_list = get_chain_list, + .commit = nft_commit, + .table_new = nft_table_new, + .table_flush = nft_table_flush, + .chain_user_flush = nft_chain_user_flush, + .chain_del = chain_delete, + .do_command = do_commandarp, + .chain_set = nft_chain_set, + .chain_user_add = nft_chain_user_add, +}; + +int xtables_arp_restore_main(int argc, char *argv[]) +{ + struct nft_xt_restore_parse p = { + .in = stdin, + }; + struct nft_handle h; + + nft_init_arp(&h, "arptables-restore"); + xtables_restore_parse(&h, &p, &arp_restore_cb, argc, argv); + nft_fini(&h); + + return 0; +} -- cgit v1.2.3