Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

netfilter: nfnetlink: Handle ACK flags for batch messages

The NLM_F_ACK flag is ignored for nfnetlink batch begin and end
messages. This is a problem for ynl which wants to receive an ack for
every message it sends, not just the commands in between the begin/end
messages.

Add processing for ACKs for begin/end messages and provide responses
when requested.

I have checked that iproute2, pyroute2 and systemd are unaffected by
this change since none of them use NLM_F_ACK for batch begin/end.

Signed-off-by: Donald Hunter <donald.hunter@gmail.com>
Link: https://lore.kernel.org/r/20240418104737.77914-5-donald.hunter@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Donald Hunter and committed by
Jakub Kicinski
bf2ac490 ba8be00f

+5
+5
net/netfilter/nfnetlink.c
··· 427 427 428 428 nfnl_unlock(subsys_id); 429 429 430 + if (nlh->nlmsg_flags & NLM_F_ACK) 431 + nfnl_err_add(&err_list, nlh, 0, &extack); 432 + 430 433 while (skb->len >= nlmsg_total_size(0)) { 431 434 int msglen, type; 432 435 ··· 576 573 } else if (err) { 577 574 ss->abort(net, oskb, NFNL_ABORT_NONE); 578 575 netlink_ack(oskb, nlmsg_hdr(oskb), err, NULL); 576 + } else if (nlh->nlmsg_flags & NLM_F_ACK) { 577 + nfnl_err_add(&err_list, nlh, 0, &extack); 579 578 } 580 579 } else { 581 580 enum nfnl_abort_action abort_action;