]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
mnl: Call mnl_attr_nest_end() just once
authorPhil Sutter <phil@nwl.cc>
Wed, 16 Jul 2025 12:26:08 +0000 (14:26 +0200)
committerPhil Sutter <phil@nwl.cc>
Wed, 16 Jul 2025 13:25:02 +0000 (15:25 +0200)
Calling the function after each added nested attribute is harmless but
pointless.

Fixes: a66b5ad9540dd ("src: allow for updating devices on existing netdev chain")
Signed-off-by: Phil Sutter <phil@nwl.cc>
src/mnl.c

index 89bc742af3c5b8fabebed8815a806dd1e2ec04b8..43229f2498e553f63ee2d1f11d785039b8bcd0fb 100644 (file)
--- a/src/mnl.c
+++ b/src/mnl.c
@@ -811,8 +811,8 @@ static void mnl_nft_chain_devs_build(struct nlmsghdr *nlh, struct cmd *cmd)
                for (i = 0; i < num_devs; i++) {
                        cmd_add_loc(cmd, nlh, dev_array[i].location);
                        mnl_attr_put_strz(nlh, NFTA_DEVICE_NAME, dev_array[i].ifname);
-                       mnl_attr_nest_end(nlh, nest_dev);
                }
+               mnl_attr_nest_end(nlh, nest_dev);
        }
        nft_dev_array_free(dev_array);
 }