views:

227

answers:

1

The ifconfig command outputs its flags in both textual and numeric format. While I can find a reference here or there to the numeric flags, I cannot find any indication on how to interpret (mask) the number.

qfe2: flags=1100843<UP,BROADCAST,RUNNING,MULTICAST,ROUTER,IPv4> mtu
  1500 index 4
  usesrc vni0
  inet 1.2.3.4 netmask ffffff00 broadcast 1.2.3.255
  ether 0:3:ba:17:4b:e1
vni0: flags=20011100c1<UP,RUNNING,NOARP,NOXMIT,ROUTER,IPv4,VIRTUAL>
  mtu 0 index 5
  srcof qfe2
  inet 3.4.5.6 netmask ffffffff

In the above output, note the following:

flags=1100843<UP,BROADCAST,RUNNING,MULTICAST,ROUTER,IPv4>

The numeric value "1100843" maps to the flags "UP,BROADCAST,RUNNING,MULTICAST,ROUTER,IPv4".

Is there a reference somewhere that I'm simply not seeing that describes how to mask each flag (UP,BROADCAST,etc.) out of the encoded "flags=NNNNNNNN" value?

EDIT: Clarification of exactly which flag I'm interested in masking.

+1  A: 

The flag values are defined in the header file /usr/include/net/if.h (on Solaris). The value shown is the bitwise-OR of the flags that are set for that interface.

mark4o
Good find! And I happen to be on Solaris, so hopefully those values are trustworthy.
David Citron