Hi,

So here is the result of the pf unlink bikeshedding.  Rename
pf_unlink_state() to pf_remove_state() so the name does not collide
with the statekey to inp unlinking.

ok?

bluhm

Index: net/if_pfsync.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/net/if_pfsync.c,v
retrieving revision 1.222
diff -u -p -r1.222 if_pfsync.c
--- net/if_pfsync.c     10 Nov 2015 06:36:14 -0000      1.222
+++ net/if_pfsync.c     2 Dec 2015 21:29:09 -0000
@@ -752,7 +752,7 @@ pfsync_in_clr(caddr_t buf, int len, int 
                        if (st->creatorid == creatorid &&
                            ((kif && st->kif == kif) || !kif)) {
                                SET(st->state_flags, PFSTATE_NOSYNC);
-                               pf_unlink_state(st);
+                               pf_remove_state(st);
                        }
                }
        }
@@ -1056,7 +1056,7 @@ pfsync_in_del(caddr_t buf, int len, int 
                        continue;
                }
                SET(st->state_flags, PFSTATE_NOSYNC);
-               pf_unlink_state(st);
+               pf_remove_state(st);
        }
 
        return (0);
@@ -1083,7 +1083,7 @@ pfsync_in_del_c(caddr_t buf, int len, in
                }
 
                SET(st->state_flags, PFSTATE_NOSYNC);
-               pf_unlink_state(st);
+               pf_remove_state(st);
        }
 
        return (0);
Index: net/pf.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/net/pf.c,v
retrieving revision 1.954
diff -u -p -r1.954 pf.c
--- net/pf.c    2 Dec 2015 16:00:42 -0000       1.954
+++ net/pf.c    2 Dec 2015 21:29:09 -0000
@@ -668,7 +668,7 @@ pf_state_key_attach(struct pf_state_key 
                                    si->s->dst.state >= TCPS_FIN_WAIT_2) {
                                        si->s->src.state = si->s->dst.state =
                                            TCPS_CLOSED;
-                                       /* unlink late or sks can go away */
+                                       /* remove late or sks can go away */
                                        olds = si->s;
                                } else {
                                        if (pf_status.debug >= LOG_NOTICE) {
@@ -713,7 +713,7 @@ pf_state_key_attach(struct pf_state_key 
                TAILQ_INSERT_HEAD(&s->key[idx]->states, si, entry);
 
        if (olds)
-               pf_unlink_state(olds);
+               pf_remove_state(olds);
 
        return (0);
 }
@@ -1249,7 +1249,7 @@ pf_src_tree_remove_state(struct pf_state
 
 /* callers should be at splsoftnet */
 void
-pf_unlink_state(struct pf_state *cur)
+pf_remove_state(struct pf_state *cur)
 {
        splsoftassert(IPL_SOFTNET);
 
@@ -1280,14 +1280,14 @@ pf_unlink_state(struct pf_state *cur)
 }
 
 void
-pf_unlink_divert_state(struct pf_state_key *sk)
+pf_remove_divert_state(struct pf_state_key *sk)
 {
        struct pf_state_item    *si;
 
        TAILQ_FOREACH(si, &sk->states, entry) {
                if (sk == si->s->key[PF_SK_STACK] && si->s->rule.ptr &&
                    si->s->rule.ptr->divert.port) {
-                       pf_unlink_state(si->s);
+                       pf_remove_state(si->s);
                        break;
                }
        }
@@ -1349,15 +1349,15 @@ pf_purge_expired_states(u_int32_t maxche
                next = TAILQ_NEXT(cur, entry_list);
 
                if (cur->timeout == PFTM_UNLINKED) {
-                       /* free unlinked state */
+                       /* free removed state */
                        if (! locked) {
                                rw_enter_write(&pf_consistency_lock);
                                locked = 1;
                        }
                        pf_free_state(cur);
                } else if (pf_state_expires(cur) <= time_uptime) {
-                       /* unlink and free expired state */
-                       pf_unlink_state(cur);
+                       /* remove and free expired state */
+                       pf_remove_state(cur);
                        if (! locked) {
                                rw_enter_write(&pf_consistency_lock);
                                locked = 1;
@@ -4346,7 +4346,7 @@ pf_test_state(struct pf_pdesc *pd, struc
                        }
                        /* XXX make sure it's the same direction ?? */
                        (*state)->src.state = (*state)->dst.state = TCPS_CLOSED;
-                       pf_unlink_state(*state);
+                       pf_remove_state(*state);
                        *state = NULL;
                        pd->m->m_pkthdr.pf.inp = inp;
                        return (PF_DROP);
Index: net/pf_ioctl.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/net/pf_ioctl.c,v
retrieving revision 1.294
diff -u -p -r1.294 pf_ioctl.c
--- net/pf_ioctl.c      24 Nov 2015 13:37:16 -0000      1.294
+++ net/pf_ioctl.c      2 Dec 2015 21:29:09 -0000
@@ -1430,7 +1430,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t a
                                /* don't send out individual delete messages */
                                SET(s->state_flags, PFSTATE_NOSYNC);
 #endif /* NPFSYNC > 0 */
-                               pf_unlink_state(s);
+                               pf_remove_state(s);
                                killed++;
                        }
                }
@@ -1453,7 +1453,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t a
                        if (psk->psk_pfcmp.creatorid == 0)
                                psk->psk_pfcmp.creatorid = pf_status.hostid;
                        if ((s = pf_find_state_byid(&psk->psk_pfcmp))) {
-                               pf_unlink_state(s);
+                               pf_remove_state(s);
                                psk->psk_killed = 1;
                        }
                        break;
@@ -1499,7 +1499,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t a
                            !strcmp(psk->psk_label, s->rule.ptr->label))) &&
                            (!psk->psk_ifname[0] || !strcmp(psk->psk_ifname,
                            s->kif->pfik_name))) {
-                               pf_unlink_state(s);
+                               pf_remove_state(s);
                                killed++;
                        }
                }
Index: net/pfvar.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/net/pfvar.h,v
retrieving revision 1.424
diff -u -p -r1.424 pfvar.h
--- net/pfvar.h 2 Dec 2015 16:00:42 -0000       1.424
+++ net/pfvar.h 2 Dec 2015 21:29:09 -0000
@@ -1669,8 +1669,8 @@ extern struct pool                 pf_state_scrub_pl;
 extern void                     pf_purge_thread(void *);
 extern void                     pf_purge_expired_src_nodes(int);
 extern void                     pf_purge_expired_states(u_int32_t);
-extern void                     pf_unlink_state(struct pf_state *);
-extern void                     pf_unlink_divert_state(struct pf_state_key *);
+extern void                     pf_remove_state(struct pf_state *);
+extern void                     pf_remove_divert_state(struct pf_state_key *);
 extern void                     pf_free_state(struct pf_state *);
 extern int                      pf_state_insert(struct pfi_kif *,
                                    struct pf_state_key **,
Index: netinet/in_pcb.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/in_pcb.c,v
retrieving revision 1.189
diff -u -p -r1.189 in_pcb.c
--- netinet/in_pcb.c    2 Dec 2015 16:00:42 -0000       1.189
+++ netinet/in_pcb.c    2 Dec 2015 21:29:09 -0000
@@ -507,8 +507,8 @@ in_pcbdetach(struct inpcb *inp)
                ip_freemoptions(inp->inp_moptions);
 #if NPF > 0
        if (inp->inp_pf_sk) {
-               pf_unlink_divert_state(inp->inp_pf_sk);
-               /* pf_unlink_divert_state() may have detached the state */
+               pf_remove_divert_state(inp->inp_pf_sk);
+               /* pf_remove_divert_state() may have detached the state */
                if (inp->inp_pf_sk)
                        inp->inp_pf_sk->inp = NULL;
        }

Reply via email to