]> git.ipfire.org Git - thirdparty/nftables.git/commit
mnl: reply netlink error message might be larger than MNL_SOCKET_BUFFER_SIZE
authorPablo Neira Ayuso <pablo@netfilter.org>
Wed, 2 Dec 2020 22:20:40 +0000 (23:20 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 4 Dec 2020 11:53:00 +0000 (12:53 +0100)
commit6975c6d39366e0a086a43fa984392e2231c1b193
tree50677ff98632c4c160397dcd7d54d109bb0e94e5
parenta8dc9e2a2b40d5d29b12920873bbe1f2cfeda8f6
mnl: reply netlink error message might be larger than MNL_SOCKET_BUFFER_SIZE

Netlink attribute maximum size is 65536 bytes (given nla_len is
16-bits). NFTA_SET_ELEM_LIST_ELEMENTS stores as many set elements as
possible that can fit into this netlink attribute.

Netlink messages with NLMSG_ERROR type originating from the kernel
contain the original netlink message as payload, they might be larger
than 65536 bytes.

Add NFT_MNL_ACK_MAXSIZE which estimates the maximum Netlink header
coming as (error) reply from the kernel. This estimate is based on the
maximum netlink message size that nft sends from userspace.

Closes: https://bugzilla.netfilter.org/show_bug.cgi?id=1464
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/mnl.c
tests/shell/testcases/sets/0057set_create_fails_0 [new file with mode: 0755]