]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
nft: Introduce nft_bridge_commit()
authorPhil Sutter <phil@nwl.cc>
Fri, 30 Aug 2019 09:47:42 +0000 (11:47 +0200)
committerPhil Sutter <phil@nwl.cc>
Mon, 23 Sep 2019 11:05:05 +0000 (13:05 +0200)
No need to check family value from nft_commit() if we can have a
dedicated callback for bridge family.

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

index 81d01310c7f8c1c8120d1839d946de74c0c1ea63..77ebc4f651e15adbba11154e9f3d867a5a2812a7 100644 (file)
@@ -3069,11 +3069,15 @@ static void nft_bridge_commit_prepare(struct nft_handle *h)
 
 int nft_commit(struct nft_handle *h)
 {
-       if (h->family == NFPROTO_BRIDGE)
-               nft_bridge_commit_prepare(h);
        return nft_action(h, NFT_COMPAT_COMMIT);
 }
 
+int nft_bridge_commit(struct nft_handle *h)
+{
+       nft_bridge_commit_prepare(h);
+       return nft_commit(h);
+}
+
 int nft_abort(struct nft_handle *h)
 {
        return nft_action(h, NFT_COMPAT_ABORT);
index 5e5e765b0d0430a4ef38c04e1ff7245e42960244..43463d7f262e843f70e4092b6485ca4c37c906d5 100644 (file)
@@ -147,6 +147,7 @@ uint32_t nft_invflags2cmp(uint32_t invflags, uint32_t flag);
  * global commit and abort
  */
 int nft_commit(struct nft_handle *h);
+int nft_bridge_commit(struct nft_handle *h);
 int nft_abort(struct nft_handle *h);
 int nft_abort_policy_rule(struct nft_handle *h, const char *table);
 
index fb3daba0bd604008b56f04f61952eaa7eaa4005c..a9081c78c3bc36943e66424d9b4771ae7a392228 100644 (file)
@@ -51,7 +51,7 @@ int xtables_eb_main(int argc, char *argv[])
 
        ret = do_commandeb(&h, argc, argv, &table, false);
        if (ret)
-               ret = nft_commit(&h);
+               ret = nft_bridge_commit(&h);
 
        if (!ret)
                fprintf(stderr, "ebtables: %s\n", nft_strerror(errno));
index 601c842feab383c1588a73473672a32c56eea4d7..f930f5ba2d167526b35f128f19024c2f9127b4e9 100644 (file)
@@ -463,7 +463,7 @@ static int ebt_table_flush(struct nft_handle *h, const char *table)
 
 struct nft_xt_restore_cb ebt_restore_cb = {
        .chain_list     = get_chain_list,
-       .commit         = nft_commit,
+       .commit         = nft_bridge_commit,
        .table_new      = nft_table_new,
        .table_flush    = ebt_table_flush,
        .do_command     = do_commandeb,