Skip to contentSkip to conversation

Should NLMSG_DONE has flag NLM_F_MULTI?

Question Hangbin Liu 2 participants 3 messages Aug 24, 2022 – Aug 25, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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

maintainer
#1 lore raw
Quoted 11 lines · On Wed, 24 Aug 2022 11:20:18 +0800 Hangbin Liu wrote:

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.

Quoted 4 lines

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

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.

#2 lore raw
Quoted 12 lines · Jakub Kicinski
Quoted 11 lines · On Wed, 24 Aug 2022 11:20:18 +0800 Hangbin Liu wrote:

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.

Quoted 8 lines
Quoted 4 lines

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

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