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





Reply via email to