From nobody Mon Mar 28 15:25:56 2022 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 67CE31A3173A; Mon, 28 Mar 2022 15:25:57 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KRxNh6DbYz3QQV; Mon, 28 Mar 2022 15:25:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648481157; 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=pORLG07mzps4jSaRfp5WLsyUSZZw8gCFKbbVi0BFjOI=; b=Od88FrIISK9hqH6QrEgMwbrn0md7JdCw2yAihcq9HKBtxejQRxEwss1rNFZ7zu+JuwuVKh erK+B7pvQUIC1OhPornDJfPjdQIywU2MYQLObye3vaLt1E3shv79Yjrm6z5T2aaktCP5ZY nvtLqKs9TexR4Js22nA+BD7wh5o2oGyztuu1a8tMsjnRqcQQ7OkrP28BDTOv6SrQ7gOqih C1h8kG0/9bfB+lZs7toQooqwdwfV5C/+K0T8vwn1wrBQu+G0agJyMp3b049YbM7FOJwUuz oY3b8rAKIuobreN4WBkl+rkcIo5DLTsjfiJZGmlH58TSgUaPc/hxkrK8oyJfaQ== 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 AA5CB42F4; Mon, 28 Mar 2022 15:25:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 22SFPu6x086816; Mon, 28 Mar 2022 15:25:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22SFPuv1086815; Mon, 28 Mar 2022 15:25:56 GMT (envelope-from git) Date: Mon, 28 Mar 2022 15:25:56 GMT Message-Id: <202203281525.22SFPuv1086815@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: d64a952f8d8a - releng/13.1 - tcp: virtualise net.inet.tcp.msl sysctl. 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: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.1 X-Git-Reftype: branch X-Git-Commit: d64a952f8d8ad935c20db327d68d5db78b4bbea8 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648481157; 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=pORLG07mzps4jSaRfp5WLsyUSZZw8gCFKbbVi0BFjOI=; b=F3kMuXeOr7XdsNDnKyU9m7fi/lkAT4nb+XvQ19XrhqiTQFNCduaf58VjYAI9cQosM6J/iL Z0PymjNkoDgSoJA9e0n03pyChMig9rLSp8RvLacRcBiIIV5syDKHnROBmpyettfFpbnRIk BNZXEqy5p2V+76I2jZHbZuBKEgJWLS2cFHnR9XXFJfQXGhAVEoLAqhIaiisHO3xH6eR6V3 i2CvsxFnCgC5tBPeeL5AaEy8dkj7YoWpT+GMYlW6fNcl6aZUhNPzEdwdsW8svMcOd5z4sp 7wATg4SBgBmXX7BksWXeU3sVWa/JIh1BU36g761rucgM40vuBOVgQlShTLN0+A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1648481157; a=rsa-sha256; cv=none; b=X7KVX9fGKWG2WDXdvJNfTWcvEfdQVug940FA9b21tJqB0q+gJkF193+4Z+11Oxgzzhb92D M04gontMBN+mr6e/Q2gW/pLowztS2hutDLk/HP8TIiaeIJZPygnQuCqpe9den9HzHX5+ov rl558Oxbi0MBz0SwkuBtR/NGVz80MgtybHza2DNPDpF3A77hx8eFSl0Asgd8F21eAnNcyX biygWTaUAxA7UgBNCyQl/LdBzUquyT07HDRKXlprmGRlfXuX1QFdxvueaeJllwzEhPGOvE pRPiF5Cfy6phT0MylYCGph3yfOiDxCRXwwaaStTCTz1K+6b/26b95Mc0KTxIRQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.1 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=d64a952f8d8ad935c20db327d68d5db78b4bbea8 commit d64a952f8d8ad935c20db327d68d5db78b4bbea8 Author: Alexander V. Chernikov AuthorDate: 2021-12-04 22:02:44 +0000 Commit: Alexander V. Chernikov CommitDate: 2022-03-28 15:24:28 +0000 tcp: virtualise net.inet.tcp.msl sysctl. VNET teardown waits 2*MSL (60 seconds by default) before expiring tcp PCBs. These PCBs holds references to nexthops, which, in turn, reference ifnets. This chain results in VNET interfaces being destroyed and moved to default VNET only after 60 seconds. Allow tcp_msl to be set in jail by virtualising net.inet.tcp.msl sysctl, permitting more predictable VNET tests outcomes. MFC after: 1 week Reviewed by: glebius Approved by: re(gjb) Differential Revision: https://reviews.freebsd.org/D33270 (cherry picked from commit c2c8e360d8c0b8712158d334686d88f052aef819) (cherry picked from commit 057793e63771816315cb54869c067b1c2b2bb4dc) --- sys/netinet/tcp_subr.c | 5 +++-- sys/netinet/tcp_timer.c | 6 +++--- sys/netinet/tcp_timer.h | 3 ++- sys/netinet/tcp_timewait.c | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index f435ced03e09..62042df50d18 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -1451,19 +1451,20 @@ tcp_init(void) tcp_fastopen_init(); + V_tcp_msl = TCPTV_MSL; + /* Skip initialization of globals for non-default instances. */ if (!IS_DEFAULT_VNET(curvnet)) return; tcp_reass_global_init(); - /* XXX virtualize those bellow? */ + /* XXX virtualize those below? */ tcp_delacktime = TCPTV_DELACK; tcp_keepinit = TCPTV_KEEP_INIT; tcp_keepidle = TCPTV_KEEP_IDLE; tcp_keepintvl = TCPTV_KEEPINTVL; tcp_maxpersistidle = TCPTV_KEEP_IDLE; - tcp_msl = TCPTV_MSL; tcp_rexmit_initial = TCPTV_RTOBASE; if (tcp_rexmit_initial < 1) tcp_rexmit_initial = 1; diff --git a/sys/netinet/tcp_timer.c b/sys/netinet/tcp_timer.c index 96b95ab1c15f..4b00b686be32 100644 --- a/sys/netinet/tcp_timer.c +++ b/sys/netinet/tcp_timer.c @@ -117,10 +117,10 @@ SYSCTL_PROC(_net_inet_tcp, TCPCTL_DELACKTIME, delacktime, &tcp_delacktime, 0, sysctl_msec_to_ticks, "I", "Time before a delayed ACK is sent"); -int tcp_msl; +VNET_DEFINE(int, tcp_msl); SYSCTL_PROC(_net_inet_tcp, OID_AUTO, msl, - CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, - &tcp_msl, 0, sysctl_msec_to_ticks, "I", + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_VNET, + &VNET_NAME(tcp_msl), 0, sysctl_msec_to_ticks, "I", "Maximum segment lifetime"); int tcp_rexmit_initial; diff --git a/sys/netinet/tcp_timer.h b/sys/netinet/tcp_timer.h index 9a711d173386..316b76e50f7e 100644 --- a/sys/netinet/tcp_timer.h +++ b/sys/netinet/tcp_timer.h @@ -195,7 +195,6 @@ extern int tcp_maxpersistidle; extern int tcp_rexmit_initial; extern int tcp_rexmit_min; extern int tcp_rexmit_slop; -extern int tcp_msl; extern int tcp_ttl; /* time to live for TCP segs */ extern int tcp_backoff[]; extern int tcp_totbackoff; @@ -212,6 +211,8 @@ VNET_DECLARE(int, tcp_pmtud_blackhole_mss); #define V_tcp_pmtud_blackhole_mss VNET(tcp_pmtud_blackhole_mss) VNET_DECLARE(int, tcp_v6pmtud_blackhole_mss); #define V_tcp_v6pmtud_blackhole_mss VNET(tcp_v6pmtud_blackhole_mss) +VNET_DECLARE(int, tcp_msl); +#define V_tcp_msl VNET(tcp_msl) void tcp_inpinfo_lock_del(struct inpcb *inp, struct tcpcb *tp); diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c index ee31c449cd1e..970f46274791 100644 --- a/sys/netinet/tcp_timewait.c +++ b/sys/netinet/tcp_timewait.c @@ -744,7 +744,7 @@ tcp_tw_2msl_reset(struct tcptw *tw, int rearm) TW_WLOCK(V_tw_lock); if (rearm) TAILQ_REMOVE(&V_twq_2msl, tw, tw_2msl); - tw->tw_time = ticks + 2 * tcp_msl; + tw->tw_time = ticks + 2 * V_tcp_msl; TAILQ_INSERT_TAIL(&V_twq_2msl, tw, tw_2msl); TW_WUNLOCK(V_tw_lock); }