aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Tuexen <tuexen@FreeBSD.org>2023-12-09 11:57:19 +0000
committerMichael Tuexen <tuexen@FreeBSD.org>2023-12-09 12:03:51 +0000
commitbed7633b108930e9e9d2478c75556035938d4e88 (patch)
tree58488418e0b66523635f2b936ca54beea14bca53
parent1a4a9a50574d9b4b4db90a85bc253d340c93a8a0 (diff)
downloadsrc-bed7633b108930e9e9d2478c75556035938d4e88.tar.gz
src-bed7633b108930e9e9d2478c75556035938d4e88.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 MFC after: 1 week Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D42985
-rw-r--r--sys/netinet/in_pcb.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index 797c0dc445dd..0d763184f68c 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -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;
}