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 4ScH2L119Lz52b3y; Fri, 24 Nov 2023 14:10:50 +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 4ScH2K6kT9z3fyt; 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=1700835050; 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=ZZd7RFUIwpZwQwZ+22WsqJETzj4gtd9XSf+RuC451lE=; b=unZE/piXL+YSxgTH/iIh3nAfRYcTpHh3a4eqH/5XiU5vvMoPbhAyi4yssy0Ro6hHsuJM8R +ZuAR8Dym3AFNRvPUTeV2Be6NPKJ01VyqZ5j5yOIK2HO9ZwqdKY3sZvS6sEjD+/E+4m0Ga p0uWmM2e3+DF/y/i4zyTsB+Hc4h9A9s5wDonWoxH/KPIrVhbymG9TAkxePAr7z9z2Y8lzZ gd2VtPMaG3AFJTtUCNaQqThQ0DnsAZjh3NJSEu66j1P2GvoQjQAkbpji58TBQJiV6cbQpS 9mmWt1zsy2+JRSdGvgNkrOu3SZXgekEN9/DXNWjF06AVQockhF2w0NO4hpPfeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700835050; 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=ZZd7RFUIwpZwQwZ+22WsqJETzj4gtd9XSf+RuC451lE=; b=B05Kk5mLQ0CgC+Sre4ayJcNsRsl3PVYGLqeMpLwMAx1+Okw+XEH3h2hE2bPASF5UrXElMH 5111gelqk+6GJK4a1TEOSTf5lyg7D94iOFO6HeetUhsRKvPb+u3oHHuPQxlSvcxXPLhz5E zaODReQLvQty1f+q8bcsz4rcOtwsMPlrzj6qsCzGTGBSNncFSu03ppmrJ2/iGe8LUaT+JN 8va4Xgz67tvk6fWCTRP6UNVJg/OJakTPTANrTxwoWFsti7ng7CqG2ickVrpteB4zUZ0z5h dCGW39nZSNr0/KocYBcqPQzWdYL9/w9zQggDAz9GAHJPGvFvGJdostye3rrm+w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1700835050; a=rsa-sha256; cv=none; b=rG4+vlwi43Fr1eK5vgidU9NIlMz/uVV2+Ha9LUop6Lmt+nb1ZmYmLwjFXF0OXjpRuUFPaK eQiTLSsMO9nNCztCeG3cnvpXyN3LT8rB9XdGvC0ezdXHC+VDde23APu8bnTXVQMPh+63J7 bpUTITTAxpDUXIBYAYGXG3piYSmeikNI9nrCVf2h+G1S07KZ/hRQGbJOitd69WEtfSaMsx wqDq7hQWvmS8Ycy/2P7G52dUiEapuWwK6nC1KsnEAZJ+Jm89eBeYnCgvrOS01FOAEcdEsL Cwpv6jDprKTftjqyB8WeMrsSAE7V3izFUMorG1t0SVPSsaQkE7xhNHi7crMQpQ== 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 4ScH2K5fp3zn1x; 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 3AOEAnxc025241; 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 3AOEAn1H025238; Fri, 24 Nov 2023 14:10:49 GMT (envelope-from git) Date: Fri, 24 Nov 2023 14:10:49 GMT Message-Id: <202311241410.3AOEAn1H025238@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: c5abe31a4f7d - stable/13 - 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/13 X-Git-Reftype: branch X-Git-Commit: c5abe31a4f7d8d518c5d25ebed3127d23e2b1c89 Auto-Submitted: auto-generated The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=c5abe31a4f7d8d518c5d25ebed3127d23e2b1c89 commit c5abe31a4f7d8d518c5d25ebed3127d23e2b1c89 Author: Kristof Provost AuthorDate: 2023-11-17 12:52:34 +0000 Commit: Kristof Provost CommitDate: 2023-11-24 09:20:42 +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 9c6f5bccae02..11bde6224eb3 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1329,13 +1329,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 278c1db118cf..c09f80d2f82b 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -5341,7 +5341,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 071387c12983..d1ffa21d7873 100644 --- a/sys/netpfil/pf/pf_norm.c +++ b/sys/netpfil/pf/pf_norm.c @@ -2084,12 +2084,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;