Comment 9 for bug 335507

Revision history for this message
TJ (tj) wrote :

I want to test the flags being returned by the IOCTL call to the socket. I've written a minimal C program to do that. You can either compile the attached source or, if you'd prefer, I can provide a binary. Try it on all your network interfaces.

gcc -o socket-flags socket-flags.c

for dev in /sys/class/net/*; do ./socket-flags ${dev##*/}; done

eth0 SIOCGIFFLAGS 0x1043 ( IFF_UP (0x1) IFF_BROADCAST (0x2) IFF_RUNNING (0x40) IFF_MULTICAST (0x1000))
lo SIOCGIFFLAGS 0x49 ( IFF_UP (0x1) IFF_LOOPBACK (0x8) IFF_RUNNING (0x40))
pan0 SIOCGIFFLAGS 0x1002 ( IFF_BROADCAST (0x2) IFF_MULTICAST (0x1000))
tun0 SIOCGIFFLAGS 0x10d1 ( IFF_UP (0x1) IFF_POINTTOPOINT (0x10) IFF_RUNNING (0x40) IFF_NOARP (0x80) IFF_MULTICAST (0x1000))
wlan0 SIOCGIFFLAGS 0x1043 ( IFF_UP (0x1) IFF_BROADCAST (0x2) IFF_RUNNING (0x40) IFF_MULTICAST (0x1000))
wmaster0 SIOCGIFFLAGS 0x1043 ( IFF_UP (0x1) IFF_BROADCAST (0x2) IFF_RUNNING (0x40) IFF_MULTICAST (0x1000))

What we are looking for is the IFF_RUNNING flag defined in /usr/include/net/if.h:

    IFF_RUNNING = 0x40, /* Resources allocated. */