aboutsummaryrefslogtreecommitdiff
path: root/sys/netlink/netlink_message_writer.h
diff options
context:
space:
mode:
authorAlexander V. Chernikov <melifaro@FreeBSD.org>2022-11-30 12:15:23 +0000
committerAlexander V. Chernikov <melifaro@FreeBSD.org>2023-01-23 22:04:03 +0000
commita6b537f6b9459dbc0f5f2f60d973f025c6e63782 (patch)
tree1a4012a2895dcfb3ab81c5758dc008ddd8d884b5 /sys/netlink/netlink_message_writer.h
parent02b958b19535828d8f19bf3601ae88ecf4503d33 (diff)
downloadsrc-a6b537f6b9459dbc0f5f2f60d973f025c6e63782.tar.gz
src-a6b537f6b9459dbc0f5f2f60d973f025c6e63782.zip
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 (cherry picked from commit f4d3aa74908496f1f5815caca94ebd86944b17cb)
Diffstat (limited to 'sys/netlink/netlink_message_writer.h')
-rw-r--r--sys/netlink/netlink_message_writer.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/netlink/netlink_message_writer.h b/sys/netlink/netlink_message_writer.h
index 424983282e59..99f50fb94213 100644
--- a/sys/netlink/netlink_message_writer.h
+++ b/sys/netlink/netlink_message_writer.h
@@ -55,6 +55,7 @@ struct nl_writer {
uint8_t writer_target; /* NS_WRITER_TARGET_* */
bool ignore_limit; /* If true, ignores RCVBUF limit */
bool enomem; /* True if ENOMEM occured */
+ bool suppress_ack; /* If true, don't send NLMSG_ERR */
};
#define NS_WRITER_TARGET_SOCKET 0
#define NS_WRITER_TARGET_GROUP 1