3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-01 15:49:49 +01:00

monitor: Try to enable PACKET_MR_ALLMULTI on netlink monitor device

This commit is contained in:
Marcel Holtmann 2014-08-09 12:32:55 -07:00
parent b5b292ee25
commit 933ac55cce

View File

@ -1144,6 +1144,7 @@ static struct l_io *open_packet(const char *name)
{ {
struct l_io *io; struct l_io *io;
struct sockaddr_ll sll; struct sockaddr_ll sll;
struct packet_mreq mr;
struct ifreq ifr; struct ifreq ifr;
int fd; int fd;
@ -1172,6 +1173,19 @@ static struct l_io *open_packet(const char *name)
return NULL; return NULL;
} }
memset(&mr, 0, sizeof(mr));
mr.mr_ifindex = ifr.ifr_ifindex;
mr.mr_type = PACKET_MR_ALLMULTI;
if (setsockopt(fd, SOL_PACKET, PACKET_ADD_MEMBERSHIP,
&mr, sizeof(mr) < 0)) {
perror("Failed to enable all multicast");
if (errno != EINVAL) {
close(fd);
return NULL;
}
}
io = l_io_new(fd); io = l_io_new(fd);
l_io_set_close_on_destroy(io, true); l_io_set_close_on_destroy(io, true);