bin/145194: Changed output of sockstat for AF_INET6

Fedor Dikarev fe at
Tue Mar 30 08:50:04 UTC 2010

>Number:         145194
>Category:       bin
>Synopsis:       Changed output of sockstat for AF_INET6
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Mar 30 08:50:03 UTC 2010
>Originator:     Fedor Dikarev
>Release:        6.x, 7.x and 8.x
FreeBSD 7.2-STABLE FreeBSD 7.2-STABLE #1: Tue Jun  2 10:49:29 MSD 2009     root at  amd64

It's very hard to distinguish where local address and port ends and foreign address and port starts from sockstat output when using IPv6 addressess.
One space between is enough as I think.

root:net{R}[125] sockstat$ sockstat -6
www      nginx      58211 9  tcp6   2a02:6b0:1:0:21a:92ff:fe80:f032:802a02:6b0:16:0:10cb:d0b0:7274:4cde:1145
.. and more such lines
Just add one space after local address and port. And get output like this:

root:net{R}[135] sockstat$ sockstat -6
www      nginx      58211 12 tcp6   2a02:6b0:1:0:21a:92ff:fe80:f032:80 2a02:6b0:16:0:10cb:d0b0:7274:4cde:1170

Patch attached with submission follows:

--- sockstat.c  2010-03-30 12:37:25.000000000 +0400
+++ sockstat.c.orig     2010-03-30 12:22:06.000000000 +0400
@@ -609,7 +609,6 @@
                case AF_INET:
                case AF_INET6:
                        pos += printaddr(s->family, &s->laddr);
-                       if((AF_INET6 == s->family) && (pos>=58)) { xprintf(" "); }
                        while (pos < 58)
                                pos += xprintf(" ");
                        pos += printaddr(s->family, &s->faddr);


More information about the freebsd-bugs mailing list