mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-24 09:12:28 +02:00
Poco::Net::NetworkInterface::list does not list inactive interfaces even when explicitly being asked for it #2044
This commit is contained in:
@@ -875,33 +875,40 @@ NetworkInterface::List NetworkInterface::list(bool ipOnly, bool upOnly)
|
||||
|
||||
typedef NetworkInterface::AddressList List;
|
||||
const List& ipList = it->second.addressList();
|
||||
List::const_iterator ipIt = ipList.begin();
|
||||
List::const_iterator ipEnd = ipList.end();
|
||||
for (; ipIt != ipEnd; ++ipIt)
|
||||
if (ipList.size() > 0)
|
||||
{
|
||||
IPAddress addr = ipIt->get<NetworkInterface::IP_ADDRESS>();
|
||||
IPAddress mask = ipIt->get<NetworkInterface::SUBNET_MASK>();
|
||||
NetworkInterface ni;
|
||||
if (mask.isWildcard())
|
||||
List::const_iterator ipIt = ipList.begin();
|
||||
List::const_iterator ipEnd = ipList.end();
|
||||
for(; ipIt != ipEnd; ++ipIt)
|
||||
{
|
||||
ni = NetworkInterface(name, displayName, adapterName, addr, index, &mac);
|
||||
}
|
||||
else
|
||||
{
|
||||
IPAddress broadcast = ipIt->get<NetworkInterface::BROADCAST_ADDRESS>();
|
||||
ni = NetworkInterface(name, displayName, adapterName, addr, mask, broadcast, index, &mac);
|
||||
}
|
||||
IPAddress addr = ipIt->get<NetworkInterface::IP_ADDRESS>();
|
||||
IPAddress mask = ipIt->get<NetworkInterface::SUBNET_MASK>();
|
||||
NetworkInterface ni;
|
||||
if(mask.isWildcard())
|
||||
{
|
||||
ni = NetworkInterface(name, displayName, adapterName, addr, index, &mac);
|
||||
}
|
||||
else
|
||||
{
|
||||
IPAddress broadcast = ipIt->get<NetworkInterface::BROADCAST_ADDRESS>();
|
||||
ni = NetworkInterface(name, displayName, adapterName, addr, mask, broadcast, index, &mac);
|
||||
}
|
||||
|
||||
ni._pImpl->_broadcast = it->second._pImpl->_broadcast;
|
||||
ni._pImpl->_loopback = it->second._pImpl->_loopback;
|
||||
ni._pImpl->_multicast = it->second._pImpl->_multicast;
|
||||
ni._pImpl->_pointToPoint = it->second._pImpl->_pointToPoint;
|
||||
ni._pImpl->_up = it->second._pImpl->_up;
|
||||
ni._pImpl->_running = it->second._pImpl->_running;
|
||||
ni._pImpl->_mtu = it->second._pImpl->_mtu;
|
||||
ni._pImpl->_type = it->second._pImpl->_type;
|
||||
ni._pImpl->_broadcast = it->second._pImpl->_broadcast;
|
||||
ni._pImpl->_loopback = it->second._pImpl->_loopback;
|
||||
ni._pImpl->_multicast = it->second._pImpl->_multicast;
|
||||
ni._pImpl->_pointToPoint = it->second._pImpl->_pointToPoint;
|
||||
ni._pImpl->_up = it->second._pImpl->_up;
|
||||
ni._pImpl->_running = it->second._pImpl->_running;
|
||||
ni._pImpl->_mtu = it->second._pImpl->_mtu;
|
||||
ni._pImpl->_type = it->second._pImpl->_type;
|
||||
|
||||
list.push_back(ni);
|
||||
list.push_back(ni);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
list.push_back(NetworkInterface(name, displayName, adapterName, index, &mac));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user