From ea6432cfa3c4c56406de5b0060640f9023c210aa Mon Sep 17 00:00:00 2001 From: Kristof Provost Date: Wed, 9 Apr 2025 17:36:16 +0200 Subject: [PATCH] pf: rename pf_unlink_state() to pf_remove_state() The OpenBSD rationale ('so the name does not collide with the statekey to inp unlinking') doesn't apply to us, but it makes future imports easier if we follow this rename. Obtained from: OpenBSD, bluhm , acb93c8a64 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/net/pfvar.h | 2 +- sys/netpfil/pf/if_pfsync.c | 4 ++-- sys/netpfil/pf/pf.c | 14 +++++++------- sys/netpfil/pf/pf_ioctl.c | 10 +++++----- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 74926581e24..e3a8412bde7 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -2331,7 +2331,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 *); +extern int pf_remove_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 b2aaf3add25..0795c75e8de 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -1051,7 +1051,7 @@ pfsync_in_clr(struct mbuf *m, int offset, int count, int flags, int action) LIST_FOREACH(s, &ih->states, entry) { if (s->creatorid == creatorid) { s->state_flags |= PFSTATE_NOSYNC; - pf_unlink_state(s); + pf_remove_state(s); goto relock; } } @@ -1440,7 +1440,7 @@ pfsync_in_del_c(struct mbuf *m, int offset, int count, int flags, int action) } st->state_flags |= PFSTATE_NOSYNC; - pf_unlink_state(st); + pf_remove_state(st); } return (len); diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index d05469ad959..fdd412a9213 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -1910,7 +1910,7 @@ pf_find_state(struct pfi_kkif *kif, const struct pf_state_key_cmp *key, if (__predict_false(s->timeout >= PFTM_MAX)) { /* * State is either being processed by - * pf_unlink_state() in an other thread, or + * pf_remove_state() in an other thread, or * is scheduled for immediate expiry. */ PF_STATE_UNLOCK(s); @@ -1930,7 +1930,7 @@ pf_find_state(struct pfi_kkif *kif, const struct pf_state_key_cmp *key, if (__predict_false(s->timeout >= PFTM_MAX)) { /* * State is either being processed by - * pf_unlink_state() in an other thread, or + * pf_remove_state() in an other thread, or * is scheduled for immediate expiry. */ PF_STATE_UNLOCK(s); @@ -2730,7 +2730,7 @@ 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) +pf_remove_state(struct pf_kstate *s) { struct pf_idhash *ih = &V_pf_idhash[PF_IDHASH(s)]; @@ -2740,7 +2740,7 @@ pf_unlink_state(struct pf_kstate *s) if (s->timeout == PFTM_UNLINKED) { /* * State is being processed - * by pf_unlink_state() in + * by pf_remove_state() in * an other thread. */ PF_HASHROW_UNLOCK(ih); @@ -2837,7 +2837,7 @@ pf_purge_expired_states(u_int i, int maxcheck) LIST_FOREACH(s, &ih->states, entry) { if (pf_state_expires(s) <= time_uptime) { V_pf_status.states -= - pf_unlink_state(s); + pf_remove_state(s); goto relock; } s->rule->rule_ref |= PFRULE_REFS; @@ -6982,7 +6982,7 @@ pf_test_state(struct pf_kstate **state, struct pf_pdesc *pd, u_short *reason) } /* XXX make sure it's the same direction ?? */ pf_set_protostate(*state, PF_PEER_BOTH, TCPS_CLOSED); - pf_unlink_state(*state); + pf_remove_state(*state); *state = NULL; return (PF_DROP); } @@ -7019,7 +7019,7 @@ pf_test_state(struct pf_kstate **state, struct pf_pdesc *pd, u_short *reason) (dst->state >= SCTP_SHUTDOWN_SENT || dst->state == SCTP_CLOSED) && pd->sctp_flags & PFDESC_SCTP_INIT) { pf_set_protostate(*state, PF_PEER_BOTH, SCTP_CLOSED); - pf_unlink_state(*state); + pf_remove_state(*state); *state = NULL; return (PF_DROP); } diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 45e6e9f0bb9..3ee5173c131 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -2296,7 +2296,7 @@ pf_kill_matching_state(struct pf_state_key_cmp *key, int dir) return (0); } - pf_unlink_state(s); + pf_remove_state(s); return (1); } @@ -2393,7 +2393,7 @@ pf_killstates_row(struct pf_kstate_kill *psk, struct pf_idhash *ih) match_key.port[1] = s->key[idx]->port[0]; } - pf_unlink_state(s); + pf_remove_state(s); killed++; if (psk->psk_kill_match) @@ -5963,7 +5963,7 @@ pf_clear_all_states(void) s->timeout = PFTM_PURGE; /* Don't send out individual delete messages. */ s->state_flags |= PFSTATE_NOSYNC; - pf_unlink_state(s); + pf_remove_state(s); goto relock; } PF_HASHROW_UNLOCK(ih); @@ -6121,7 +6121,7 @@ pf_clear_states(const struct pf_kstate_kill *kill) * delete messages. */ s->state_flags |= PFSTATE_NOSYNC; - pf_unlink_state(s); + pf_remove_state(s); killed++; if (kill->psk_kill_match) @@ -6150,7 +6150,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_remove_state(s); *killed = 1; } return;