From nobody Sun Dec 26 15:06:04 2021 X-Original-To: dev-commits-src-all@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 D1C3F1913D2E; Sun, 26 Dec 2021 15:06:04 +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 4JMPJD3ZZKz4kCv; Sun, 26 Dec 2021 15:06:04 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 57C5445EC; Sun, 26 Dec 2021 15:06:04 +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 1BQF640m080931; Sun, 26 Dec 2021 15:06:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BQF64Cm080930; Sun, 26 Dec 2021 15:06:04 GMT (envelope-from git) Date: Sun, 26 Dec 2021 15:06:04 GMT Message-Id: <202112261506.1BQF64Cm080930@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: c2c8e360d8c0 - main - tcp: virtualise net.inet.tcp.msl sysctl. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/main X-Git-Reftype: branch X-Git-Commit: c2c8e360d8c0b8712158d334686d88f052aef819 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1640531164; 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=B0GVRUCeHbONmYwpls/KPh91DEBLg3KRlaS3K0GRRoI=; b=k3TWrVdPy3CIyZKQ5olBucH1Cu74Vj9bxRMsbk2S33f2yDj7mHcv/63GvXQeb/NRw17Y2g YzYXyr1jHnO6YC2sjfVG/YawHlFitYyPjx6YujUzlsGokDhNtrmix8iTHKsSdR6i4BiED/ ePWgwVjXAD/JZ86a2eRfogp4n3+LzUGKhr1I/e+QSq9AgkD3uD3nd96ic1EJvYVf72yS7F KYoyy12ZecMdTGN/dOsWUq8FumiTDAAbsMYHTk9mPl4YZUJ+Dwvg8HE1H1l/Du10Dq2mO+ BuZfbUlURl6hkx1tqF/3gFSnYuzI57ZXRU9X6zPxM1C8HGn7ODLiaSwLO6mcXA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1640531164; a=rsa-sha256; cv=none; b=rrcBv4l6EswEGgf01m/aE+90Le9um7VUM3U75eaDXC5Vc28zmn16RjjEU7JZSvKyTIa+0+ DzNgKCu3ABnnvf2NcJTz4N2V3gm9Ph7ITgaXDFXpQKMJzLRnqnSsWy6RjmGyPOaANXqx+W zYW4A2gpfad0Ue9cdYyMrAIo9lPJbDH0H2SNHzPShXvRaf4+GNesGZiXQCkUtJt3aw3S2u uY0/OuAwZDPr39jpUXs6o40GJ/qBP8WiANvFxQ8FyZ15usKMsaPAjcARjsi9fy6hqDIpCC d5QGGRixqmZRGURrKLnYKICptlIqkfGhIcV5VmQpkFnceukBX/0OvnhSUTISCA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=c2c8e360d8c0b8712158d334686d88f052aef819 commit c2c8e360d8c0b8712158d334686d88f052aef819 Author: Alexander V. Chernikov AuthorDate: 2021-12-04 22:02:44 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-12-26 14:56:04 +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 Differential Revision: https://reviews.freebsd.org/D33270 --- 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 232163fe9fe5..18de53294229 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -1506,19 +1506,20 @@ tcp_init(void) COUNTER_ARRAY_ALLOC(V_tcps_states, TCP_NSTATES, M_WAITOK); VNET_PCPUSTAT_ALLOC(tcpstat, M_WAITOK); + 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 67e550b83bce..54ac67867fcb 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 c5317d1a4155..c0382d68c13c 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 52f8002d8505..32b2e72c3484 100644 --- a/sys/netinet/tcp_timewait.c +++ b/sys/netinet/tcp_timewait.c @@ -765,7 +765,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); }