Subject: Re: netstat -i in /etc/daily
To: None <tech-userlevel@netbsd.org, tech-net@netbsd.org, itojun@iijlab.net>
From: None <alexis@panix.com>
List: tech-userlevel
Date: 01/23/2000 23:16:10
Here's an example from earlier in this thread:
>smaug% cat x | awk '{ if ( $4 !~ /:/ || $3 ~ /Link/ ) print ; }'
>Name  Mtu   Network       Address              Ipkts Ierrs    Opkts Oerrs Colls
>sm1   1500  <Link>        00:00:86:05:80:fa     2358     0     2581     0 38
>sm1   1500  202.232.15.96 202.232.15.108        2358     0     2581     0 38
>lo0   32976 <Link>                                96     0       96     0 0
>lo0   32976 127           127.0.0.1               96     0       96     0 0
>lo1*  32976 <Link>                                 0     0        0     0 0

Itojun wrote:
> 	the above example assumes that we have "-in" in command line,
> 	and is not true at this moment ("-i").  is it okay if I add "-n"?
> 	I believe "-n" is better for diagnosis, and for no reverse query delays.

First of all, by all means, add "-n"...

But, while we're at it, let me offer a slightly different example, which
illustrates some severe brokenness in the current netstat, and shows why I
think my proposal (combine network & address using /bits notation) is superior:

> Name  Mtu   Network       Address              Ipkts Ierrs  Opkts Oerrs  Coll
> de0   1500  <Link>        00:c0:f0:1f:23:77 1326852479   0 1490221988   4   0
> de0   1500  166.84.0.128/ 166.84.0.135      1326852479   0 1490221988   4   0
> lo0   32976 <Link>                          1029052137   0 1029052137   0   0
> lo0   32976 127           127.0.0.1         1029052137   0 1029052137   0   0

(Note that I've removed some spaces to prevent it from running off the edge of
the screen- only mentioned because that's part of what drove this discussion.)

So... What's my netmask? Worse, if this happens with an alias (so you can't
look at it with ifconfig), I'm not sure there's *any* way to find out without
writing code. (Well, any reasonable way, anyway.)

So here's what I suggest:
1) By default, combine network and address. This provides the most useful
info, as well as shortening the average line length.
2) For those who are concerned about the binary-impaired being able to
figure out their network/broadcast address, add another flag (-v?) which
adds a "Network Base" and "Broadcast Address" field, and gives up any pretense
of trying to fit everything on one line.

BTW, this just points out that netstat -i has been twisted a bit from its
original intended purpose. Obviously, we don't really need to see all the
packet-counting data for every alias on an interface. For the sake of users
of other Unixes, I don't think we should change this, but perhaps we need
a new command, just for listing all of a machines interfaces and the
adresses/masks they have. This might even be better done in ifconfig than
in netstat.

/a

---
Alexis Rosen
PANIX Public Access Unix & Internet, NYC.
alexis@panix.com