From nobody Wed Oct 27 15:23:00 2021 X-Original-To: dev-commits-src-main@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 10FDA181405A; Wed, 27 Oct 2021 15:23:03 +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 4HfXWV0FhJz3F7G; Wed, 27 Oct 2021 15:23:01 +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 07ACA128AB; Wed, 27 Oct 2021 15:23:01 +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 19RFN0bf084102; Wed, 27 Oct 2021 15:23:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19RFN0dS084101; Wed, 27 Oct 2021 15:23:00 GMT (envelope-from git) Date: Wed, 27 Oct 2021 15:23:00 GMT Message-Id: <202110271523.19RFN0dS084101@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 5d3bf5b1d27f - main - rack: Update the fast send block on setsockopt(2) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5d3bf5b1d27f4b2bd85f40e26987af83353616f0 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=5d3bf5b1d27f4b2bd85f40e26987af83353616f0 commit 5d3bf5b1d27f4b2bd85f40e26987af83353616f0 Author: Gleb Smirnoff AuthorDate: 2021-10-26 03:54:26 +0000 Commit: Gleb Smirnoff CommitDate: 2021-10-27 15:22:00 +0000 rack: Update the fast send block on setsockopt(2) Rack caches TCP/IP header for fast send, so it doesn't call tcpip_fillheaders(). After certain socket option changes, namely IPV6_TCLASS, IP_TOS and IP_TTL it needs to update its fast block to be in sync with the inpcb. Reviewed by: rrs Differential Revision: https://reviews.freebsd.org/D32655 --- sys/netinet/tcp_stacks/rack.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 3e3997f8e18e..a92e43205f09 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -20245,6 +20245,12 @@ static int rack_set_sockopt(struct socket *so, struct sockopt *sopt, struct inpcb *inp, struct tcpcb *tp, struct tcp_rack *rack) { +#ifdef INET6 + struct ip6_hdr *ip6 = (struct ip6_hdr *)rack->r_ctl.fsb.tcp_ip_hdr; +#endif +#ifdef INET + struct ip *ip = (struct ip *)rack->r_ctl.fsb.tcp_ip_hdr; +#endif uint64_t loptval; int32_t error = 0, optval; @@ -20255,13 +20261,34 @@ rack_set_sockopt(struct socket *so, struct sockopt *sopt, switch (sopt->sopt_name) { case IPV6_USE_MIN_MTU: tcp6_use_min_mtu(tp); - /* FALLTHROUGH */ + break; + case IPV6_TCLASS: + /* + * The DSCP codepoint has changed, update the fsb. + */ + ip6->ip6_flow = (ip6->ip6_flow & ~IPV6_FLOWINFO_MASK) | + (rack->rc_inp->inp_flow & IPV6_FLOWINFO_MASK); + break; } INP_WUNLOCK(inp); return (0); #endif #ifdef INET case IPPROTO_IP: + switch (sopt->sopt_name) { + case IP_TOS: + /* + * The DSCP codepoint has changed, update the fsb. + */ + ip->ip_tos = rack->rc_inp->inp_ip_tos; + break; + case IP_TTL: + /* + * The TTL has changed, update the fsb. + */ + ip->ip_ttl = rack->rc_inp->inp_ip_ttl; + break; + } INP_WUNLOCK(inp); return (0); #endif