opnsense-src/sys/netlink
Alexander V. Chernikov f4d3aa7490 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
2022-11-30 13:24:38 +00:00
..
route netlink: remove private netlink_var.h header from the non-netlink core files. 2022-11-03 17:04:18 +00:00
netlink.h netlink: fix NLMSG_SPACE() macro. 2022-10-31 15:02:12 +00:00
netlink_ctl.h
netlink_debug.h
netlink_domain.c netlink: allow more than 64 groups per netlink socket. 2022-11-03 17:05:34 +00:00
netlink_generic.c netlink: unregister groups along with family 2022-11-08 12:46:58 +01:00
netlink_generic.h netlink: fix genetlink CTRL_ATTR_MCAST_GRP_MAX define. 2022-10-31 15:03:27 +00:00
netlink_io.c netlink: suppress sending NLMSG_ERROR if NLMSG_DONE is already sent 2022-11-30 13:24:38 +00:00
netlink_linux.h
netlink_message_parser.c
netlink_message_parser.h netlink: fix build without INVARIANTS 2022-10-01 21:20:50 +00:00
netlink_message_writer.c netlink: suppress sending NLMSG_ERROR if NLMSG_DONE is already sent 2022-11-30 13:24:38 +00:00
netlink_message_writer.h netlink: suppress sending NLMSG_ERROR if NLMSG_DONE is already sent 2022-11-30 13:24:38 +00:00
netlink_module.c netlink: Fix build without VIMAGE 2022-10-01 21:41:54 -04:00
netlink_route.c netlink: remove private netlink_var.h header from the non-netlink core files. 2022-11-03 17:04:18 +00:00
netlink_route.h
netlink_var.h netlink: allow more than 64 groups per netlink socket. 2022-11-03 17:05:34 +00:00