tech-net archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
ifconfig v2
I was just reminded what improvements can be made to ifconfig output
when I read this ifconfig output that appeared on current-users today:
wm0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
capabilities=7ff80<TSO4,IP4CSUM_Rx,IP4CSUM_Tx,TCP4CSUM_Rx>
capabilities=7ff80<TCP4CSUM_Tx,UDP4CSUM_Rx,UDP4CSUM_Tx,TCP6CSUM_Rx>
capabilities=7ff80<TCP6CSUM_Tx,UDP6CSUM_Rx,UDP6CSUM_Tx,TSO6>
enabled=0
ec_capabilities=7<VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU>
ec_enabled=0
address: 00:26:2d:f3:c8:c7
media: Ethernet none (none)
inet 169.254.162.222 netmask 0xffff0000 broadcast 169.254.255.255
inet6 fe80::226:2dff:fef3:c8c7%wm0 prefixlen 64 scopeid 0x1
The ALL-CAPITALS text is really hard to read. Let's change that to
lower:
wm0: flags=8843<up,broadcast,running,simplex,multicast> mtu 1500
capabilities=7ff80<tso4,ip4csum_rx,ip4csum_tx,tcp4csum_rx>
capabilities=7ff80<tcp4csum_tx,udp4csum_rx,udp4csum_tx,tcp6csum_rx>
capabilities=7ff80<tcp6csum_tx,udp6csum_rx,udp6csum_tx,tso6>
enabled=0
ec_capabilities=7<vlan_mtu,vlan_hwtagging,jumbo_mtu>
ec_enabled=0
address: 00:26:2d:f3:c8:c7
media: Ethernet none (none)
inet 169.254.162.222 netmask 0xffff0000 broadcast 169.254.255.255
inet6 fe80::226:2dff:fef3:c8c7%wm0 prefixlen 64 scopeid 0x1
Hmm. Better, but not by much.
The capability keywords really should be printed in the same form as the
input is typed---i.e., with dashes instead of underscores---and dashes
are easier to type, besides. So I change the underscores to dashes. (A
nice property of ifconfig that I miss in other command-line environments
is that a lot of its output is directly reusable in ifconfig command
sentences.) The hex isn't of much use, so I omit it. I alphabetize the
capabilities so that if I know which capability I'm looking for, I can
find it without an exhaustive search. We can afford to use some more
whitespace, and it provides some texture that helps to find and identify
the keywords, so I add some:
wm0: flags < up, broadcast, running, simplex, multicast > mtu 1500
capabilities: ip4csum-rx, ip4csum-tx, tcp4csum-rx, tcp4csum-tx,
tcp6csum-rx tcp6csum-tx, tso4, tso6,
udp4csum-rx, udp4csum-tx, udp6csum-rx, udp6csum-tx
enabled: <none>
ether capabilities: vlan-mtu, vlan-hwtagging, jumbo-mtu
ether enabled: <none>
address: 00:26:2d:f3:c8:c7
media: Ethernet none (none)
inet 169.254.162.222 netmask 0xffff0000 broadcast 169.254.255.255
inet6 fe80::226:2dff:fef3:c8c7%wm0 prefixlen 64 scopeid 0x1
Most of the time, that is much more information than I need, so I'm
going to delete the capabilities and many of the flags from the default
display. I also delete the mtu, which isn't important to me unless it's
different from the default:
wm0: flags < up, running >
address: 00:26:2d:f3:c8:c7
media: Ethernet none (none)
inet 169.254.162.222 netmask 0xffff0000 broadcast 169.254.255.255
inet6 fe80::226:2dff:fef3:c8c7%wm0 prefixlen 64 scopeid 0x1
Finally, I get more use out of mask lengths than netmasks, and rarely is
the broadcast address useful to me:
wm0: flags < up, running >
address: 00:26:2d:f3:c8:c7
media: Ethernet none (none)
inet 169.254.162.222 prefixlen 16
inet6 fe80::226:2dff:fef3:c8c7%wm0 prefixlen 64 scopeid 0x1
Finally, for the sake of consistency, let's put all of the addresses,
even the link-layer address, into <family> <address> form:
wm0: flags < up, running >
media: Ethernet none (none)
link 00:26:2d:f3:c8:c7
inet 169.254.162.222 prefixlen 16
inet6 fe80::226:2dff:fef3:c8c7%wm0 prefixlen 64 scopeid 0x1
That is an efficient and consistent display. I estimate that it will
meet my information needs more than 95% of the time when I run 'ifconfig
wm0', and it will meet my needs more quickly than the status quo because
it is less cluttered and more compact.
If I need more information, I will ask for it with ifconfig -v wm0:
wm0: flags < up, broadcast, running, simplex, multicast > mtu 1500
capabilities: ip4csum-rx, ip4csum-tx, tcp4csum-rx, tcp4csum-tx,
tcp6csum-rx tcp6csum-tx, tso4, tso6,
udp4csum-rx, udp4csum-tx, udp6csum-rx, udp6csum-tx
enabled: <none>
ether capabilities: vlan-mtu, vlan-hwtagging, jumbo-mtu
ether enabled: <none>
media: Ethernet none (none)
link 00:26:2d:f3:c8:c7
inet 169.254.162.222 prefixlen 16 broadcast 169.254.255.255
inet6 fe80::226:2dff:fef3:c8c7%wm0 prefixlen 64 scopeid 0x1
Dave
--
David Young
dyoung%pobox.com@localhost Urbana, IL (217) 721-9981
Home |
Main Index |
Thread Index |
Old Index