diff --git a/src/capwap/sock_get_primary_if.c b/src/capwap/sock_get_primary_if.c index d1a7229c..375e06f9 100644 --- a/src/capwap/sock_get_primary_if.c +++ b/src/capwap/sock_get_primary_if.c @@ -37,6 +37,9 @@ char * sock_get_primary_if(int family) continue; } + if (ifa->ifa_addr == NULL) + continue; + if (ifa->ifa_addr->sa_family != family) continue; diff --git a/src/capwap/sock_getifaddr.c b/src/capwap/sock_getifaddr.c index 07919cca..5942dbe9 100644 --- a/src/capwap/sock_getifaddr.c +++ b/src/capwap/sock_getifaddr.c @@ -37,6 +37,9 @@ int sock_getifaddr(const char * ifname,int family, int type,struct sockaddr * sa if (strcmp(ifname,ifa->ifa_name)) continue; + if (ifa->ifa_addr == NULL) + continue; + if (ifa->ifa_addr->sa_family != family) continue;