diff options
author | Liong Sauw Ming <ming@teluu.com> | 2013-01-22 03:39:34 +0000 |
---|---|---|
committer | Liong Sauw Ming <ming@teluu.com> | 2013-01-22 03:39:34 +0000 |
commit | 8f2cc7451b4684cfcb04dd2ccdc5934c7eb7de19 (patch) | |
tree | 03f68ad9f584fdcccc7e6796f52230b84bf63b49 /pjlib/src/pj | |
parent | 0f0b0a1493ad245b6a6e985f0ad1ca65081bf3fe (diff) |
Fixed #1613: Use appropriate request for ioctl() function to access the interface flags
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4326 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib/src/pj')
-rw-r--r-- | pjlib/src/pj/ip_helper_generic.c | 11 |
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 */ } |