From 6fbbc42645ccb0ffafc6046c3ec0bbd153efe8b0 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Thu, 19 Aug 2021 15:01:54 +0200 Subject: [PATCH] Use correct protocol level for IP_MULTICAST_foo flags The SOL_SOCKET protocol level works only on Linux, not on FreeBSD. The IPPROTO_IP protocol level is the canonical, which both support, and is also documented in Linux ip(7). Signed-off-by: Joachim Wiberg --- src/socket.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/socket.c b/src/socket.c index 4f716437..ac37fd40 100644 --- a/src/socket.c +++ b/src/socket.c @@ -111,11 +111,11 @@ int socket_create(int domain, int type, int proto, void (*cb)(int, void *), void } else #endif /* HAVE_IPV6_MULTICAST_HOST */ { - if (setsockopt(sd, SOL_SOCKET, IP_MULTICAST_LOOP, &val, sizeof(val))) + if (setsockopt(sd, IPPROTO_IP, IP_MULTICAST_LOOP, &val, sizeof(val))) smclog(LOG_WARNING, "failed disabling IP_MULTICAST_LOOP: %s", strerror(errno)); #ifdef IP_MULTICAST_ALL - if (setsockopt(sd, SOL_SOCKET, IP_MULTICAST_ALL, &val, sizeof(val))) + if (setsockopt(sd, IPPROTO_IP, IP_MULTICAST_ALL, &val, sizeof(val))) smclog(LOG_WARNING, "failed disabling IP_MULTICAST_ALL: %s", strerror(errno)); #endif