Page MenuHomeFreeBSD

Extend netstat to display TCP stack and detailed congestion state
ClosedPublic

Authored by rscheff on Sep 21 2020, 9:03 PM.

Details

Summary

Upstreaming the "-c" option used to show detailed per-connection
congestion control state for TCP sessions.

This is one summary patch, which adds the relevant variables into
xtcpcb. As previous "spare" space is used, these changes are ABI
compatible (an older version of netstat will simply not show
the newly available data from newer kernels, and a newer version
of netstat will only show zeroed data querying older kernels.

Test Plan

Verify that "netstat -c" shows cwnd, ssthresh, maxseg and ecn/ace,
while "netstat -C" shows the CC-algo (e.g. newreno, reno,...) and
the TCP stack in use (e.g. FreeBSD, RACK, BBR).

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

usr.bin/netstat/main.c
208 ↗(On Diff #77322)

Other lines use show instead of Show. Change for consistency?

  • address uppercase oversight in comment

Not sure about showing the TCP stack name and the TCP congestion under the same flag. The TCP congestion control name scales to other transports, the TCP stack name doesn't.

Wouldn't the numbers fit also under -x?

  • move stack name output to -c option

Not sure about showing the TCP stack name and the TCP congestion under the same flag. The TCP congestion control name scales to other transports, the TCP stack name doesn't.

Wouldn't the numbers fit also under -x?

Move the stack name to "-c".

-x is cluttered as it is;

I'm even thinking about limiting the column width for Stack and cc_algo, based on the maximum name length currently in use? If all you have is "rack", no need to reserve 16 character-wide columns, or?

  • adjust column width to maximum string length
usr.bin/netstat/inet.c
376 ↗(On Diff #77411)

Discussed with @tuexen; will move the output of session-specific info to the -C flag below after the algo, and -c will only show the TCP specific Stack, when needed.

  • move cc-specific variables output to -C
  • update man page accordingly
This revision is now accepted and ready to land.Thu, Oct 8, 2:26 PM