udp: turn off multicast loop back.
This option is on by default, but we don't want or need it. Signed-off-by: Richard Cochran <richardcochran@gmail.com>master
parent
5555a2f029
commit
95d5c36c0f
7
udp.c
7
udp.c
|
@ -142,7 +142,7 @@ static int mcast_bind(int fd, int index)
|
||||||
static int mcast_join(int fd, int index, const struct sockaddr *grp,
|
static int mcast_join(int fd, int index, const struct sockaddr *grp,
|
||||||
socklen_t grplen)
|
socklen_t grplen)
|
||||||
{
|
{
|
||||||
int err;
|
int err, off = 0;
|
||||||
struct ip_mreqn req;
|
struct ip_mreqn req;
|
||||||
struct sockaddr_in *sa = (struct sockaddr_in *) grp;
|
struct sockaddr_in *sa = (struct sockaddr_in *) grp;
|
||||||
|
|
||||||
|
@ -154,6 +154,11 @@ static int mcast_join(int fd, int index, const struct sockaddr *grp,
|
||||||
pr_err("setsockopt IP_ADD_MEMBERSHIP failed: %m");
|
pr_err("setsockopt IP_ADD_MEMBERSHIP failed: %m");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
err = setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP, &off, sizeof(off));
|
||||||
|
if (err) {
|
||||||
|
pr_err("setsockopt IP_MULTICAST_LOOP failed: %m");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue