🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
2 messages
2 total messages Started by Gopal Malaviya Sun, 18 Oct 2026 20:07
Re: [RFC iproute2-next] ss: remove /proc fallback paths
#4657
Author: Gopal Malaviya
Date: Sun, 18 Oct 2026 20:07
73 lines
10930 bytes
On Tue, 1 Sep 2026 14:38 UTC, Stephen Hemminger wrote:
> This patch removes the old /proc/net fallback code in ss command.
> The sock_diag netlink interfaces were all in 3.10, over 13 years ago.
> No longer need to carry all the additional text parsing code.

I tested this on top of iproute2-next (204a7210). It builds with no new
warnings, testsuite/tests/ss/ssfilter.t passes, and on a WSL2 6.18
kernel the output of ss -tan, -uan, -xan, -s and -tanpie is identical
with and without the patch (ss -a -A netlink too, apart from the line
for ss's own netlink socket).

One concern: the diag interfaces are in the kernel, but each one is a
separate Kconfig option. INET_DIAG defaults to y, while UNIX_DIAG,
PACKET_DIAG, NETLINK_DIAG, INET_UDP_DIAG and INET_RAW_DIAG are all
"default n", and common configs leave some of them off:
x86_64_defconfig has "# CONFIG_INET_DIAG is not set", arm64 defconfig
sets none of the five, and Android's gki_defconfig enables only
INET_UDP_DIAG among them.

When the interface for a socket type is missing, ss currently falls
back to /proc/net/*. With this patch it prints only the header and
exits 0, so those sockets silently disappear. I reproduced this for
raw, unix and packet sockets (ss_before/ss_after are ss built
without/with this patch). Raw sockets, on a kernel without
INET_RAW_DIAG (the stock WSL2 kernel), with one ICMP and one ICMPv6 raw
socket open:

  # uname -r
  6.18.54.1-microsoft-standard-WSL2
  # zcat /proc/config.gz | grep INET_RAW_DIAG
  # CONFIG_INET_RAW_DIAG is not set
  # ss_before -wa
  State  Recv-Q Send-Q Local Address:Port      Peer Address:Port
  UNCONN 0      0            0.0.0.0:icmp           0.0.0.0:*
  UNCONN 0      0                  *:ipv6-icmp            *:*
  # ss_after -wa
  State Recv-Q Send-Q Local Address:Port Peer Address:Port
  # echo $?
  0

Unix and packet sockets, on a kernel where unix_diag and packet_diag
are modules that cannot be loaded (a WSL 6.6 kernel booted without its
modules), with one packet socket open:

  # zcat /proc/config.gz | grep -E 'CONFIG_(UNIX_DIAG|PACKET_DIAG)='
  CONFIG_PACKET_DIAG=m
  CONFIG_UNIX_DIAG=m
  # modprobe unix_diag
  modprobe: FATAL: Module unix_diag not found in directory /lib/modules/6.6.114.1-microsoft-standard-WSL2-destroy+
  # tail -n +2 /proc/net/unix | wc -l
  171
  # ss_before -xa | tail -n +2 | wc -l
  171
  # ss_after -xa | tail -n +2 | wc -l
  0
  # ss_before -0a
  Netid State  Recv-Q Send-Q Local Address:Port Peer Address:Port
  p_raw UNCONN 896    0                  *:*                *
  # ss_after -0a
  Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port

Distribution kernels such as Ubuntu's 6.8.0-147-generic and Arch's
linux package build all of them as modules, so they are not affected.
I did not boot an x86_64_defconfig kernel; I would expect ss -t to
show nothing there for the same reason, since INET_DIAG is off.

I may be missing context on how much these configurations matter for
ss, so please take this only as a data point. If it is useful, I would
be glad to help test any further changes in this area.

Thanks,
Gopal Malaviya
Re: [RFC iproute2-next] ss: remove /proc fallback paths
#5053
Author: Stephen Hemminger
Date: Mon, 19 Oct 2026 16:48
35 lines
12354 bytes
On Sun, 18 Oct 2026 20:07:12 +0000
Gopal Malaviya <gopalmalaviya53@gmail.com> wrote:

> On Tue, 1 Sep 2026 14:38 UTC, Stephen Hemminger wrote:
> > This patch removes the old /proc/net fallback code in ss command.
> > The sock_diag netlink interfaces were all in 3.10, over 13 years ago.
> > No longer need to carry all the additional text parsing code.  
> 
> I tested this on top of iproute2-next (204a7210). It builds with no new
> warnings, testsuite/tests/ss/ssfilter.t passes, and on a WSL2 6.18
> kernel the output of ss -tan, -uan, -xan, -s and -tanpie is identical
> with and without the patch (ss -a -A netlink too, apart from the line
> for ss's own netlink socket).
> 
> One concern: the diag interfaces are in the kernel, but each one is a
> separate Kconfig option. INET_DIAG defaults to y, while UNIX_DIAG,
> PACKET_DIAG, NETLINK_DIAG, INET_UDP_DIAG and INET_RAW_DIAG are all
> "default n", and common configs leave some of them off:
> x86_64_defconfig has "# CONFIG_INET_DIAG is not set", arm64 defconfig
> sets none of the five, and Android's gki_defconfig enables only
> INET_UDP_DIAG among them.
> 
> When the interface for a socket type is missing, ss currently falls
> back to /proc/net/*. With this patch it prints only the header and
> exits 0, so those sockets silently disappear. I reproduced this for
> raw, unix and packet sockets (ss_before/ss_after are ss built
> without/with this patch). Raw sockets, on a kernel without
> INET_RAW_DIAG (the stock WSL2 kernel), with one ICMP and one ICMPv6 raw
> socket open:


I am ok with forcing use of inet_diag for this.
If users turn it off, like Android, they are in embedded envrionments
where ss doesn't make lot of sense.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads