Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Jul 2021 11:46:52 GMT
From:      Kristof Provost <kp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 7d226e964ab7 - stable/13 - pf: clean up syncookie callout on vnet shutdown
Message-ID:  <202107271146.16RBkqGC068035@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=7d226e964ab78c704c9eec40daa95a4c6ab1b323

commit 7d226e964ab78c704c9eec40daa95a4c6ab1b323
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2021-07-20 19:03:08 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
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)
 {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202107271146.16RBkqGC068035>