mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
getLocalAddresses collects loopback address too
This commit is contained in:
parent
9d78bba3b8
commit
436f619fcb
@ -1021,7 +1021,7 @@ bool p3NetMgrIMPL::checkNetAddress()
|
||||
std::list<sockaddr_storage>::iterator it;
|
||||
if (getLocalAddresses(addrs))
|
||||
for(it = addrs.begin(); (it != addrs.end() && !validAddr); ++it)
|
||||
if(sockaddr_storage_isValidNet(*it))
|
||||
if(sockaddr_storage_isValidNet(*it) && !sockaddr_storage_isLoopbackNet(*it))
|
||||
{
|
||||
prefAddr = *it;
|
||||
validAddr = true;
|
||||
|
@ -303,8 +303,6 @@ bool getLocalAddresses(std::list<sockaddr_storage> & addrs)
|
||||
IP_ADAPTER_ADDRESSES* adapter(NULL);
|
||||
for(adapter = adapter_addresses; NULL != adapter; adapter = adapter->Next)
|
||||
{
|
||||
if (adapter->IfType == IF_TYPE_SOFTWARE_LOOPBACK) continue;
|
||||
|
||||
IP_ADAPTER_UNICAST_ADDRESS* address;
|
||||
for ( address = adapter->FirstUnicastAddress; address; address = address->Next)
|
||||
{
|
||||
@ -320,7 +318,7 @@ bool getLocalAddresses(std::list<sockaddr_storage> & addrs)
|
||||
struct ifaddrs *ifsaddrs, *ifa;
|
||||
if(getifaddrs(&ifsaddrs) != 0) getLocalAddressesFailed();
|
||||
for ( ifa = ifsaddrs; ifa; ifa = ifa->ifa_next )
|
||||
if ( (ifa->ifa_flags & IFF_UP) && !(ifa->ifa_flags & IFF_LOOPBACK) )
|
||||
if ( ifa->ifa_addr && (ifa->ifa_flags & IFF_UP) )
|
||||
{
|
||||
sockaddr_storage * tmp = new sockaddr_storage;
|
||||
sockaddr_storage_clear(*tmp);
|
||||
|
Loading…
Reference in New Issue
Block a user