From nobody Fri Nov 24 14:10:49 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 4ScH2K639Jz52bBy; Fri, 24 Nov 2023 14:10:49 +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 4ScH2K549xz3ftn; Fri, 24 Nov 2023 14:10:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700835049; 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=Lj90uDqOgwfvR6MbCkApE21M2Xm7fxrF32lkZ88+Er8=; b=N7z58UmPFU0r90xzqNeAs9zgRMJiqxu0sHluXWlVlXR/FD/54YPaWuKjxEagNp+xPvqAXo sNM/GYIUOkFScs/haEkOTK+3lf/evujHBOx2vyz+hfTx0yCfn2nvxqYDMJnJEoM5eV2yen h63bwlUH3A2CBNXyHcJlzXNnTBHC/pCaNvMM1auasYFRfNLX6A6tiJ5dV4SIJaZMwbCFju I/+joZoNRDn1TfzfZNMb5KVF19fEfzXN43t36dDRjnHemS5gt1VMmGEr1iecIZgzsoGQHu qVOln+GryLZq8W9oKZdW85wDFagm5mGgd6l+6KPXDPaXmKXPoFqWbr9QtCxr0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700835049; 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=Lj90uDqOgwfvR6MbCkApE21M2Xm7fxrF32lkZ88+Er8=; b=RNxlNec9JkI0fN5Ixbtw+7XQ2+itryI7/HghxMUDGz3UtUcwlFvPEDF8cN+j7V3nyBHgxw j4qmYXuazCVLQ9/jx1gD5Os2nXexRafqzoHO83IJr+eC7LGJLkKALT1c9cDK2xCd4DdFwU VS8e0Q9pLWozmU7DSqAwVLIGtgiqvvAkouOrKA36e6Avx6j+Fp6BOazNdKCGd+vO2A0kEb hIFcSthepLS4RSVg8ftPin8BClLCBd4HWTXSoo9gp0vUDsc9PSnmTJ1/QYU8BU29nwvyOm aXbFir8kj0sB20fVw0YtckYxVtz89bLfOgl+hAlKKpJRoFj342z6m7vGIiXNCw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1700835049; a=rsa-sha256; cv=none; b=qrFv1K4c5RmO7JLGUBAelMSQTHWNHQ/O6SUdulkE4O7ezj9ufUEHq+RX1vUAeSldjx01dq nBOafqsypNLXGDLMUXQYxftCeeF0XzLA9RlurIuKJuY2dQ4fv7cGB7KT9GM6ApAWeqL28B YuO6M2ZOCXISDD+beHbyIPJtzI/Ojl13M/YqD7pUlna3L4Cm9ScYbEyQr6lx3B9HT6dZUe qd8Jgux0zWDy4zsNjd3WSHYbkWJ1D9ngesDwn5p6pkYbvH+f7ij8vv/PDSkeck4K23YU6X BQ9PstvK1dRKFRedk4vOE1059vnb98TdLAK/1LssAna1UGEPtgz2ZRQZBq/d3Q== 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 4ScH2K46RDznqG; Fri, 24 Nov 2023 14:10:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3AOEAnWm025196; Fri, 24 Nov 2023 14:10:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3AOEAnVO025193; Fri, 24 Nov 2023 14:10:49 GMT (envelope-from git) Date: Fri, 24 Nov 2023 14:10:49 GMT Message-Id: <202311241410.3AOEAnVO025193@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: ad57a81170fc - stable/14 - pf: sctp heartbeats confirm a connection 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: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: ad57a81170fce9f638a6d57d60cb46362363dd1d Auto-Submitted: auto-generated The branch stable/14 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=ad57a81170fce9f638a6d57d60cb46362363dd1d commit ad57a81170fce9f638a6d57d60cb46362363dd1d Author: Kristof Provost AuthorDate: 2023-11-17 12:52:34 +0000 Commit: Kristof Provost CommitDate: 2023-11-24 09:20:45 +0000 pf: sctp heartbeats confirm a connection When we create a new state for multihomed sctp connections (i.e. based on INIT/INIT_ACK or ASCONF parameters) the new connection will never see a COOKIE/COOKIE_ACK exchange. We should consider HEARTBEAT_ACK to be a confirmation that the connection is established. This ensures that such connections do not time out earlier than expected. MFC after: 1 week Sponsored by: Orange Business Services (cherry picked from commit 7093414c63b08864dd9348f63e67b39a70c8b1be) --- sys/net/pfvar.h | 17 ++++++++++------- sys/netpfil/pf/pf.c | 2 +- sys/netpfil/pf/pf_norm.c | 10 +++++++++- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 15fa671ddcbe..27428ad161f8 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1580,13 +1580,16 @@ struct pf_pdesc { #define PFDESC_SCTP_INIT 0x0001 #define PFDESC_SCTP_INIT_ACK 0x0002 #define PFDESC_SCTP_COOKIE 0x0004 -#define PFDESC_SCTP_ABORT 0x0008 -#define PFDESC_SCTP_SHUTDOWN 0x0010 -#define PFDESC_SCTP_SHUTDOWN_COMPLETE 0x0020 -#define PFDESC_SCTP_DATA 0x0040 -#define PFDESC_SCTP_ASCONF 0x0080 -#define PFDESC_SCTP_OTHER 0x0100 -#define PFDESC_SCTP_ADD_IP 0x0200 +#define PFDESC_SCTP_COOKIE_ACK 0x0008 +#define PFDESC_SCTP_ABORT 0x0010 +#define PFDESC_SCTP_SHUTDOWN 0x0020 +#define PFDESC_SCTP_SHUTDOWN_COMPLETE 0x0040 +#define PFDESC_SCTP_DATA 0x0080 +#define PFDESC_SCTP_ASCONF 0x0100 +#define PFDESC_SCTP_HEARTBEAT 0x0200 +#define PFDESC_SCTP_HEARTBEAT_ACK 0x0400 +#define PFDESC_SCTP_OTHER 0x0800 +#define PFDESC_SCTP_ADD_IP 0x1000 u_int16_t sctp_flags; u_int32_t sctp_initiate_tag; diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 082987d34b07..84bd75276af7 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -5932,7 +5932,7 @@ pf_test_state_sctp(struct pf_kstate **state, struct pfi_kkif *kif, dst->scrub->pfss_v_tag = pd->sctp_initiate_tag; } - if (pd->sctp_flags & PFDESC_SCTP_COOKIE) { + if (pd->sctp_flags & (PFDESC_SCTP_COOKIE | PFDESC_SCTP_HEARTBEAT_ACK)) { if (src->state < SCTP_ESTABLISHED) { pf_set_protostate(*state, psrc, SCTP_ESTABLISHED); (*state)->timeout = PFTM_SCTP_ESTABLISHED; diff --git a/sys/netpfil/pf/pf_norm.c b/sys/netpfil/pf/pf_norm.c index 5f2b8e9d36ff..2625966a0278 100644 --- a/sys/netpfil/pf/pf_norm.c +++ b/sys/netpfil/pf/pf_norm.c @@ -2115,12 +2115,20 @@ pf_scan_sctp(struct mbuf *m, int ipoff, int off, struct pf_pdesc *pd, pd->sctp_flags |= PFDESC_SCTP_SHUTDOWN_COMPLETE; break; case SCTP_COOKIE_ECHO: - case SCTP_COOKIE_ACK: pd->sctp_flags |= PFDESC_SCTP_COOKIE; break; + case SCTP_COOKIE_ACK: + pd->sctp_flags |= PFDESC_SCTP_COOKIE_ACK; + break; case SCTP_DATA: pd->sctp_flags |= PFDESC_SCTP_DATA; break; + case SCTP_HEARTBEAT_REQUEST: + pd->sctp_flags |= PFDESC_SCTP_HEARTBEAT; + break; + case SCTP_HEARTBEAT_ACK: + pd->sctp_flags |= PFDESC_SCTP_HEARTBEAT_ACK; + break; case SCTP_ASCONF: pd->sctp_flags |= PFDESC_SCTP_ASCONF;