diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2015-05-17 18:31:41 -0700 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2015-05-17 18:31:41 -0700 |
commit | 0e87002d785efbaaa6c1e33f8b8b951375ac4a23 (patch) | |
tree | 8405974fb72227c30106043647fe1017b967eaf3 /osdep | |
parent | ddaf3ef347e2b53d16b6408e48bf60a55a7c2d5d (diff) | |
download | infinitytier-0e87002d785efbaaa6c1e33f8b8b951375ac4a23.tar.gz infinitytier-0e87002d785efbaaa6c1e33f8b8b951375ac4a23.zip |
BSDEthernetTap build fixes.
Diffstat (limited to 'osdep')
-rw-r--r-- | osdep/BSDEthernetTap.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/osdep/BSDEthernetTap.cpp b/osdep/BSDEthernetTap.cpp index 28c9c9cc..2a504a6f 100644 --- a/osdep/BSDEthernetTap.cpp +++ b/osdep/BSDEthernetTap.cpp @@ -230,7 +230,7 @@ static bool ___removeIp(const std::string &_dev,const InetAddress &ip) return false; // never reached, make compiler shut up about return value } -bool BSDEthernetTap::addIP(const InetAddress &ip) +bool BSDEthernetTap::addIp(const InetAddress &ip) { if (!ip) return false; @@ -259,8 +259,10 @@ bool BSDEthernetTap::addIP(const InetAddress &ip) return false; } -bool BSDEthernetTap::removeIP(const InetAddress &ip) +bool BSDEthernetTap::removeIp(const InetAddress &ip) { + if (!ip) + return false; std::vector<InetAddress> allIps(ips()); if (std::find(allIps.begin(),allIps.end(),ip) != allIps.end()) { if (___removeIp(_dev,ip)) @@ -269,11 +271,11 @@ bool BSDEthernetTap::removeIP(const InetAddress &ip) return false; } -std::set<InetAddress> BSDEthernetTap::ips() const +std::vector<InetAddress> BSDEthernetTap::ips() const { struct ifaddrs *ifa = (struct ifaddrs *)0; if (getifaddrs(&ifa)) - return std::set<InetAddress>(); + return std::vector<InetAddress>(); std::vector<InetAddress> r; @@ -454,7 +456,6 @@ void BSDEthernetTap::threadMain() to.setTo(getBuf,6); from.setTo(getBuf + 6,6); unsigned int etherType = ntohs(((const uint16_t *)getBuf)[6]); - data.copyFrom(getBuf + 14,(unsigned int)r - 14); // TODO: VLAN support _handler(_arg,_nwid,from,to,etherType,0,(const void *)(getBuf + 14),r - 14); } |