Works if IFF_LOOPBACK isn't available
FossilOrigin-Name: de3d44d63ed051a34a35b65c40f1b4ffee8f85f2876bd376a818d06666775f93
This commit is contained in:
parent
b668a8f4a9
commit
936eed4636
@ -33,9 +33,16 @@ char * sock_get_primary_if(int family)
|
|||||||
getifaddrs(&ifap);
|
getifaddrs(&ifap);
|
||||||
|
|
||||||
for (ifa = ifap; ifa != NULL; ifa = ifa->ifa_next) {
|
for (ifa = ifap; ifa != NULL; ifa = ifa->ifa_next) {
|
||||||
|
|
||||||
|
#ifdef IFF_LOOPBACK
|
||||||
if (ifa->ifa_flags & IFF_LOOPBACK){
|
if (ifa->ifa_flags & IFF_LOOPBACK){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if (strncmp(ifa->ifa_name,"lo",2)==0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
if (ifa->ifa_addr == NULL)
|
if (ifa->ifa_addr == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user