git: e83f23eb5ef3 - main - netlink: enable extended error reporting in snl(3).

From: Alexander V. Chernikov <melifaro_at_FreeBSD.org>
Date: Tue, 25 Apr 2023 11:21:10 UTC
The branch main has been updated by melifaro:

URL: https://cgit.FreeBSD.org/src/commit/?id=e83f23eb5ef3b793af5179403243c82983d3b9a2

commit e83f23eb5ef3b793af5179403243c82983d3b9a2
Author:     Alexander V. Chernikov <melifaro@FreeBSD.org>
AuthorDate: 2023-04-25 11:20:35 +0000
Commit:     Alexander V. Chernikov <melifaro@FreeBSD.org>
CommitDate: 2023-04-25 11:21:03 +0000

    netlink: enable extended error reporting in snl(3).
    
    MFC after:      2 weeks
---
 sys/netlink/netlink_snl.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/sys/netlink/netlink_snl.h b/sys/netlink/netlink_snl.h
index 7eac38961a45..191a303111fa 100644
--- a/sys/netlink/netlink_snl.h
+++ b/sys/netlink/netlink_snl.h
@@ -228,8 +228,14 @@ snl_init(struct snl_state *ss, int netlink_family)
 		return (false);
 	ss->init_done = true;
 
+	int val = 1;
+	socklen_t optlen = sizeof(val);
+	if (setsockopt(ss->fd, SOL_NETLINK, NETLINK_EXT_ACK, &val, optlen) == -1) {
+		snl_free(ss);
+		return (false);
+	}
+
 	int rcvbuf;
-	socklen_t optlen = sizeof(rcvbuf);
 	if (getsockopt(ss->fd, SOL_SOCKET, SO_RCVBUF, &rcvbuf, &optlen) == -1) {
 		snl_free(ss);
 		return (false);