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
F96622023: D37565.id113671.diff
Wed, Sep 25, 6:53 PM
Unknown Object (File)
Mon, Sep 23, 1:50 AM
Unknown Object (File)
Sun, Sep 22, 11:25 PM
Unknown Object (File)
Sun, Sep 22, 6:26 PM
Unknown Object (File)
Sat, Sep 21, 12:35 AM
Unknown Object (File)
Fri, Sep 20, 4:28 PM
Unknown Object (File)
Thu, Sep 19, 5:26 PM
Unknown Object (File)
Tue, Sep 17, 4:04 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 48564
Build 45450: 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 ↗(On Diff #113670)

Missed that one before.

220–224 ↗(On Diff #113670)

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 ↗(On Diff #113671)