summaryrefslogtreecommitdiff
path: root/pjlib
diff options
context:
space:
mode:
Diffstat (limited to 'pjlib')
-rw-r--r--pjlib/src/pj/ip_helper_generic.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/pjlib/src/pj/ip_helper_generic.c b/pjlib/src/pj/ip_helper_generic.c
index 26ef0e7e..bd92192d 100644
--- a/pjlib/src/pj/ip_helper_generic.c
+++ b/pjlib/src/pj/ip_helper_generic.c
@@ -177,6 +177,7 @@ static pj_status_t if_enum_by_af(int af,
*p_cnt = 0;
for (i=0; i<count; ++i) {
struct ifreq *itf = &ifr[i];
+ struct ifreq iff;
struct sockaddr *ad = &itf->ifr_addr;
TRACE_((THIS_FILE, " checking interface %s", itf->ifr_name));
@@ -188,13 +189,19 @@ static pj_status_t if_enum_by_af(int af,
continue;
}
- if ((itf->ifr_flags & IFF_UP)==0) {
+ if ((rc=ioctl(sock, SIOCGIFFLAGS, &iff)) != 0) {
+ TRACE_((THIS_FILE, " ioctl(SIOCGIFFLAGS) failed: %s",
+ get_os_errmsg()));
+ continue; /* Failed to get flags, continue */
+ }
+
+ if ((iff.ifr_flags & IFF_UP)==0) {
TRACE_((THIS_FILE, " interface is down"));
continue; /* Skip when interface is down */
}
#if PJ_IP_HELPER_IGNORE_LOOPBACK_IF
- if (itf->ifr_flags & IFF_LOOPBACK) {
+ if (iff.ifr_flags & IFF_LOOPBACK) {
TRACE_((THIS_FILE, " loopback interface"));
continue; /* Skip loopback interface */
}