Skip to content

Commit

Permalink
Use correct protocol level for IP_MULTICAST_foo flags
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
troglobit committed Aug 19, 2021
1 parent b03d00e commit 6fbbc42
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6fbbc42

Please sign in to comment.