git: 8f3d786cb301 - main - pf: remove the flags argument from pf_unlink_state
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 01 Nov 2021 20:00:18 UTC
The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=8f3d786cb301c49dec189bad80cdc163dd3ca1d7 commit 8f3d786cb301c49dec189bad80cdc163dd3ca1d7 Author: Mateusz Guzik <mjg@FreeBSD.org> AuthorDate: 2021-11-01 13:14:02 +0000 Commit: Mateusz Guzik <mjg@FreeBSD.org> CommitDate: 2021-11-01 19:59:14 +0000 pf: remove the flags argument from pf_unlink_state All consumers call it with PF_ENTER_LOCKED. Reviewed by: kp Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/net/pfvar.h | 4 +--- sys/netpfil/pf/if_pfsync.c | 6 +++--- sys/netpfil/pf/pf.c | 11 ++++------- sys/netpfil/pf/pf_ioctl.c | 10 +++++----- 4 files changed, 13 insertions(+), 18 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 9fa1da8b5c07..e9277dce4963 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1915,9 +1915,7 @@ extern void pf_unload_vnet_purge(void); extern void pf_intr(void *); extern void pf_purge_expired_src_nodes(void); -extern int pf_unlink_state(struct pf_kstate *, u_int); -#define PF_ENTER_LOCKED 0x00000001 -#define PF_RETURN_LOCKED 0x00000002 +extern int pf_unlink_state(struct pf_kstate *); extern int pf_state_insert(struct pfi_kkif *, struct pfi_kkif *, struct pf_state_key *, diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c index e959fdbc8553..1aa5e6c0b066 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -759,7 +759,7 @@ relock: LIST_FOREACH(s, &ih->states, entry) { if (s->creatorid == creatorid) { s->state_flags |= PFSTATE_NOSYNC; - pf_unlink_state(s, PF_ENTER_LOCKED); + pf_unlink_state(s); goto relock; } } @@ -1118,7 +1118,7 @@ pfsync_in_del(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count) continue; } st->state_flags |= PFSTATE_NOSYNC; - pf_unlink_state(st, PF_ENTER_LOCKED); + pf_unlink_state(st); } return (len); @@ -1150,7 +1150,7 @@ pfsync_in_del_c(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count) } st->state_flags |= PFSTATE_NOSYNC; - pf_unlink_state(st, PF_ENTER_LOCKED); + pf_unlink_state(st); } return (len); diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index d7644b47f700..9595650dbc36 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -1995,14 +1995,11 @@ pf_src_tree_remove_state(struct pf_kstate *s) * unlocked, since it needs to go through key hash locking. */ int -pf_unlink_state(struct pf_kstate *s, u_int flags) +pf_unlink_state(struct pf_kstate *s) { struct pf_idhash *ih = &V_pf_idhash[PF_IDHASH(s)]; - if ((flags & PF_ENTER_LOCKED) == 0) - PF_HASHROW_LOCK(ih); - else - PF_HASHROW_ASSERT(ih); + PF_HASHROW_ASSERT(ih); if (s->timeout == PFTM_UNLINKED) { /* @@ -2091,7 +2088,7 @@ relock: LIST_FOREACH(s, &ih->states, entry) { if (pf_state_expires(s) <= time_uptime) { V_pf_status.states -= - pf_unlink_state(s, PF_ENTER_LOCKED); + pf_unlink_state(s); goto relock; } s->rule.ptr->rule_ref |= PFRULE_REFS; @@ -4992,7 +4989,7 @@ pf_test_state_tcp(struct pf_kstate **state, int direction, struct pfi_kkif *kif, } /* XXX make sure it's the same direction ?? */ pf_set_protostate(*state, PF_PEER_BOTH, TCPS_CLOSED); - pf_unlink_state(*state, PF_ENTER_LOCKED); + pf_unlink_state(*state); *state = NULL; return (PF_DROP); } diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 1cfedf19e662..727ebb0135f4 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -2041,7 +2041,7 @@ pf_kill_matching_state(struct pf_state_key_cmp *key, int dir) return (0); } - pf_unlink_state(s, PF_ENTER_LOCKED); + pf_unlink_state(s); return (1); } @@ -2138,7 +2138,7 @@ relock_DIOCKILLSTATES: match_key.port[1] = s->key[idx]->port[0]; } - pf_unlink_state(s, PF_ENTER_LOCKED); + pf_unlink_state(s); killed++; if (psk->psk_kill_match) @@ -5040,7 +5040,7 @@ relock: s->timeout = PFTM_PURGE; /* Don't send out individual delete messages. */ s->state_flags |= PFSTATE_NOSYNC; - pf_unlink_state(s, PF_ENTER_LOCKED); + pf_unlink_state(s); goto relock; } PF_HASHROW_UNLOCK(ih); @@ -5227,7 +5227,7 @@ relock_DIOCCLRSTATES: * delete messages. */ s->state_flags |= PFSTATE_NOSYNC; - pf_unlink_state(s, PF_ENTER_LOCKED); + pf_unlink_state(s); killed++; if (kill->psk_kill_match) @@ -5255,7 +5255,7 @@ pf_killstates(struct pf_kstate_kill *kill, unsigned int *killed) kill->psk_pfcmp.creatorid = V_pf_status.hostid; if ((s = pf_find_state_byid(kill->psk_pfcmp.id, kill->psk_pfcmp.creatorid))) { - pf_unlink_state(s, PF_ENTER_LOCKED); + pf_unlink_state(s); *killed = 1; } return;