diff options
-rw-r--r-- | sys/net/if_pfsync.c | 6 | ||||
-rw-r--r-- | sys/net/pf.c | 16 | ||||
-rw-r--r-- | sys/net/pf_ioctl.c | 12 | ||||
-rw-r--r-- | sys/net/pfvar.h | 55 |
4 files changed, 42 insertions, 47 deletions
diff --git a/sys/net/if_pfsync.c b/sys/net/if_pfsync.c index 57fe7b14060..7d807d40ff0 100644 --- a/sys/net/if_pfsync.c +++ b/sys/net/if_pfsync.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pfsync.c,v 1.80 2007/06/21 11:55:54 henning Exp $ */ +/* $OpenBSD: if_pfsync.c,v 1.81 2007/06/24 11:17:13 mcbride Exp $ */ /* * Copyright (c) 2002 Michael Shalayeff @@ -1183,7 +1183,7 @@ pfsync_pack_state(u_int8_t action, struct pf_state *st, int flags) bcopy(&st->id, sp->id, sizeof(sp->id)); sp->creatorid = st->creatorid; - strlcpy(sp->ifname, st->u.s.kif->pfik_name, sizeof(sp->ifname)); + strlcpy(sp->ifname, st->kif->pfik_name, sizeof(sp->ifname)); pf_state_host_hton(&sk->lan, &sp->lan); pf_state_host_hton(&sk->gwy, &sp->gwy); pf_state_host_hton(&sk->ext, &sp->ext); @@ -1437,7 +1437,7 @@ pfsync_bulk_update(void *v) } /* figure next state to send */ - state = TAILQ_NEXT(state, u.s.entry_list); + state = TAILQ_NEXT(state, entry_list); /* wrap to start of list if we hit the end */ if (!state) diff --git a/sys/net/pf.c b/sys/net/pf.c index e0359d449b3..31f86c2754c 100644 --- a/sys/net/pf.c +++ b/sys/net/pf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf.c,v 1.546 2007/06/21 11:55:54 henning Exp $ */ +/* $OpenBSD: pf.c,v 1.547 2007/06/24 11:17:13 mcbride Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -545,7 +545,7 @@ pf_find_state(struct pfi_kif *kif, struct pf_state_key_cmp *key, u_int8_t tree) /* list is sorted, if-bound states before floating ones */ if (sk != NULL) TAILQ_FOREACH(s, &sk->states, next) - if (s->u.s.kif == pfi_all || s->u.s.kif == kif) + if (s->kif == pfi_all || s->kif == kif) return (s); return (NULL); @@ -819,13 +819,13 @@ pf_insert_state(struct pfi_kif *kif, struct pf_state *s) struct pf_state *sp; KASSERT(s->state_key != NULL); - s->u.s.kif = kif; + s->kif = kif; if ((cur = RB_INSERT(pf_state_tree_lan_ext, &pfi_all->pfik_lan_ext, s->state_key)) != NULL) { /* key exists. check for same kif, if none, add to key */ TAILQ_FOREACH(sp, &cur->states, next) - if (sp->u.s.kif == kif) { /* collision! */ + if (sp->kif == kif) { /* collision! */ pf_stateins_err("tree_lan_ext", s, kif); return (-1); } @@ -858,7 +858,7 @@ pf_insert_state(struct pfi_kif *kif, struct pf_state *s) pf_detach_state(s, 0); return (-1); } - TAILQ_INSERT_TAIL(&state_list, s, u.s.entry_list); + TAILQ_INSERT_TAIL(&state_list, s, entry_list); pf_status.fcounters[FCNT_STATE_INSERT]++; pf_status.states++; pfi_kif_ref(kif, PFI_KIF_REF_STATE); @@ -1037,8 +1037,8 @@ pf_free_state(struct pf_state *cur) if (--cur->anchor.ptr->states <= 0) pf_rm_rule(NULL, cur->anchor.ptr); pf_normalize_tcp_cleanup(cur); - pfi_kif_unref(cur->u.s.kif, PFI_KIF_REF_STATE); - TAILQ_REMOVE(&state_list, cur, u.s.entry_list); + pfi_kif_unref(cur->kif, PFI_KIF_REF_STATE); + TAILQ_REMOVE(&state_list, cur, entry_list); if (cur->tag) pf_tag_unref(cur->tag); pool_put(&pf_state_pl, cur); @@ -1062,7 +1062,7 @@ pf_purge_expired_states(u_int32_t maxcheck) } /* get next state, as cur may get deleted */ - next = TAILQ_NEXT(cur, u.s.entry_list); + next = TAILQ_NEXT(cur, entry_list); if (cur->timeout == PFTM_UNLINKED) { /* free unlinked state */ diff --git a/sys/net/pf_ioctl.c b/sys/net/pf_ioctl.c index 807ef1bf47e..3f0cff348b2 100644 --- a/sys/net/pf_ioctl.c +++ b/sys/net/pf_ioctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf_ioctl.c,v 1.181 2007/06/21 19:31:49 henning Exp $ */ +/* $OpenBSD: pf_ioctl.c,v 1.182 2007/06/24 11:17:13 mcbride Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -864,7 +864,7 @@ pf_state_export(struct pfsync_state *sp, struct pf_state_key *sk, /* copy from state */ memcpy(&sp->id, &s->id, sizeof(sp->id)); sp->creatorid = s->creatorid; - strlcpy(sp->ifname, s->u.s.kif->pfik_name, sizeof(sp->ifname)); + strlcpy(sp->ifname, s->kif->pfik_name, sizeof(sp->ifname)); pf_state_peer_to_pfsync(&s->src, &sp->src); pf_state_peer_to_pfsync(&s->dst, &sp->dst); @@ -912,7 +912,7 @@ pf_state_import(struct pfsync_state *sp, struct pf_state_key *sk, /* copy to state */ memcpy(&s->id, &sp->id, sizeof(sp->id)); s->creatorid = sp->creatorid; - strlcpy(sp->ifname, s->u.s.kif->pfik_name, sizeof(sp->ifname)); + strlcpy(sp->ifname, s->kif->pfik_name, sizeof(sp->ifname)); pf_state_peer_from_pfsync(&sp->src, &s->src); pf_state_peer_from_pfsync(&sp->dst, &s->dst); @@ -1562,7 +1562,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) nexts = RB_NEXT(pf_state_tree_id, &tree_id, s); if (!psk->psk_ifname[0] || !strcmp(psk->psk_ifname, - s->u.s.kif->pfik_name)) { + s->kif->pfik_name)) { #if NPFSYNC /* don't send out individual delete messages */ s->sync_flags = PFSTATE_NOSYNC; @@ -1617,7 +1617,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) psk->psk_dst.port[0], psk->psk_dst.port[1], dst->port)) && (!psk->psk_ifname[0] || !strcmp(psk->psk_ifname, - s->u.s.kif->pfik_name))) { + s->kif->pfik_name))) { #if NPFSYNC > 0 /* send immediate delete of state */ pfsync_delete_state(s); @@ -1723,7 +1723,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) p++; nr++; } - state = TAILQ_NEXT(state, u.s.entry_list); + state = TAILQ_NEXT(state, entry_list); } ps->ps_len = sizeof(struct pfsync_state) * nr; diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 9dbc1b9bdbd..6afe622c164 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pfvar.h,v 1.251 2007/06/21 11:55:54 henning Exp $ */ +/* $OpenBSD: pfvar.h,v 1.252 2007/06/24 11:17:13 mcbride Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -722,42 +722,37 @@ struct pf_state_cmp { }; struct pf_state { - u_int64_t id; - u_int32_t creatorid; - u_int32_t pad; + u_int64_t id; + u_int32_t creatorid; + u_int32_t pad; + TAILQ_ENTRY(pf_state) entry_list; TAILQ_ENTRY(pf_state) next; RB_ENTRY(pf_state) entry_id; + struct pf_state_peer src; + struct pf_state_peer dst; + union pf_rule_ptr rule; + union pf_rule_ptr anchor; + union pf_rule_ptr nat_rule; + struct pf_addr rt_addr; struct pf_state_key *state_key; - u_int8_t log; - u_int8_t allow_opts; - u_int8_t timeout; - u_int8_t sync_flags; + struct pfi_kif *kif; + struct pfi_kif *rt_kif; + struct pf_src_node *src_node; + struct pf_src_node *nat_src_node; + u_int64_t packets[2]; + u_int64_t bytes[2]; + u_int32_t creation; + u_int32_t expire; + u_int32_t pfsync_time; + u_int16_t tag; + u_int8_t log; + u_int8_t allow_opts; + u_int8_t timeout; + u_int8_t sync_flags; #define PFSTATE_NOSYNC 0x01 #define PFSTATE_FROMSYNC 0x02 #define PFSTATE_STALE 0x04 - union { - struct { - TAILQ_ENTRY(pf_state) entry_list; - struct pfi_kif *kif; - } s; - char ifname[IFNAMSIZ]; - } u; - struct pf_state_peer src; - struct pf_state_peer dst; - union pf_rule_ptr rule; - union pf_rule_ptr anchor; - union pf_rule_ptr nat_rule; - struct pf_addr rt_addr; - struct pfi_kif *rt_kif; - struct pf_src_node *src_node; - struct pf_src_node *nat_src_node; - u_int64_t packets[2]; - u_int64_t bytes[2]; - u_int32_t creation; - u_int32_t expire; - u_int32_t pfsync_time; - u_int16_t tag; }; |