解析数字 ifconfig 标志
ifconfig 命令输出其 flags 文本和数字格式。虽然我可以找到参考
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
在上面的输出中,请注意以下内容:
flags=1100843<UP,BROADCAST,RUNNING,MULTICAST,ROUTER,IPv4>
数值“1100843
”映射到标志“UP,BROADCAST,RUNNING,MULTICAST,ROUTER,IPv4
”。
是否有一个我根本没有看到的参考描述了如何从编码的“flags=NNNNNNNN
”中屏蔽每个标志(UP、BROADCAST 等)价值?
编辑:澄清我对屏蔽哪个标志感兴趣。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
标志值在头文件中定义
/usr/include/net/if.h
(在 Solaris 上)。显示的值是为该接口设置的标志的按位或。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.