wiki:Linux/Utils/ReadNetworkInterfaceFlags

Read Network Interface Flags

This is a small utility that reads and reports the flags of a given network interface.

Examples

./socket-flags eth0
eth0 SIOCGIFFLAGS 0x1043 ( IFF_UP (0x1) IFF_BROADCAST (0x2) IFF_RUNNING (0x40) IFF_MULTICAST (0x1000))

Or for all interfaces:

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))

Build

Download the attached source-code and build it using:

gcc -o socket-flags socket-flags.c

Attachments