Changeset 4326


Ignore:
Timestamp:
Jan 22, 2013 3:39:34 AM (7 years ago)
Author:
ming
Message:

Fixed #1613: Use appropriate request for ioctl() function to access the interface flags

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/src/pj/ip_helper_generic.c

    r3553 r4326  
    178178    for (i=0; i<count; ++i) { 
    179179        struct ifreq *itf = &ifr[i]; 
     180        struct ifreq iff; 
    180181        struct sockaddr *ad = &itf->ifr_addr; 
    181182         
     
    189190        } 
    190191 
    191         if ((itf->ifr_flags & IFF_UP)==0) { 
     192        if ((rc=ioctl(sock, SIOCGIFFLAGS, &iff)) != 0) { 
     193            TRACE_((THIS_FILE, "  ioctl(SIOCGIFFLAGS) failed: %s", 
     194                    get_os_errmsg())); 
     195            continue;   /* Failed to get flags, continue */ 
     196        } 
     197 
     198        if ((iff.ifr_flags & IFF_UP)==0) { 
    192199            TRACE_((THIS_FILE, "  interface is down")); 
    193200            continue; /* Skip when interface is down */ 
     
    195202 
    196203#if PJ_IP_HELPER_IGNORE_LOOPBACK_IF 
    197         if (itf->ifr_flags & IFF_LOOPBACK) { 
     204        if (iff.ifr_flags & IFF_LOOPBACK) { 
    198205            TRACE_((THIS_FILE, "  loopback interface")); 
    199206            continue; /* Skip loopback interface */ 
Note: See TracChangeset for help on using the changeset viewer.