Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Jan 2024 15:41:08 GMT
From:      Michael Tuexen <tuexen@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 13fbe20942cd - stable/14 - tcp: tcp: allow SOL_SOCKET-level socket options via sysctl interface
Message-ID:  <202401121541.40CFf8Z6071321@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by tuexen:

URL: https://cgit.FreeBSD.org/src/commit/?id=13fbe20942cd99c77daedd28560adaef4653fefb

commit 13fbe20942cd99c77daedd28560adaef4653fefb
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2023-12-09 11:57:19 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2024-01-12 15:28:41 +0000

    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)
---
 sys/netinet/in_pcb.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

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;
 		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202401121541.40CFf8Z6071321>