From nobody Sun Jun 25 19:42:44 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 4Qq1bT32gzz4hbxb; Sun, 25 Jun 2023 19:42:45 +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 4Qq1bS6CgWz3MH8; Sun, 25 Jun 2023 19:42:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1687722164; 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=pTxrUmm1GrVWHJm1F4KeY5MpjJgtN+uoCuCSYld+QCo=; b=p8xKfkB/KUiOKG99qmTSDE338pNIvINuO9UVgoVayj1cGnqu309WFu76EyOz3OTXv+Q/g6 CM8/ApmBXz6Cw0E/mCtUBxShHT5W6FiQgw6q03fp9f9J6C7MNFWLqq65DXI1n5G/dOrW0i 24kZhMiMpXB0stelewPGOZY/xTTPueHhoWrIMK/Dl2r38sjWNl7YjfZm5aUz/K7BqxQLVb UZLfhVQY/ljQ7Y3ri60fHnm586g8zgmEoaWyt0VKFQiodmkk8dca378B26CwkJfOTP+77Q vtpT4xtWFwv7cRHSurS8r/3VwY3ccHP+WLvkVQ7upWOJdlE0x/Cl63YlpumItQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1687722164; 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=pTxrUmm1GrVWHJm1F4KeY5MpjJgtN+uoCuCSYld+QCo=; b=nX0FKRmBKrpIaq01AXjcciy2zF6DOHek8GkkGmD4enwCFInVaZauWX6sLtPsf0nJby2y00 dIPwL9DoWXl3mHovMeXE3UTopAsPb2cnktXKICOfLcOhej2ZZDytfpNcHFT0rNvi1s9Zuw igxQUBDJUqFA6A6o4lR4CO2XQk4kNTtLR1p3nTed/j5ZUq/2PWkuA5hRxBwwNgNQOJ8NgL msZu/vP3BLK84yvyQJQcCOviZg2iGTtxIbIHJ21p7d7nlUVo8jHaPF4yo/lteiIOfvxWAJ 4lbkLJw2+dTig1eNzQH/xqxcqtDb36kJWjv2wbUCmh82d/X9AG4aSc/ORxB9GA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1687722164; a=rsa-sha256; cv=none; b=f0S0H6tp5xVBmEvoCHVMtgErllYnd8GGd5C+tHshagXbAKIJ70ik1m+LwmSLIHBlSav4Ds 9JfcDxCpe6+4iWnLATFgsa76zYH5kJbpPVkKeszjRSyMhP6GUjKGk+V4XYYKyDzv7Ul/hW OMxJ+Ka4B2Hg6vC/y/a/6NPwDGlp9CpdZTq5vYcn3EOcpUoZXnVt/mje+CwRGn4xE2MTjo d3gQ4RvCmEomQCpgKC+Rupo8zj5PLSn/oCvBLrCl91tNSWIKRcuJ7JQ0JWFE0nizlfQUij ERyl8L6kq0JDQUAOU6qmbLIFo98NaTw6G771FRpAAWmym3159MG7V1M3KlZagg== 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 4Qq1bS5HSFzg1K; Sun, 25 Jun 2023 19:42:44 +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 35PJgier057700; Sun, 25 Jun 2023 19:42:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35PJgiK1057699; Sun, 25 Jun 2023 19:42:44 GMT (envelope-from git) Date: Sun, 25 Jun 2023 19:42:44 GMT Message-Id: <202306251942.35PJgiK1057699@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: 6dc94f4ba1a5 - stable/12 - 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/12 X-Git-Reftype: branch X-Git-Commit: 6dc94f4ba1a5b0f17c3adda317eac31d3146eccf Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=6dc94f4ba1a5b0f17c3adda317eac31d3146eccf commit 6dc94f4ba1a5b0f17c3adda317eac31d3146eccf Author: Michael Tuexen AuthorDate: 2022-11-15 20:05:02 +0000 Commit: Michael Tuexen CommitDate: 2023-06-25 19:42:28 +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 d6cedd72ddc1..e274b4c2e6d5 100644 --- a/sys/netinet/libalias/alias_sctp.c +++ b/sys/netinet/libalias/alias_sctp.c @@ -730,8 +730,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; } @@ -1043,6 +1046,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 */ @@ -1090,8 +1095,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: