From nobody Sat Aug 03 23:10:06 2024 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Wbz1p6KXgz5RWpc; Sat, 03 Aug 2024 23:10:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Wbz1p4Qvqz4PtX; Sat, 3 Aug 2024 23:10:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722726606; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3ctrE+W0OhDx4JEuiHCdh+uQgzj2PHUtNXdAryQIh+I=; b=YRvBhJwai7w9RdgNz1fYOTO9x5323HvKopU0QNDd+5R+adP8gXHg8UYmRO/vf9QYfL0SFU 5lPPDq59rbUkuwZnkf4AXe1uzqmz1Y/6VGWQirweqqh+L+4HBZkh5o+P/ZCrkrUBovy0Hj xnYgW/i5sLMo2OosDH5uYVutEoqD9UaHzFDhjUNSwnE9Hv0ry93JuKr6Qi0CzIilMqdXDs ehj+t7BpSiFBd4rxCTxOG+SBBXLO7K/wLFCX7cioJm6rquo5Z+je6A7G2NGYRTdrqZeKT1 iG5QpMDf5vJbUQdVlrv+l07kPpIWIh0EEtSyBaQZ+XsNOavjebiokq8c7Y5wsA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722726606; a=rsa-sha256; cv=none; b=omj+NqdrABG3V1/VbclWC4jFH6JzDpy0xBGX5mAvl8Vq/1wxO4UN1dYuRFgRYxQ4K243O1 EbjvvF93Qx9dYzpM/W9lbuD4pdNUEyR8LyfQNWxrwRA4G+KBGGf6T7HEc0bcEMHu15wrGY 2/+xOLs24eJ8tUkhA3eN6RRVfZhEBvozypG5wp/z9CullKUUmBD2uWbiMDkW9qbrDl1fv5 r8OEx1New/c1kI79vCSeHg2zcErdwdRmMxGVjNyj7dLicxPNc62Ca3SXvbEz6ceQS+7gU9 EM6qcxBiT9wiWyC1A606A7OwQKP9+ORcGVg/FQ4P++bJHtY+jTHUIJy9UgczbQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722726606; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3ctrE+W0OhDx4JEuiHCdh+uQgzj2PHUtNXdAryQIh+I=; b=XJhq8qCnGNyElXPy0NRx3TWNHV8IeBq9sfUW3SIfIlDMpUGj40j92gFb0uPMR4EUkfgMCZ 6Aj4zLnjJ9XmTn/j9NAepIuS/hBuzVzPuBNIj/ROw67n6qHQNovpDIY4891cpj4xcOD6CY RUKaqxEofW6Lm1kXlSogf08uQvTsb1rK4ozcX4jWfutfEbAOYwu62ZqeqDOtWXef63My+6 XeOr4EA9IqyAyRrgBJ1O7GINjfayuD3D5WtPliH+bxwbxC65y58QG2Bq2d2rpSBtg5sfke MLCPqsVOi3Urdt/+XRxdVIjea2VMosTqczHoVRLOOlqIApdSo65AaQ+ued1E2Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Wbz1p3h68zX3t; Sat, 3 Aug 2024 23:10:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 473NA6An099918; Sat, 3 Aug 2024 23:10:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 473NA6AC099905; Sat, 3 Aug 2024 23:10:06 GMT (envelope-from git) Date: Sat, 3 Aug 2024 23:10:06 GMT Message-Id: <202408032310.473NA6AC099905@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: 9ea13f8547a9 - stable/14 - tcp: mark TCP stacks which can serve as a default stack List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 9ea13f8547a98d4467d2095c4e97447309a2dd10 Auto-Submitted: auto-generated The branch stable/14 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=9ea13f8547a98d4467d2095c4e97447309a2dd10 commit 9ea13f8547a98d4467d2095c4e97447309a2dd10 Author: Michael Tuexen AuthorDate: 2024-07-21 13:06:10 +0000 Commit: Michael Tuexen CommitDate: 2024-08-03 23:09:27 +0000 tcp: mark TCP stacks which can serve as a default stack Allow a TCP function block (tfb) to become the default stack only if tfb->tfb_flags has the TCP_FUNC_DEFAULT_OK flags set. This allows a TCP function block, that is not suitable as a default function block to ensure that it is not set as the default via sysctl. In this case sysctl would return EINVAL. Reviewed by: gallatin, Peter Lei Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D45419 (cherry picked from commit e0b080f850cc0418353cc196cbfe81075cf76661) --- sys/netinet/tcp_stacks/bbr.c | 2 +- sys/netinet/tcp_stacks/rack.c | 2 +- sys/netinet/tcp_subr.c | 5 +++++ sys/netinet/tcp_var.h | 1 + 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/netinet/tcp_stacks/bbr.c b/sys/netinet/tcp_stacks/bbr.c index 2bdab744e0d9..c1bbec3800fd 100644 --- a/sys/netinet/tcp_stacks/bbr.c +++ b/sys/netinet/tcp_stacks/bbr.c @@ -14151,7 +14151,7 @@ struct tcp_function_block __tcp_bbr = { .tfb_tcp_mtu_chg = bbr_mtu_chg, .tfb_pru_options = bbr_pru_options, .tfb_switch_failed = bbr_switch_failed, - .tfb_flags = TCP_FUNC_OUTPUT_CANDROP, + .tfb_flags = TCP_FUNC_OUTPUT_CANDROP | TCP_FUNC_DEFAULT_OK, }; /* diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index c27f745ade62..35ae371a082e 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -23800,7 +23800,7 @@ static struct tcp_function_block __tcp_rack = { .tfb_switch_failed = rack_switch_failed, .tfb_early_wake_check = rack_wake_check, .tfb_compute_pipe = rack_compute_pipe, - .tfb_flags = TCP_FUNC_OUTPUT_CANDROP, + .tfb_flags = TCP_FUNC_OUTPUT_CANDROP | TCP_FUNC_DEFAULT_OK, }; /* diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 5d87d0327148..9fc744c42e0c 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -402,6 +402,7 @@ static struct tcp_function_block tcp_def_funcblk = { .tfb_tcp_fb_init = tcp_default_fb_init, .tfb_tcp_fb_fini = tcp_default_fb_fini, .tfb_switch_failed = tcp_default_switch_failed, + .tfb_flags = TCP_FUNC_DEFAULT_OK, }; static int tcp_fb_cnt = 0; @@ -719,6 +720,10 @@ sysctl_net_inet_default_tcp_functions(SYSCTL_HANDLER_ARGS) error = ENOENT; goto done; } + if ((blk->tfb_flags & TCP_FUNC_DEFAULT_OK) == 0) { + error = EINVAL; + goto done; + } V_tcp_func_set_ptr = blk; done: rw_wunlock(&tcp_function_lock); diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index 4632474c1d11..e7cccd60a95e 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -536,6 +536,7 @@ typedef enum { /* Flags for tcp functions */ #define TCP_FUNC_BEING_REMOVED 0x01 /* Can no longer be referenced */ #define TCP_FUNC_OUTPUT_CANDROP 0x02 /* tfb_tcp_output may ask tcp_drop */ +#define TCP_FUNC_DEFAULT_OK 0x04 /* Can be used as default */ /** * If defining the optional tcp_timers, in the