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
Richard Cochran 2012-01-01 19:44:49 +01:00
parent 5555a2f029
commit 95d5c36c0f
1 changed files with 6 additions and 1 deletions

7
udp.c
View File

@ -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;
} }