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)
Sun, Oct 20, 3:43 AM
Unknown Object (File)
Sep 29 2024, 6:12 PM
Unknown Object (File)
Sep 29 2024, 5:34 PM
Unknown Object (File)
Sep 27 2024, 12:06 AM
Unknown Object (File)
Sep 26 2024, 9:58 PM
Unknown Object (File)
Sep 25 2024, 8:27 PM
Unknown Object (File)
Sep 25 2024, 6:53 PM
Unknown Object (File)
Sep 23 2024, 1:50 AM

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 Passed
Unit
No Test Coverage
Build Status
Buildable 48565
Build 45451: arc lint + arc unit

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