ifconfig -h patch
Rui Paulo <rpaulo <at> NetBSD.org>
2005-08-06 18:31:08 GMT
Hi,
The following small patch adds the '-h' option to ifconfig(8). As you may
have already gussed, it prints the byte statistics of a given interface
in human-readable format. This is something that I miss often, but
I don't know how many people would want this. Note that I'm not breaking
anything (I guess): it's a new flag and scripts that already depend on
the old -v format will work.
An example output (addresses removed):
> ifconfig -v ex0
ex0: flags=8863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST> mtu 1500
capabilities=3f00<IP4CSUM_Rx,IP4CSUM_Tx,TCP4CSUM_Rx,TCP4CSUM_Tx,UDP4CSUM_Rx,UDP4CSUM_Tx>
enabled=3f00<IP4CSUM_Rx,IP4CSUM_Tx,TCP4CSUM_Rx,TCP4CSUM_Tx,UDP4CSUM_Rx,UDP4CSUM_Tx>
address: 00:00:00:00:00:00
media: Ethernet autoselect (100baseTX full-duplex)
status: active
input: 4701561 packets, 6885740641 bytes, 11206 multicasts
output: 6499381 packets, 1615921802 bytes, 473 multicasts
inet 0.0.0.0 netmask 0xffffffff broadcast 255.255.255.255
> ifconfig -hv ex0
ex0: flags=8863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST> mtu 1500
capabilities=3f00<IP4CSUM_Rx,IP4CSUM_Tx,TCP4CSUM_Rx,TCP4CSUM_Tx,UDP4CSUM_Rx,UDP4CSUM_Tx>
enabled=3f00<IP4CSUM_Rx,IP4CSUM_Tx,TCP4CSUM_Rx,TCP4CSUM_Tx,UDP4CSUM_Rx,UDP4CSUM_Tx>
address: 00:00:00:00:00:00
media: Ethernet autoselect (100baseTX full-duplex)
status: active
input: 4701585 packets, 6.4G bytes, 11208 multicasts
output: 6499405 packets, 1.5G bytes, 473 multicasts
inet 0.0.0.0 netmask 0xffffffff broadcast 255.255.255.255
(Continue reading)