From bbc33f6ec310d98b9100fb883a2b8908ede1b5a8 Mon Sep 17 00:00:00 2001 From: "Ondrej Zajicek (work)" Date: Sat, 15 Jan 2022 22:39:40 +0100 Subject: [PATCH] Netlink: Add another workaround for older kernel headers Unfortunately, SOL_NETLINK is both recently added and arch-dependent, so we cannot just define it. --- sysdep/linux/netlink.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sysdep/linux/netlink.c b/sysdep/linux/netlink.c index 27b1a617..ccd62f26 100644 --- a/sysdep/linux/netlink.c +++ b/sysdep/linux/netlink.c @@ -164,7 +164,14 @@ nl_open_sock(struct nl_sock *nl) static void nl_set_strict_dump(struct nl_sock *nl, int strict) { + /* + * Strict checking is not necessary, it improves behavior on newer kernels. + * If it is not available (missing SOL_NETLINK compile-time, or ENOPROTOOPT + * run-time), we can just ignore it. + */ +#ifdef SOL_NETLINK setsockopt(nl->fd, SOL_NETLINK, NETLINK_GET_STRICT_CHK, &strict, sizeof(strict)); +#endif } static void