Netlink: Add another workaround for older kernel headers

Unfortunately, SOL_NETLINK is both recently added and arch-dependent,
so we cannot just define it.
This commit is contained in:
Ondrej Zajicek (work) 2022-01-15 22:39:40 +01:00
parent 8988264a64
commit bbc33f6ec3

View file

@ -164,7 +164,14 @@ nl_open_sock(struct nl_sock *nl)
static void static void
nl_set_strict_dump(struct nl_sock *nl, int strict) 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)); setsockopt(nl->fd, SOL_NETLINK, NETLINK_GET_STRICT_CHK, &strict, sizeof(strict));
#endif
} }
static void static void