Hi,

Traditionally BSD netstat -A and fstat show protocol PCB pointers
for TCP and internet PCB pointers for the other protocols.

For netstat this got lost when it was converted to sysctl.  I would
like to restore the old output as it is useful that the numbers
from netstat and fstat match.

ok?

Index: usr.bin/netstat/inet.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/usr.bin/netstat/inet.c,v
retrieving revision 1.156
diff -u -p -r1.156 inet.c
--- usr.bin/netstat/inet.c      7 Mar 2017 23:35:06 -0000       1.156
+++ usr.bin/netstat/inet.c      3 May 2017 12:17:53 -0000
@@ -315,7 +315,8 @@ netdomainpr(struct kinfo_file *kf, int p
        }
 
        if (Aflag)
-               printf("%#*llx%s ", FAKE_PTR(kf->so_pcb));
+               printf("%#*llx%s ", FAKE_PTR(kf->so_protocol == IPPROTO_TCP ?
+                   kf->inp_ppcb : kf->so_pcb));
 
        printf("%-7.7s %6llu %6llu ",
            isip6 ? name6: name, kf->so_rcv_cc, kf->so_snd_cc);

Reply via email to