mirror of
https://github.com/saymrwulf/uhd.git
synced 2026-05-16 21:10:10 +00:00
uhd: network device discovery -> calc bcast addr under certain conditions
This commit is contained in:
parent
1a6f08b039
commit
cdf8de0ca3
1 changed files with 6 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue