[Bug 297448] sockstat: IPv6 addresses are silently truncated in the default output

[email protected]
Newsgroups gmane.os.freebsd.bugs
Message-ID <[email protected]/bugzilla/>
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=297448

            Bug ID: 297448
           Summary: sockstat: IPv6 addresses are silently truncated in the
                    default output
           Product: Base System
           Version: 15.1-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Keywords: regression
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: [email protected]
          Reporter: [email protected]
             Flags: maintainer-feedback?

Hello,

In the default (non -w) output, sockstat(1) truncates the LOCAL ADDRESS and
FOREIGN ADDRESS columns at 21 characters. Any bracketed IPv6 address with a
port needs at least 25 characters, so essentially every IPv6 socket is
displayed with the closing bracket and the port number missing, with no
indication that anything was cut.

Steps to reproduce (nginx listening on IPv4 and IPv6 address /64):

# sockstat -46
USER COMMAND      PID FD PROTO LOCAL ADDRESS         FOREIGN ADDRESS
www  nginx      54918  7 tcp4  78.46.37.42:80        *:*
www  nginx      54918  8 tcp4  78.46.37.42:443       *:*
www  nginx      54918 12 tcp6  [2a01:4f8:110:314e::1 *:*
www  nginx      54918 13 tcp6  [2a01:4f8:110:314e::1 *:*

The two tcp6 rows are indistinguishable, unless I use -w option.

The Bug #254611 introduced the brackets [] on IPv6 address, but the columns
wasn't resized.

On FreeBSD 14 or before, the column was automatically resized depending on the
size of the address displayed. But with recente addition of -w option, it is
truncation on 21 chars. The regression came in with the automatic column sizing
work and the subsequent libxo in 2025, July.

So I ask the Src Team, if it can be fix from 21 to 27 chars, the minimum for a
simplified /64 IPv6 address with brackets in the format:

[ffff:ffff:fff:ffff::1]:nnnn

If you like the idea, I can provide the patch.

Thanks!
devnull

-- 
You are receiving this mail because:
You are the assignee for the bug.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.