udp: Use the IP_ADD_MEMBERSHIP socket option.
For some reason, MCAST_JOIN_GROUP is not working under uClinux. We can just stick with the more traditional method. Signed-off-by: Richard Cochran <richardcochran@gmail.com>master
parent
447d4d442c
commit
5555a2f029
16
udp.c
16
udp.c
|
@ -143,15 +143,15 @@ static int mcast_join(int fd, int index, const struct sockaddr *grp,
|
||||||
socklen_t grplen)
|
socklen_t grplen)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
struct group_req req;
|
struct ip_mreqn req;
|
||||||
req.gr_interface = index;
|
struct sockaddr_in *sa = (struct sockaddr_in *) grp;
|
||||||
if (grplen > sizeof(req.gr_group)) {
|
|
||||||
return -1;
|
memset(&req, 0, sizeof(req));
|
||||||
}
|
memcpy(&req.imr_multiaddr, &sa->sin_addr, sizeof(struct in_addr));
|
||||||
memcpy(&req.gr_group, grp, grplen);
|
req.imr_ifindex = index;
|
||||||
err = setsockopt(fd, IPPROTO_IP, MCAST_JOIN_GROUP, &req, sizeof(req));
|
err = setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, &req, sizeof(req));
|
||||||
if (err) {
|
if (err) {
|
||||||
pr_err("setsockopt MCAST_JOIN_GROUP failed: %m");
|
pr_err("setsockopt IP_ADD_MEMBERSHIP failed: %m");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue