Skip to content

Commit

Permalink
net_udp: set IPV6_MULTICAST_IF only of not default
Browse files Browse the repository at this point in the history
macOS fails on it otherwise (at least 15.0), although it shouldn't
according to man ip6(4) (that is, however, presumably inherited from BSD,
because FreeBSD has the same).
  • Loading branch information
MartinPulec committed Dec 4, 2024
1 parent b99c8c1 commit 65e8bf3
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/rtp/net_udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -507,10 +507,13 @@ static bool udp_join_mcast_grp6(struct in6_addr sin6_addr, int rx_fd, int tx_fd,
} else {
MSG(WARNING, "Using multicast but not setting TTL.\n");
}
if (SETSOCKOPT(tx_fd, IPPROTO_IPV6, IPV6_MULTICAST_IF,
(char *)&ifindex, sizeof(ifindex)) != 0) {
socket_error("setsockopt IPV6_MULTICAST_IF");
return false;
if (ifindex != 0) {
if (SETSOCKOPT(tx_fd, IPPROTO_IPV6, IPV6_MULTICAST_IF,
(char *) &ifindex,
sizeof(ifindex)) != 0) {
socket_error("setsockopt IPV6_MULTICAST_IF");
return false;
}
}
}

Expand Down

0 comments on commit 65e8bf3

Please sign in to comment.