From nobody Thu Feb 2 00:02:18 2023 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 4P6f9Q6CGsz3cQ2V; Thu, 2 Feb 2023 00:02:18 +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 4P6f9Q5mzgz3jDr; Thu, 2 Feb 2023 00:02:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675296138; 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=WXzlpbFFU4V8MjcMLGFA72GFlt6z2PnJ1Q1Rp6RO41o=; b=HzMBa8X1HAS8tG7Paujfhjd2ARyUOThiHQO+OpcqNSYmFLX0StOBD5Cx1YtFUQXqfJdokg 4UjnxuOJw7AjB5T7wpvKO2pbh0Ls+2pHLTbIs12MhWvbBpIfb1xywCdskzW3KxCMzAeevg bAG4ts87qs5svRYJssltBixCfhQXOfxhZ4kUkW/NgM5UhlmTd9adOVmurBG2G8yuOmDHf7 tMw1LhTw3PaanX1LffGQqEpUkNcotc+eyK8/05zXznovLMqU5VZOVoLwFz93jJy8DmI7bk aCjheW/0gw6f2z8mVHrG0jACekusEkYhjfKdgpXgULiIFy3HcYYH2osLqtZxiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675296138; 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=WXzlpbFFU4V8MjcMLGFA72GFlt6z2PnJ1Q1Rp6RO41o=; b=dp24dZTXB2fWGxnnOLxc/e+nk3Q/0ZK9g1+ggMC8FFXWCfWkBEICjnTh+koR8uwrc6Y2Es XckO0CAaN5gJSaMuWMntd3tCgp5LoDNs5MxpwhwrYGDM1MuN9A4ayFClTvDlHl/8RMVO56 qjbQwypfcK7AwgfHeGBannQ2FCEN8fNMfEjn5yNoxjUcy8Y33BxiwxTPQyrFsL+juaOAqL tXwgKCRpHYGif3fnneya7mlarQT8A+25WUXEKAIownN+FdDeXRMZ/v35FOjPZDk1WokzkB 58Czcc1fdYMYROBP6JG7CiimQ4eopf3lTKnZZqVSMjFiTltZKC2xTN3n6NkD7Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675296138; a=rsa-sha256; cv=none; b=VV1+tGaDQlj3+B66UsGSegTSj5DPWngdkz9qKpKo8ieatx8fLkjN9vSMfYAUo6xF76COw5 JaDWz/x9sX/WfcjV0i+B0pj4fM3+qJCusyrn+tU0ylBLoYXJ3op/8JTaUS92N8ltiBFivt naBpvDK5AhAAxO0vpTdpJb51HvRmG90g8iIRV3Z3DaVnfws2nygKijkD1Qr5dwk3qI1yDo 8rNvMykzbeFXt2/Lee6jZDoXoLAR2w1DzulS6RBr6wrfrMXTab1NvT2sOLTIwW8nYxflYb X1UNpqhFRXqyp92StsWKKbthFx26XGBcB/4cAdsnMewMD4Kn+ixly/6TItaTcg== 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 4P6f9Q4qcnzZ1T; Thu, 2 Feb 2023 00:02:18 +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 31202IA0019963; Thu, 2 Feb 2023 00:02:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31202Ix0019962; Thu, 2 Feb 2023 00:02:18 GMT (envelope-from git) Date: Thu, 2 Feb 2023 00:02:18 GMT Message-Id: <202302020002.31202Ix0019962@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: 39844782bf1e - stable/13 - libalias: improve handling of invalid SCTP packets 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: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 39844782bf1e648fa85eec40484af4d221d45fa8 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=39844782bf1e648fa85eec40484af4d221d45fa8 commit 39844782bf1e648fa85eec40484af4d221d45fa8 Author: Michael Tuexen AuthorDate: 2022-11-15 20:05:02 +0000 Commit: Michael Tuexen CommitDate: 2023-02-02 00:01:43 +0000 libalias: improve handling of invalid SCTP packets In case of a paritial chunk only pretend the result is OK if the packet is not the last fragment and there is a valid association. PR: 267476 (cherry picked from commit 9a714376212ec1685fdc4cf254f2136a07ae6d2c) --- sys/netinet/libalias/alias_sctp.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sys/netinet/libalias/alias_sctp.c b/sys/netinet/libalias/alias_sctp.c index b88ad2b28ca8..41d1d5337a85 100644 --- a/sys/netinet/libalias/alias_sctp.c +++ b/sys/netinet/libalias/alias_sctp.c @@ -754,8 +754,11 @@ SctpAlias(struct libalias *la, struct ip *pip, int direction) case SN_PARSE_OK: break; case SN_PARSE_ERROR_CHHL: - /* Not an error if there is a chunk length parsing error and this is a fragmented packet */ - if (ntohs(pip->ip_off) & IP_MF) { + /* + * Not an error, if there is a chunk length parsing error, + * this is a fragmented packet, and we have a valid assoc. + */ + if ((assoc != NULL) && (ntohs(pip->ip_off) & IP_MF)) { rtnval = SN_PARSE_OK; break; } @@ -1067,6 +1070,8 @@ sctp_PktParser(struct libalias *la, int direction, struct ip *pip, * Also, I am only interested in the content of INIT and ADDIP chunks */ + sm->msg = SN_SCTP_OTHER;/* Initialise to largest value*/ + sm->chunk_length = 0; /* only care about length for key chunks */ // no mbuf stuff from Paolo yet so ... sm->ip_hdr = pip; /* remove ip header length from the bytes_left */ @@ -1114,8 +1119,6 @@ sctp_PktParser(struct libalias *la, int direction, struct ip *pip, chunk_count = 1; /* Real packet parsing occurs below */ - sm->msg = SN_SCTP_OTHER;/* Initialise to largest value*/ - sm->chunk_length = 0; /* only care about length for key chunks */ while (IS_SCTP_CONTROL(chunk_hdr)) { switch (chunk_hdr->chunk_type) { case SCTP_INITIATION: