Page MenuHomeFreeBSD

tcpsso, a tool to set socket options for TCP endpoints via the command line
ClosedPublic

Authored by tuexen on Feb 2 2022, 10:56 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Mar 20, 2:48 AM
Unknown Object (File)
Mar 12 2024, 12:51 PM
Unknown Object (File)
Mar 12 2024, 12:51 PM
Unknown Object (File)
Mar 12 2024, 12:51 PM
Unknown Object (File)
Mar 12 2024, 12:52 AM
Unknown Object (File)
Mar 10 2024, 10:49 PM
Unknown Object (File)
Mar 8 2024, 5:55 AM
Unknown Object (File)
Mar 8 2024, 5:55 AM

Details

Summary

This tool allows to set TCP options on TCP endpoints via the command line. It can be used, for example, to change the congestion control module or the TCP stack used by TCP endpoints.

It depends on D34138

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

tuexen added a reviewer: manpages.

When we discussed this tool, weren't generic SOCKOPTs also on the table?

(SO_SNDBUF, SO_DEBUG spring to mind) - the use case would be to modify existing sockets underneath an application, which does not tune these (or when the system defaults can not be changed easily/application restartet).

usr.sbin/tcpsso/tcpsso.8
180

typo? (httpd)

usr.sbin/tcpsso/tcpsso.c
156

not sure, if this scales. OTOH, putting in a parser that interprets tcp.h for all setsockopt stringnames may be overkill... So is the plan to extend these TCP socket options that have some utility over time?

When we discussed this tool, weren't generic SOCKOPTs also on the table?

(SO_SNDBUF, SO_DEBUG spring to mind) - the use case would be to modify existing sockets underneath an application, which does not tune these (or when the system defaults can not be changed easily/application restartet).

Yes, these are on the table. But I need to figure out if this works with respect to locking. Right now, the socket can't go away, since the socket layer holds a refcount. This is not true when being called via the sysctl interface.

I wanted to bring up things for review early to get some feedback, especially if I'm doing the locking correct.

usr.sbin/tcpsso/tcpsso.8
180

Yepp. Should be thttpd.

usr.sbin/tcpsso/tcpsso.c
156

The plan is to add all socket options which are useful and for which the optval is parsed. Currently I'm only parsing int and char *.

Right now, I'm focussing on getting supported what is triggering the development: Change the stack and congestion control module. I added TCP_NODELAY only to have also an example for a socket option which uses the type int for optval.

Only mentioning the first .Nm with a redundant argument, but same applies to all following ones.

Can't check manual page and code are consistent.

usr.sbin/tcpsso/tcpsso.8
35

If I read https://docs.freebsd.org/en/books/fdp-primer/manual-pages/#manual-pages-markup (and specifically 10.3.2. Macros) right, you don't need to specify an argument to .Nm after the first time (in the NAME section).

64
80
93

I think you mean .Nm here.

94

"apply the option" maybe?

107

"apply the option" maybe?

179–181

I'd reword this to:

To diagnose a problem with a particular TCP connection to
.Xr thttpd 8 ,
first determine its

183

To match the above suggestion.

191

Address comments related to the man page

mandoc -Tlint shows a few nits that I'd like to see corrected before this is committed.

You also have a few lines that exceed 80 characters in width, which I think it'd be good to have reflowed.

Other than that (and the things noted by Pau Amma), mdoc syntax looks good to me.

usr.sbin/tcpsso/tcpsso.8
35

This is correct.

80

This is also pointed out by igor. :)

Address comments related to the man page

tuexen added inline comments.
usr.sbin/tcpsso/tcpsso.8
35

Fixed.

64

Fixed.

80

Fixed.

93

Correct. Fixed.

94

Fixed.

107

Fixed.

179–181

Done.

191

Fixed.

tuexen marked 8 inline comments as done.

Address issues reported by mandoc -Tlint.

Thanks to the man page reviews. I addressed the issues (the reported ones and the ones reported by mandoc).

OK from manpages then. :)

This revision is now accepted and ready to land.Feb 3 2022, 12:27 PM

Add support for socket options of level other than IPPROTO_TCP. Also add more symbolic optnames.

This revision now requires review to proceed.Feb 5 2022, 9:10 PM

Manual page language LGTM. Can't speak about code or the consistency between them.

Add patch for Makefile and update date of man page.

This revision is now accepted and ready to land.Feb 9 2022, 12:58 PM
rscheff added inline comments.
usr.sbin/tcpsso/tcpsso.8
180

Well, i assumed this to be a generic stand in for a web demon, rather than a specific one from the ports collection. Perhaps leave this particular reference out from the example completely (its not material to the example itself), just describe it in the text like this. (I assume most people will be familiar with port 80 to be http).

If a particular TCP connection to a web server process is behaving in an interesting way, one can determine the ....

Or

If a particular TCP connection to a web server process ( *thttpd 8* in this example) is behaving in an interesting way, one can determine the ....

tuexen added inline comments.
usr.sbin/tcpsso/tcpsso.8
180

Switched from thttpd to sshd... This is always installed...

This revision was automatically updated to reflect the committed changes.

This inconspicuous tool might be handy, thanks.
Is MFC to stable/13 planned?

This inconspicuous tool might be handy, thanks.
Is MFC to stable/13 planned?

I have no plans to do so.