aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-12-20 12:15:47 -0800
committerJosh Blum <josh@joshknows.com>2011-12-20 12:15:47 -0800
commitcdf8de0ca34d787ee9b3fed543f5e45bc2df00fa (patch)
treebe9f6919ac4809c611eab5bffc436deff10eec19 /host
parent1a6f08b0396f5985929a934921a33852203dbff4 (diff)
downloaduhd-cdf8de0ca34d787ee9b3fed543f5e45bc2df00fa.tar.gz
uhd-cdf8de0ca34d787ee9b3fed543f5e45bc2df00fa.tar.bz2
uhd-cdf8de0ca34d787ee9b3fed543f5e45bc2df00fa.zip
uhd: network device discovery -> calc bcast addr under certain conditions
Diffstat (limited to 'host')
-rw-r--r--host/lib/transport/if_addrs.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/host/lib/transport/if_addrs.cpp b/host/lib/transport/if_addrs.cpp
index 83a1ee56f..54bb2626e 100644
--- a/host/lib/transport/if_addrs.cpp
+++ b/host/lib/transport/if_addrs.cpp
@@ -48,6 +48,12 @@ 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)){
+ if_addr.bcast = boost::asio::ip::address_v4::broadcast(sockaddr_to_ip_addr(iter->ifa_addr), sockaddr_to_ip_addr(iter->ifa_netmask)).to_string();
+ }
+
if_addrs.push_back(if_addr);
}
freeifaddrs(ifap);