move pf_state_item and pf_state_key structs from pfvar.h to pfvar_priv.h.
authordlg <dlg@openbsd.org>
Mon, 19 Dec 2022 04:35:33 +0000 (04:35 +0000)
committerdlg <dlg@openbsd.org>
Mon, 19 Dec 2022 04:35:33 +0000 (04:35 +0000)
both of these are kernel private data structures and do not need
to be visible to userland. moving them to pfvar_priv.h makes this
explicit, and makes it leass scary to tweak them in the future.

ok deraadt@ kn@ sashan@

sys/net/pfvar.h
sys/net/pfvar_priv.h

index d547bef..52d18b4 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: pfvar.h,v 1.522 2022/12/16 02:05:44 dlg Exp $ */
+/*     $OpenBSD: pfvar.h,v 1.523 2022/12/19 04:35:33 dlg Exp $ */
 
 /*
  * Copyright (c) 2001 Daniel Hartmeier
@@ -708,31 +708,6 @@ struct pf_state_key_cmp {
        u_int8_t         proto;
 };
 
-struct pf_state_item {
-       TAILQ_ENTRY(pf_state_item)       entry;
-       struct pf_state                 *s;
-};
-
-TAILQ_HEAD(pf_statelisthead, pf_state_item);
-
-struct pf_state_key {
-       struct pf_addr   addr[2];
-       u_int16_t        port[2];
-       u_int16_t        rdomain;
-       sa_family_t      af;
-       u_int8_t         proto;
-
-       RB_ENTRY(pf_state_key)   entry;
-       struct pf_statelisthead  states;
-       struct pf_state_key     *reverse;
-       struct inpcb            *inp;
-       pf_refcnt_t              refcnt;
-       u_int8_t                 removed;
-};
-#define PF_REVERSED_KEY(key, family)                           \
-       ((key[PF_SK_WIRE]->af != key[PF_SK_STACK]->af) &&       \
-        (key[PF_SK_WIRE]->af != (family)))
-
 /* keep synced with struct pf_state, used in RB_FIND */
 struct pf_state_cmp {
        u_int64_t                id;
index 81e26c9..b9114c3 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: pfvar_priv.h,v 1.24 2022/12/16 02:05:45 dlg Exp $     */
+/*     $OpenBSD: pfvar_priv.h,v 1.25 2022/12/19 04:35:34 dlg Exp $     */
 
 /*
  * Copyright (c) 2001 Daniel Hartmeier
 #include <sys/rwlock.h>
 #include <sys/mutex.h>
 
+struct pf_state_item {
+       TAILQ_ENTRY(pf_state_item)       entry;
+       struct pf_state                 *s;
+};
+
+TAILQ_HEAD(pf_statelisthead, pf_state_item);
+
+struct pf_state_key {
+       struct pf_addr   addr[2];
+       u_int16_t        port[2];
+       u_int16_t        rdomain;
+       sa_family_t      af;
+       u_int8_t         proto;
+
+       RB_ENTRY(pf_state_key)   entry;
+       struct pf_statelisthead  states;
+       struct pf_state_key     *reverse;
+       struct inpcb            *inp;
+       pf_refcnt_t              refcnt;
+       u_int8_t                 removed;
+};
+#define PF_REVERSED_KEY(key, family)                           \
+       ((key[PF_SK_WIRE]->af != key[PF_SK_STACK]->af) &&       \
+        (key[PF_SK_WIRE]->af != (family)))
+
 /*
  * Protection/ownership of pf_state members:
  *     I       immutable after pf_state_insert()