diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2019-07-31 13:25:58 -0700 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2019-07-31 13:25:58 -0700 |
| commit | 632d6e04ad76bd45307d2706e62416e64a89a736 (patch) | |
| tree | 73ebeff8a95874e8039a10306c5e284db0c71c87 /osdep/MacEthernetTap.cpp | |
| parent | db813db7e875c257e42c41ab8091c3df1e9300a5 (diff) | |
| download | infinitytier-632d6e04ad76bd45307d2706e62416e64a89a736.tar.gz infinitytier-632d6e04ad76bd45307d2706e62416e64a89a736.zip | |
Mac multicast bug fix -- GitHub issue #986
Diffstat (limited to 'osdep/MacEthernetTap.cpp')
| -rw-r--r-- | osdep/MacEthernetTap.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/osdep/MacEthernetTap.cpp b/osdep/MacEthernetTap.cpp index 0f534299..a11a75e2 100644 --- a/osdep/MacEthernetTap.cpp +++ b/osdep/MacEthernetTap.cpp @@ -165,6 +165,7 @@ MacEthernetTap::MacEthernetTap( break; } } + _dev = devstr; if (::pipe(_shutdownSignalPipe)) throw std::runtime_error("pipe creation failed"); @@ -285,7 +286,7 @@ std::vector<InetAddress> MacEthernetTap::ips() const if (!getifaddrs(&ifa)) { struct ifaddrs *p = ifa; while (p) { - if ((!strcmp(p->ifa_name,_dev.c_str()))&&(p->ifa_addr)&&(p->ifa_netmask)&&(p->ifa_addr->sa_family == p->ifa_netmask->sa_family)) { + if ((p->ifa_name)&&(!strcmp(p->ifa_name,_dev.c_str()))&&(p->ifa_addr)) { switch(p->ifa_addr->sa_family) { case AF_INET: { struct sockaddr_in *sin = (struct sockaddr_in *)p->ifa_addr; @@ -361,7 +362,7 @@ void MacEthernetTap::scanMulticastGroups(std::vector<MulticastGroup> &added,std: newGroups.push_back(MulticastGroup::deriveMulticastGroupForAddressResolution(*ip)); std::sort(newGroups.begin(),newGroups.end()); - std::unique(newGroups.begin(),newGroups.end()); + newGroups.erase(std::unique(newGroups.begin(),newGroups.end()),newGroups.end()); for(std::vector<MulticastGroup>::iterator m(newGroups.begin());m!=newGroups.end();++m) { if (!std::binary_search(_multicastGroups.begin(),_multicastGroups.end(),*m)) |
