summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-12-30 23:38:11 -0800
committerJosh Blum <josh@joshknows.com>2011-12-30 23:38:11 -0800
commitcd34627d31b2c593151c0c8caeae20d6ec7a5121 (patch)
treea544148c1b62b7c3fa0ac85c70dd0efdbb106f2b
parentd74f81a7e9456f1cd821e44c70d7ca476969738e (diff)
downloaduhd-cd34627d31b2c593151c0c8caeae20d6ec7a5121.tar.gz
uhd-cd34627d31b2c593151c0c8caeae20d6ec7a5121.tar.bz2
uhd-cd34627d31b2c593151c0c8caeae20d6ec7a5121.zip
uhd: squashed changes to if_addrs
-rw-r--r--host/lib/transport/if_addrs.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/host/lib/transport/if_addrs.cpp b/host/lib/transport/if_addrs.cpp
index 83a1ee56f..2ad0c8c53 100644
--- a/host/lib/transport/if_addrs.cpp
+++ b/host/lib/transport/if_addrs.cpp
@@ -48,6 +48,17 @@ std::vector<uhd::transport::if_addrs_t> uhd::transport::get_if_addrs(void){
if_addr.inet = sockaddr_to_ip_addr(iter->ifa_addr).to_string();
if_addr.mask = sockaddr_to_ip_addr(iter->ifa_netmask).to_string();
if_addr.bcast = sockaddr_to_ip_addr(iter->ifa_broadaddr).to_string();
+
+ //correct the bcast address when its same as the gateway
+ if (if_addr.inet == if_addr.bcast or sockaddr_to_ip_addr(iter->ifa_broadaddr) == boost::asio::ip::address_v4(0)){
+ //manually calculate broadcast address
+ //https://svn.boost.org/trac/boost/ticket/5198
+ const boost::uint32_t addr = sockaddr_to_ip_addr(iter->ifa_addr).to_ulong();
+ const boost::uint32_t mask = sockaddr_to_ip_addr(iter->ifa_netmask).to_ulong();
+ const boost::uint32_t bcast = (addr & mask) | ~mask;
+ if_addr.bcast = boost::asio::ip::address_v4(bcast).to_string();
+ }
+
if_addrs.push_back(if_addr);
}
freeifaddrs(ifap);