HomeFreeBSD

netlink: suppress sending NLMSG_ERROR if NLMSG_DONE is already sent

Description

netlink: suppress sending NLMSG_ERROR if NLMSG_DONE is already sent

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.

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>

Reviewed by: bapt,pauamma
Tested by: bapt
Differential Revision: https://reviews.freebsd.org/D37565

Details

Provenance
melifaroAuthored on Nov 30 2022, 12:15 PM
Reviewer
bapt
Differential Revision
D37565: netlink: suppress sending NLMSG_ERROR if NLMSG_DONE is already sent
Parents
rG821549a9dfdf: OptionalObsoleteFiles.inc: add zoneinfo/America/Ciudad_Juarez
Branches
Unknown
Tags
Unknown