Skip to content

Commit 6fbbc42

Browse files
committed
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 <troglobit@gmail.com>
1 parent b03d00e commit 6fbbc42

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/socket.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,11 @@ int socket_create(int domain, int type, int proto, void (*cb)(int, void *), void
111111
} else
112112
#endif /* HAVE_IPV6_MULTICAST_HOST */
113113
{
114-
if (setsockopt(sd, SOL_SOCKET, IP_MULTICAST_LOOP, &val, sizeof(val)))
114+
if (setsockopt(sd, IPPROTO_IP, IP_MULTICAST_LOOP, &val, sizeof(val)))
115115
smclog(LOG_WARNING, "failed disabling IP_MULTICAST_LOOP: %s",
116116
strerror(errno));
117117
#ifdef IP_MULTICAST_ALL
118-
if (setsockopt(sd, SOL_SOCKET, IP_MULTICAST_ALL, &val, sizeof(val)))
118+
if (setsockopt(sd, IPPROTO_IP, IP_MULTICAST_ALL, &val, sizeof(val)))
119119
smclog(LOG_WARNING, "failed disabling IP_MULTICAST_ALL: %s",
120120
strerror(errno));
121121
#endif

0 commit comments

Comments
 (0)