From owner-dev-commits-src-branches@freebsd.org Tue Jul 27 11:46:54 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 4087465E124; Tue, 27 Jul 2021 11:46:54 +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 4GYw4Y6cL5z3s6G; Tue, 27 Jul 2021 11:46:53 +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 0CF591C40; 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 16RBkqcg068036; Tue, 27 Jul 2021 11:46:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16RBkqGC068035; Tue, 27 Jul 2021 11:46:52 GMT (envelope-from git) Date: Tue, 27 Jul 2021 11:46:52 GMT Message-Id: <202107271146.16RBkqGC068035@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: 7d226e964ab7 - stable/13 - 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/13 X-Git-Reftype: branch X-Git-Commit: 7d226e964ab78c704c9eec40daa95a4c6ab1b323 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:54 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=7d226e964ab78c704c9eec40daa95a4c6ab1b323 commit 7d226e964ab78c704c9eec40daa95a4c6ab1b323 Author: Kristof Provost AuthorDate: 2021-07-20 19:03:08 +0000 Commit: Kristof Provost CommitDate: 2021-07-27 07:45:41 +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 b4a788436147..e54e734dcecf 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1841,6 +1841,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 96eb31b00ffb..6af5197ef07d 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -5574,6 +5574,7 @@ pf_unload_vnet(void) dehook_pf(); 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 0313b817ad6d..8699ae855ec8 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) {