On Sat, Jul 18, 2020 at 05:37:40PM +0100, Jason McIntyre wrote:
> On Sat, Jul 18, 2020 at 03:17:05PM +0000, marfabastewart wrote:
> > I apologize!!! I have my mail client set to use plaintext
> > so I didn't think tabs woud be a problem. I'm
> > re-posting with just spaces.
> > 
> > Synopsis:    netstat address family and interface, well-known protocols
> > Category:    user
> > Environment:
> >     System      : OpenBSD 6.7
> >     Details     : OpenBSD 6.7-current (GENERIC.MP) #351: Wed Jul 15 
> > 16:57:00 MDT 2020
> >              
> > [email protected]:/usr/src/sys/arch/amd64/compile/GENERIC.MP
> > 
> >     Architecture: OpenBSD.amd64
> >     Machine     : amd64
> > Description:
> >     netstat doesn't limit output to address family when used with -I, and 
> > protocol list problem
> > How-To-Repeat:
> >     netstat -f inet -s -I lo0
> >     or
> >     netstat -s -f inet -I lo0
> >     netstat -f inet -I lo0
> > 
> >     Any interface can be used instead of lo0.
> >     Netstat shows ipv6 information also although man netstat says
> >         If the -f address_family option (with the -s option) is present,
> >             show per-interface statistics on the given interface for the
> >             specified address_family.
> > 
> >     (It does, but doesn't limit output to the specified address_family.)
> > 
> >     netstat -p only works for the protocols hard-coded in the protox struct 
> > in
> >     /usr/src/usr.bin/netstat/main.c
> > 
> > Fix:
> >     I'm not too well-versed in C (as perhaps my questions make clear)
> >     but happy to try to offer patches if someone would suggest
> >     the general direction of changes to make (and if the whole problem is 
> > not EBKAC).
> > 
> >     I note that netstat -f inet works but adding the -I doesn't seem to 
> > work.
> >     Is it because if iflag is set, we call intpr:
> >         if (iflag) {
> >             intpr(interval, repeatcount);
> >             exit(0);
> >         }
> >     in lines 295-296 in /usr/src/usr.bin/netstat/main.c?
> > 
> >     For the protocol problem, I see the call to getprotoent but
> >     no call to getprotobyname in the name2protox function in
> >     /usr/src/usr.b/in/netstat/main.c
> > 
> > 
> 
> hi.
> 
> at the very least, there is a doc bug here. before the last change to
> netstat.1, we showed -I and -f being compatible, in SYNOPSIS. in the
> most recent change to netstat.1, i removed that after some help from
> guenther in trying to track down what actually works. the -f text in the
> description of -I remained.
> 
> i will try to work out whether it's a doc fix or a code fix (i.e. bug
> those who know).
> 
> jmc

so, philip guenther did all the hard work: it seems the text additions
were made 21 years ago with ip6 support, but the code was never added.
so the current SYNOPSIS was (and still is) correct: -f is not used with
-I. the text in -I describing -f was wrong, and i've just removed it.

thanks for your mail,
jmc

Reply via email to