From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 11:46:56 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2E9D865E180; Tue, 27 Jul 2021 11:46:56 +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 4GYw4Z3ZPqz3sKD; Tue, 27 Jul 2021 11:46:54 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 7A0501C41; Tue, 27 Jul 2021 11:46: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 16RBkrWc068060; Tue, 27 Jul 2021 11:46:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RBkr1O068059; Tue, 27 Jul 2021 11:46:53 GMT (envelope-from git) Date: Tue, 27 Jul 2021 11:46:53 GMT Message-Id: <202107271146.16RBkr1O068059@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: fbef5f8f7e85 - stable/12 - pf: clean up syncookie callout on vnet shutdown 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/12 X-Git-Reftype: branch X-Git-Commit: fbef5f8f7e8506890c81a7a1c72cab587e9205e7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 11:46:56 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=fbef5f8f7e8506890c81a7a1c72cab587e9205e7 commit fbef5f8f7e8506890c81a7a1c72cab587e9205e7 Author: Kristof Provost AuthorDate: 2021-07-20 19:03:08 +0000 Commit: Kristof Provost CommitDate: 2021-07-27 11:24:27 +0000 pf: clean up syncookie callout on vnet shutdown Ensure that we cancel any outstanding callouts for syncookies when we terminate the vnet. MFC after: 1 week Sponsored by: Modirum MDPay (cherry picked from commit 32271c4d383effeac7878201ef5cbdfaeedc3755) --- sys/net/pfvar.h | 1 + sys/netpfil/pf/pf_ioctl.c | 1 + sys/netpfil/pf/pf_syncookies.c | 6 ++++++ 3 files changed, 8 insertions(+) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index d072eedd3621..7d31e4ce21a0 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1842,6 +1842,7 @@ void pf_send_tcp(const struct pf_krule *, sa_family_t, u_int16_t); void pf_syncookies_init(void); +void pf_syncookies_cleanup(void); int pf_get_syncookies(struct pfioc_nv *); int pf_set_syncookies(struct pfioc_nv *); int pf_synflood_check(struct pf_pdesc *); diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index dde2aecc8ef5..a3026d394bde 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -5633,6 +5633,7 @@ pf_unload_vnet(void) } PF_RULES_WLOCK(); + pf_syncookies_cleanup(); shutdown_pf(); PF_RULES_WUNLOCK(); diff --git a/sys/netpfil/pf/pf_syncookies.c b/sys/netpfil/pf/pf_syncookies.c index 43d3a0a0b036..bfcc4b3d4e82 100644 --- a/sys/netpfil/pf/pf_syncookies.c +++ b/sys/netpfil/pf/pf_syncookies.c @@ -127,6 +127,12 @@ pf_syncookies_init(void) PF_RULES_WUNLOCK(); } +void +pf_syncookies_cleanup(void) +{ + callout_stop(&V_pf_syncookie_status.keytimeout); +} + int pf_get_syncookies(struct pfioc_nv *nv) {