diff options
Diffstat (limited to 'sys/net/pf_ioctl.c')
-rw-r--r-- | sys/net/pf_ioctl.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/sys/net/pf_ioctl.c b/sys/net/pf_ioctl.c index e5b930a978a..36779cfdfd3 100644 --- a/sys/net/pf_ioctl.c +++ b/sys/net/pf_ioctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf_ioctl.c,v 1.405 2023/05/26 12:13:26 kn Exp $ */ +/* $OpenBSD: pf_ioctl.c,v 1.406 2023/06/26 07:49:48 claudio Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -118,6 +118,7 @@ int pf_states_clr(struct pfioc_state_kill *); int pf_states_get(struct pfioc_states *); struct pf_trans *pf_open_trans(uint32_t); +void pf_close_all_trans(uint32_t); struct pf_trans *pf_find_trans(uint32_t, uint64_t); void pf_free_trans(struct pf_trans *); void pf_rollback_trans(struct pf_trans *); @@ -1491,6 +1492,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) PF_UNLOCK(); NET_UNLOCK(); + pf_close_all_trans(minor(dev)); t = pf_open_trans(minor(dev)); pf_init_tgetrule(t, ruleset->anchor, ruleset_version, rule); pr->ticket = t->pft_ticket; @@ -3273,6 +3275,19 @@ pf_open_trans(uint32_t unit) return (t); } +void +pf_close_all_trans(uint32_t unit) +{ + struct pf_trans *t, *nt; + + rw_assert_wrlock(&pfioctl_rw); + + LIST_FOREACH_SAFE(t, &pf_ioctl_trans, pft_entry, nt) { + if (t->pft_unit == unit) + pf_rollback_trans(t); + } +} + struct pf_trans * pf_find_trans(uint32_t unit, uint64_t ticket) { |