summaryrefslogtreecommitdiffstats
path: root/zebra
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2022-06-30 14:03:02 +0200
committerDonald Sharp <sharpd@nvidia.com>2022-06-30 14:03:02 +0200
commitcc408c062b6c6e729c4d94114c724ee31ee16baa (patch)
tree54252a9147afb033c71ea2b53d1bca20e40b3457 /zebra
parentzebra: Correct implication of SOL_NETLINK NETLINK_ADD_MEMBERSHIP usage (diff)
downloadfrr-cc408c062b6c6e729c4d94114c724ee31ee16baa.tar.xz
frr-cc408c062b6c6e729c4d94114c724ee31ee16baa.zip
zebra: Realign SOL_NETLINK to warn when FRR does not have it
There exists a possibility that an end operator has choosen to compile FRR on an extremely old KERNEL that does not support the SOL_NETLINK sockopt call. If so let's note it for them instead of stuff silently not working. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'zebra')
-rw-r--r--zebra/kernel_netlink.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/zebra/kernel_netlink.c b/zebra/kernel_netlink.c
index e372eaf6a..31d8294a0 100644
--- a/zebra/kernel_netlink.c
+++ b/zebra/kernel_netlink.c
@@ -322,11 +322,11 @@ static int netlink_socket(struct nlsock *nl, unsigned long groups,
snl.nl_family = AF_NETLINK;
snl.nl_groups = groups;
-#if defined SOL_NETLINK
if (ext_group_size) {
uint8_t i;
for (i = 0; i < ext_group_size; i++) {
+#if defined SOL_NETLINK
ret = setsockopt(sock, SOL_NETLINK,
NETLINK_ADD_MEMBERSHIP,
&ext_groups[i],
@@ -338,9 +338,14 @@ static int netlink_socket(struct nlsock *nl, unsigned long groups,
ext_groups[i],
safe_strerror(errno), errno);
}
+#else
+ zlog_notice(
+ "Unable to use NETLINK_ADD_MEMBERSHIP via SOL_NETLINK for %s(%u) since the linux kernel does not support the socket option",
+ group2str(ext_groups[i]),
+ ext_groups[i]);
+#endif
}
}
-#endif
/* Bind the socket to the netlink structure for anything. */
ret = bind(sock, (struct sockaddr *)&snl, sizeof(snl));