Page MenuHomeFreeBSD

netlink: suppress sending NLMSG_ERROR if NLMSG_DONE is already sent
ClosedPublic

Authored by melifaro on Nov 30 2022, 12:34 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 17 2024, 2:46 AM
Unknown Object (File)
Mar 17 2024, 2:46 AM
Unknown Object (File)
Dec 20 2023, 6:52 AM
Unknown Object (File)
Dec 12 2023, 3:47 AM
Unknown Object (File)
Nov 6 2023, 10:53 PM
Unknown Object (File)
Nov 1 2023, 1:46 PM
Unknown Object (File)
Nov 1 2023, 1:42 PM
Unknown Object (File)
Oct 5 2023, 9:44 PM

Details

Summary

Netlink has a confirmation/error reporting mechanism for the sent
messages. Kernel explicitly acks each messages if requested (NLM_F_ACK)
or if message processing results in an error.
Similarly, for multipart messages - typically dumps, where each message
represents a single object like an interface or a route - another
message, NLMSG_DONE is used to indicate the end of dump and the
resulting status.
As a result, successfull dump ends with both NLMSG_DONE and NLMSG_ERROR
messages.
RFC 3549 does not say anything specific about such case.
Linux adopted an optimisation which suppresses NLMSG_ERROR message
when NLMSG_DONE is already sent. Certain libraries/applications like
libnl depends on such behavior.

Suppress sending NLMSG_ERROR if NLMSG_DONE is already sent, by
setting newly-added 'suppress_ack' flag in the writer and checking
this flag when generating ack.

This change restores libnl compatibility.

Test Plan

Before:

~ nl-link-list
Error: Unable to allocate link cache: Message sequence number mismatch
`

After:

~ nl-link-list
vtnet0 ether 52:54:00:14:e3:19 <broadcast,multicast,up,running>
lo0 ieee1394 <loopback,multicast,up,running>

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

melifaro edited the test plan for this revision. (Show Details)
melifaro added reviewers: network, bapt.
pauamma_gundo.com added inline comments.
share/man/man4/netlink.4
215

Missed that one before.

220–224

Rewrite for clarity (but check this is what you meant) and consistency with use of "group" just below.

If you decide not to go with it, s/multipath/multipart/ on the last line.

This revision now requires changes to proceed.Nov 30 2022, 1:10 PM

tested with success!

melifaro marked an inline comment as done.

Address (most of) the comments.

This revision was not accepted when it landed; it landed in state Needs Review.Nov 30 2022, 1:26 PM
This revision was automatically updated to reflect the committed changes.

Other than that nit fixable on commit, manual page English LGTM and appears consistent with change summary.

share/man/man4/netlink.4
224