The branch main has been updated by rcm:

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

commit a5b1b2d2c5e585364809fdf8f165d6dc742faadb
Author:     R. Christian McDonald <[email protected]>
AuthorDate: 2026-10-04 12:06:10 +0000
Commit:     R. Christian McDonald <[email protected]>
CommitDate: 2026-10-04 12:06:10 +0000

    libpfctl: remove the state getters that do not take a handle
    
    Nothing in the tree calls any of the three.  Remove them rather than
    fix them: pfctl_get_states_h() does the same with the handle that the
    caller has.  pfctl_free_states(), struct pfctl_states and the list
    entry in struct pfctl_state were there for pfctl_get_states() alone,
    and go with it.
    
    Reviewed by:            kp
    Approved by:            kp (mentor)
    Fixes:                  2a478dfc7f9c ("libpfctl: retrieve family id only 
once")
    Sponsored by:           Rubicon Communications, LLC ("Netgate")
    Differential Revision:  https://reviews.freebsd.org/D60248
---
 lib/libpfctl/libpfctl.c | 66 -------------------------------------------------
 lib/libpfctl/libpfctl.h | 11 ---------
 2 files changed, 77 deletions(-)

diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c
index 65c1a77b4d87..097c4743da2c 100644
--- a/lib/libpfctl/libpfctl.c
+++ b/lib/libpfctl/libpfctl.c
@@ -2027,72 +2027,6 @@ out:
        return (ret);
 }
 
-int
-pfctl_get_states_iter(pfctl_get_state_fn f, void *arg)
-{
-       struct pfctl_state_filter filter = {};
-       return (pfctl_get_filtered_states_iter(&filter, f, arg));
-}
-
-int
-pfctl_get_filtered_states_iter(struct pfctl_state_filter *filter, 
pfctl_get_state_fn f, void *arg)
-{
-       struct pfctl_handle h = {};
-       int error;
-
-       snl_init(&h.ss, NETLINK_GENERIC);
-       error = pfctl_get_states_h(&h, filter, f, arg);
-       snl_free(&h.ss);
-
-       return (error);
-}
-
-static int
-pfctl_append_states(struct pfctl_state *s, void *arg)
-{
-       struct pfctl_state *new;
-       struct pfctl_states *states = (struct pfctl_states *)arg;
-
-       new = malloc(sizeof(*s));
-       if (new == NULL)
-               return (ENOMEM);
-
-       memcpy(new, s, sizeof(*s));
-
-       TAILQ_INSERT_TAIL(&states->states, new, entry);
-
-       return (0);
-}
-
-int
-pfctl_get_states(int dev __unused, struct pfctl_states *states)
-{
-       int ret;
-
-       bzero(states, sizeof(*states));
-       TAILQ_INIT(&states->states);
-
-       ret = pfctl_get_states_iter(pfctl_append_states, states);
-       if (ret != 0) {
-               pfctl_free_states(states);
-               return (ret);
-       }
-
-       return (0);
-}
-
-void
-pfctl_free_states(struct pfctl_states *states)
-{
-       struct pfctl_state *s, *tmp;
-
-       TAILQ_FOREACH_SAFE(s, &states->states, entry, tmp) {
-               free(s);
-       }
-
-       bzero(states, sizeof(*states));
-}
-
 struct pfctl_nl_clear_states {
        uint32_t killed;
 };
diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h
index ef73d0469236..850afd5eac47 100644
--- a/lib/libpfctl/libpfctl.h
+++ b/lib/libpfctl/libpfctl.h
@@ -369,8 +369,6 @@ struct pfctl_state_key {
 };
 
 struct pfctl_state {
-       TAILQ_ENTRY(pfctl_state)        entry;
-
        uint64_t                 id;
        uint32_t                 creatorid;
        uint8_t                  direction;
@@ -409,11 +407,6 @@ struct pfctl_state {
        struct pfctl_rule        created_by_rule;
 };
 
-TAILQ_HEAD(pfctl_statelist, pfctl_state);
-struct pfctl_states {
-       struct pfctl_statelist  states;
-};
-
 enum pfctl_syncookies_mode {
        PFCTL_SYNCOOKIES_NEVER,
        PFCTL_SYNCOOKIES_ALWAYS,
@@ -508,11 +501,7 @@ struct pfctl_state_filter {
        bool                    include_rule;
 };
 typedef int (*pfctl_get_state_fn)(struct pfctl_state *, void *);
-int pfctl_get_states_iter(pfctl_get_state_fn f, void *arg);
 int pfctl_get_states_h(struct pfctl_handle *h, struct pfctl_state_filter 
*filter, pfctl_get_state_fn f, void *arg);
-int pfctl_get_filtered_states_iter(struct pfctl_state_filter *filter, 
pfctl_get_state_fn f, void *arg);
-int    pfctl_get_states(int dev, struct pfctl_states *states);
-void   pfctl_free_states(struct pfctl_states *states);
 int    pfctl_clear_states(int dev, const struct pfctl_kill *kill,
            unsigned int *killed);
 int    pfctl_kill_states(int dev, const struct pfctl_kill *kill,

Reply via email to