解析数字ifconfig标志 [英] Parse numeric ifconfig flags
问题描述
ifconfig命令输出其标记.虽然可以找到参考
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>
数值"1100843
"映射到标志"UP,BROADCAST,RUNNING,MULTICAST,ROUTER,IPv4
".
The numeric value "1100843
" maps to the flags "UP,BROADCAST,RUNNING,MULTICAST,ROUTER,IPv4
".
我在某个地方没有找到一个引用,该引用描述了如何从编码的"flags=NNNNNNNN
"值中屏蔽每个标志(UP,BROADCAST,
等)?
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.
推荐答案
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.
这篇关于解析数字ifconfig标志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!