aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-12-22 14:10:48 -0800
committerJosh Blum <josh@joshknows.com>2011-12-22 14:10:48 -0800
commit3082aaafa2e86ae4e06348345d0556c2d9cb0889 (patch)
tree5aff2cd6bc4ff31ad35b928521e035f9eb2bd0ac
parent9f0a1e3148251c820a73c8a33da92e54aaffee6d (diff)
downloaduhd-3082aaafa2e86ae4e06348345d0556c2d9cb0889.tar.gz
uhd-3082aaafa2e86ae4e06348345d0556c2d9cb0889.tar.bz2
uhd-3082aaafa2e86ae4e06348345d0556c2d9cb0889.zip
uhd: manually calculate bcast addr, boost version buggy
-rw-r--r--host/lib/transport/if_addrs.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/host/lib/transport/if_addrs.cpp b/host/lib/transport/if_addrs.cpp
index 54bb2626e..2ad0c8c53 100644
--- a/host/lib/transport/if_addrs.cpp
+++ b/host/lib/transport/if_addrs.cpp
@@ -51,7 +51,12 @@ std::vector<uhd::transport::if_addrs_t> uhd::transport::get_if_addrs(void){
//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();
+ //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);