Should NLMSG_DONE has flag NLM_F_MULTI?
Subsystems (2)
Hi,
When checking the NLMSG_DONE message in kernel, I saw lot of functions would set NLM_F_MULTI flag. e.g. netlink_dump_done(), devlink_dpipe_{tables, entries, headers}_fill().
But from rfc3549[1]:
[...] For multipart
messages, the first and all following headers have the NLM_F_MULTI Netlink header flag set, except for the last header which has the Netlink header type NLMSG_DONE.
What I understand is the last nlmsghdr(NLMSG_DONE message) doesn't need to have NLM_F_MULTI flag. Am I missing something?
[1] https://www.rfc-editor.org/rfc/rfc3549.html#section-2.3.2
Thanks
Hangbin
Jakub Kicinski
maintainerQuoted 11 lines · On Wed, 24 Aug 2022 11:20:18 +0800 Hangbin Liu wrote:
When checking the
NLMSG_DONEmessage in kernel, I saw lot of functions would setNLM_F_MULTIflag. e.g.netlink_dump_done(), devlink_dpipe_{tables, entries, headers}_fill().But from rfc3549[1]:
[...] For multipart
messages, the first and all following headers have theNLM_F_MULTINetlink header flag set, except for the last header which has the Netlink header typeNLMSG_DONE.
Quoted 4 lines
What I understand is the last
nlmsghdr(NLMSG_DONE message)doesn't need to haveNLM_F_MULTIflag. Am I missing something?[1] https://www.rfc-editor.org/rfc/rfc3549.html#section-2.3.2
Looks like you're right, we seem to fairly consistently set it. Yet another thing in Netlink we defined and then used differently? In practice it likely does not matter, I'd think.
Quoted 12 lines · Jakub Kicinski
Quoted 11 lines · On Wed, 24 Aug 2022 11:20:18 +0800 Hangbin Liu wrote:
When checking the
NLMSG_DONEmessage in kernel, I saw lot of functions would setNLM_F_MULTIflag. e.g.netlink_dump_done(), devlink_dpipe_{tables, entries, headers}_fill().But from rfc3549[1]:
[...] For multipart
messages, the first and all following headers have theNLM_F_MULTINetlink header flag set, except for the last header which has the Netlink header typeNLMSG_DONE.
Quoted 8 lines
Quoted 4 lines
What I understand is the last
nlmsghdr(NLMSG_DONE message)doesn't need to haveNLM_F_MULTIflag. Am I missing something?[1] https://www.rfc-editor.org/rfc/rfc3549.html#section-2.3.2
Looks like you're right, we seem to fairly consistently set it. Yet another thing in Netlink we defined and then used differently? In practice it likely does not matter, I'd think.
Yes, thanks for the confirmation. I have no plan to change the current kernel behavior. But for my later patch, I will not add NLM_F_MULTI for NLMSG_DONE message.
Thanks
Hangbin