From nobody Wed Mar 15 21:35:53 2023 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 4PcNx53LMMz3xqFs; Wed, 15 Mar 2023 21:35:53 +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 4PcNx52ZMWz437R; Wed, 15 Mar 2023 21:35:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678916153; 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=TA2vp8YeCO50kC2bmheQLVAeDaU4FPtdV4YlDL60on0=; b=CgHlIsJWAteqr9mP2vepzLV5YRTuaSeEnNPSHuU5n/5n6JKenEtgRTz2TxKScKzH0d0KKH FO2LGTEKAIoxU5a6FQliS48BjmDKzJZzGgliuwxB0VstPOer3RRCBTpddvkvWwipJVrtp1 8hyEt5MS/K3Ybqc79gcYx71Y5m37mAb0soLd/jWHi1tBOS34Xr0/vJTR3J00WF4FPRlrN/ 51ZrKCne4njx+dzqtWb74I3O/BjaF91Jk1NwT5Z3fCpMQg+wATJCE5rVwdvf9lz+pJhhvQ 2IyLvrf9vrqZ8DWh8R31neooc92Hb5d4n4IhLaF8+X+inU+I46dQ3HcviQpV0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678916153; 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=TA2vp8YeCO50kC2bmheQLVAeDaU4FPtdV4YlDL60on0=; b=p0+/0BwYD7EiLZ2oTklKvxlKjAzC1qLpZve0s6NTjdHYz5KoXnFtjf6jvSGj/Y1ewTfR/y cRtik4/dlp7eERHunrqhOO5Yp99f/aq533wxdoVT5kSu4T23UdkytxSpW+aSY1uOP7KQS4 EDPr4sslB0uKm2/sFcCxlfSafKj5YgtN9HfF093c/WRgJyVnbBXrHj/Wr44lop6MzEEJHz hDjsWz+J6ZEK/re6XZJmeppK23jNFKrqIU3O45uHxrPvveZnSQz1R2uf9w1UpEoV8siRSw JoZw6UZXFfJ4pIiW7ogBMIhAnaq/zawaq5xtETmf3q6bljx9PHvpsXZOUFmPuA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1678916153; a=rsa-sha256; cv=none; b=Nd37m4hhf3/X37UkI5skwOPaCuSjPlri6vwhlt4f2dRAUls4wgBWP8lBv7iNHDwvr4HI2X EEaRSxh5XxA44YgHHiWsOvi2GLHqY4b8Av/nnwR9RuQVOEJO/KNnqxo4svLnI1x6Vr2Ao+ HJOBEFSg6nzXvRFcEEDqmw/+c4Jw0b/fEUZl0gYdOi6pxjOXNu0OdjpX9n6XA/5OxpaY/Q D2cWBrm7f4I+wuYbpac3CW1s3KTlRkHs3r2sgGNceuBsFNfzWlJJE3FgnmWOPQQGG+O9Bd WgD0efralzfT+7O657pepevqlZYVfk9oRJ+8nbAU4+IYDCddCumOzYFon9u5Cg== 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 4PcNx51PSqzGqt; Wed, 15 Mar 2023 21:35:53 +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 32FLZrTV034579; Wed, 15 Mar 2023 21:35:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32FLZru7034578; Wed, 15 Mar 2023 21:35:53 GMT (envelope-from git) Date: Wed, 15 Mar 2023 21:35:53 GMT Message-Id: <202303152135.32FLZru7034578@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 6026b45aabb3 - main - sctp: improve negotiation of zero checksum feature 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: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6026b45aabb3324934d076db53b48c50ce30a63d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=6026b45aabb3324934d076db53b48c50ce30a63d commit 6026b45aabb3324934d076db53b48c50ce30a63d Author: Michael Tuexen AuthorDate: 2023-03-15 21:29:52 +0000 Commit: Michael Tuexen CommitDate: 2023-03-15 21:29:52 +0000 sctp: improve negotiation of zero checksum feature Enforce consistency between announcing 0-cksum support and actually using it in the association. The value from the inp when the INIT ACK is sent must be used, not the one from the inp when the cookie is received. --- sys/netinet/sctp_header.h | 3 ++- sys/netinet/sctp_input.c | 2 ++ sys/netinet/sctp_output.c | 5 +++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/sys/netinet/sctp_header.h b/sys/netinet/sctp_header.h index 4d5b5bc9db0b..93dda17ae9b1 100644 --- a/sys/netinet/sctp_header.h +++ b/sys/netinet/sctp_header.h @@ -180,7 +180,7 @@ struct sctp_init { } SCTP_PACKED; #define SCTP_IDENTIFICATION_SIZE 16 #define SCTP_ADDRESS_SIZE 4 -#define SCTP_RESERVE_SPACE 6 +#define SCTP_RESERVE_SPACE 5 /* state cookie header */ struct sctp_state_cookie { /* this is our definition... */ uint8_t identification[SCTP_IDENTIFICATION_SIZE]; /* id of who we are */ @@ -207,6 +207,7 @@ struct sctp_state_cookie { /* this is our definition... */ uint8_t ipv4_scope; /* IPv4 private addr scope */ uint8_t loopback_scope; /* loopback scope information */ + uint8_t zero_checksum; /* copy of the inp value */ uint8_t reserved[SCTP_RESERVE_SPACE]; /* Align to 64 bits */ /* * at the end is tacked on the INIT chunk and the INIT-ACK chunk diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c index dfc74e1e84f3..6299c5c7d827 100644 --- a/sys/netinet/sctp_input.c +++ b/sys/netinet/sctp_input.c @@ -1880,6 +1880,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset, } SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_asconf_ack), aack); } + asoc->zero_checksum = cookie->zero_checksum; /* process the INIT-ACK info (my info) */ asoc->my_vtag = ntohl(initack_cp->init.initiate_tag); @@ -2076,6 +2077,7 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset, SCTP_FROM_SCTP_INPUT + SCTP_LOC_18); return (NULL); } + asoc->zero_checksum = cookie->zero_checksum; /* process the INIT-ACK info (my info) */ asoc->my_rwnd = ntohl(initack_cp->init.a_rwnd); diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c index 97e89cb1396c..2ce05336482a 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -5804,6 +5804,11 @@ do_a_abort: #endif } } + if (asoc != NULL) { + stc.zero_checksum = asoc->zero_checksum > 0 ? 1 : 0; + } else { + stc.zero_checksum = inp->zero_checksum; + } /* Now lets put the SCTP header in place */ initack = mtod(m, struct sctp_init_ack_chunk *); /* Save it off for quick ref */