diff options
author | Michael Tuexen <tuexen@FreeBSD.org> | 2023-12-09 11:57:19 +0000 |
---|---|---|
committer | Michael Tuexen <tuexen@FreeBSD.org> | 2024-01-12 15:28:41 +0000 |
commit | 13fbe20942cd99c77daedd28560adaef4653fefb (patch) | |
tree | 20b158f5cc10b39aeade06fb738ec86d56298922 | |
parent | 2ff28c64288eefab4962f0e826d776dc30287aef (diff) | |
download | src-13fbe20942cd99c77daedd28560adaef4653fefb.tar.gz src-13fbe20942cd99c77daedd28560adaef4653fefb.zip |
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
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D42985
(cherry picked from commit bed7633b108930e9e9d2478c75556035938d4e88)
-rw-r--r-- | sys/netinet/in_pcb.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index a54b93812c55..b00d61eaecf7 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -3020,7 +3020,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; } |