]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
xtables-restore: Constify struct nft_xt_restore_cb
authorPhil Sutter <phil@nwl.cc>
Thu, 17 Oct 2019 20:49:26 +0000 (22:49 +0200)
committerPhil Sutter <phil@nwl.cc>
Fri, 18 Oct 2019 09:57:31 +0000 (11:57 +0200)
There is no need for dynamic callback mangling, so make all instances
static const.

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

index 5c6641505f3db83b4cb9c9b9cc344ce93d71171c..b062f3e5792e37b58e17bad62c6de1e75dba0e98 100644 (file)
@@ -262,7 +262,7 @@ struct nft_xt_restore_cb {
 
 void xtables_restore_parse(struct nft_handle *h,
                           const struct nft_xt_restore_parse *p,
-                          struct nft_xt_restore_cb *cb);
+                          const struct nft_xt_restore_cb *cb);
 
 void nft_check_xt_legacy(int family, bool is_ipt_save);
 #endif
index 4652d631d22191afb1d2b16ed22f5d7444917d9a..df8844208c273e30dcb3589fef92ee84cb93c467 100644 (file)
@@ -70,7 +70,7 @@ static struct nftnl_chain_list *get_chain_list(struct nft_handle *h,
        return chain_list;
 }
 
-struct nft_xt_restore_cb restore_cb = {
+static const struct nft_xt_restore_cb restore_cb = {
        .chain_list     = get_chain_list,
        .commit         = nft_commit,
        .abort          = nft_abort,
@@ -87,7 +87,7 @@ static const struct xtc_ops xtc_ops = {
 
 void xtables_restore_parse(struct nft_handle *h,
                           const struct nft_xt_restore_parse *p,
-                          struct nft_xt_restore_cb *cb)
+                          const struct nft_xt_restore_cb *cb)
 {
        const struct builtin_table *curtable = NULL;
        char buffer[10240];
@@ -432,7 +432,7 @@ static int ebt_table_flush(struct nft_handle *h, const char *table)
        return nft_table_flush(h, table);
 }
 
-struct nft_xt_restore_cb ebt_restore_cb = {
+static const struct nft_xt_restore_cb ebt_restore_cb = {
        .chain_list     = get_chain_list,
        .commit         = nft_bridge_commit,
        .table_new      = nft_table_new,
@@ -478,7 +478,7 @@ int xtables_eb_restore_main(int argc, char *argv[])
        return 0;
 }
 
-struct nft_xt_restore_cb arp_restore_cb = {
+static const struct nft_xt_restore_cb arp_restore_cb = {
        .chain_list     = get_chain_list,
        .commit         = nft_commit,
        .table_new      = nft_table_new,
index 64e7667a253e7696e445a9a8c976674c4d449403..43607901fc62b49c230e3ab669b74a7ad525a206 100644 (file)
@@ -413,7 +413,7 @@ static int dummy_compat_rev(const char *name, uint8_t rev, int opt)
        return 1;
 }
 
-static struct nft_xt_restore_cb cb_xlate = {
+static const struct nft_xt_restore_cb cb_xlate = {
        .table_new      = xlate_table_new,
        .chain_set      = xlate_chain_set,
        .chain_restore  = xlate_chain_user_restore,