tcp: tcp: allow SOL_SOCKET-level socket options via sysctl interface

When using the sysctl interface for setting a SOL_SOCKET-level socket
option, the TCP handler refers to the IP handler, which only handles
SO_SETFIB and SO_MAX_PACING_RATE.
So call sosetopt(), which handles all SOL_SOCKET-level options.
Then you can use tcpsso with SOL_SOCKET-level socket options as
expected.

Reported by:		rscheff
Reviewed by:		glebius, rscheff
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D42985
This commit is contained in:
Michael Tuexen 2023-12-09 12:57:19 +01:00
parent 1a4a9a5057
commit bed7633b10

View file

@ -2984,7 +2984,11 @@ sysctl_setsockopt(SYSCTL_HANDLER_ARGS, struct inpcbinfo *pcbinfo,
so = inp->inp_socket;
KASSERT(so != NULL, ("inp_socket == NULL"));
soref(so);
error = (*ctloutput_set)(inp, &sopt);
if (params->sop_level == SOL_SOCKET) {
INP_WUNLOCK(inp);
error = sosetopt(so, &sopt);
} else
error = (*ctloutput_set)(inp, &sopt);
sorele(so);
break;
}