diff options
author | Cedric Berger <cedric@cvs.openbsd.org> | 2003-01-06 14:19:41 +0000 |
---|---|---|
committer | Cedric Berger <cedric@cvs.openbsd.org> | 2003-01-06 14:19:41 +0000 |
commit | f02178e518463a297d1c53a7b430f17c3e8b2bb5 (patch) | |
tree | 5c27c491f2353fac265c3ec47f59ab53ac96e2a2 | |
parent | f99d632b1e20437276a8523a98de2abadb424931 (diff) |
Move initialisation of radix table globals in pfr_initialize()
ok dhartmei@
-rw-r--r-- | sys/net/pf_ioctl.c | 7 | ||||
-rw-r--r-- | sys/net/pf_table.c | 20 | ||||
-rw-r--r-- | sys/net/pfvar.h | 4 |
3 files changed, 21 insertions, 10 deletions
diff --git a/sys/net/pf_ioctl.c b/sys/net/pf_ioctl.c index 689f216f815..719f82ccc9b 100644 --- a/sys/net/pf_ioctl.c +++ b/sys/net/pf_ioctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf_ioctl.c,v 1.43 2003/01/05 22:14:23 dhartmei Exp $ */ +/* $OpenBSD: pf_ioctl.c,v 1.44 2003/01/06 14:19:40 cedric Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -102,10 +102,7 @@ pfattach(int num) NULL); pool_init(&pf_pooladdr_pl, sizeof(struct pf_pooladdr), 0, 0, 0, "pfpooladdrpl", NULL); - pool_init(&pfr_ktable_pl, sizeof(struct pfr_ktable), 0, 0, 0, - "pfr_ktable", NULL); - pool_init(&pfr_kentry_pl, sizeof(struct pfr_kentry), 0, 0, 0, - "pfr_kentry", NULL); + pfr_initialize(); pool_sethardlimit(&pf_state_pl, pf_pool_limits[PF_LIMIT_STATES].limit, NULL, 0); diff --git a/sys/net/pf_table.c b/sys/net/pf_table.c index fdf2b57dbd2..0775961c572 100644 --- a/sys/net/pf_table.c +++ b/sys/net/pf_table.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf_table.c,v 1.13 2003/01/06 10:08:36 deraadt Exp $ */ +/* $OpenBSD: pf_table.c,v 1.14 2003/01/06 14:19:40 cedric Exp $ */ /* * Copyright (c) 2002 Cedric Berger @@ -96,8 +96,8 @@ struct pfr_walktree { struct pool pfr_ktable_pl; struct pool pfr_kentry_pl; -struct sockaddr_in pfr_sin = { sizeof(pfr_sin), AF_INET }; -struct sockaddr_in6 pfr_sin6 = { sizeof(pfr_sin6), AF_INET6 }; +struct sockaddr_in pfr_sin; +struct sockaddr_in6 pfr_sin6; int pfr_validate_addr(struct pfr_addr *); int pfr_enqueue_addrs(struct pfr_ktable *, @@ -146,6 +146,20 @@ struct pfr_ktablehead pfr_ktables; struct pfr_table pfr_nulltable; int pfr_ktable_cnt; +void +pfr_initialize(void) +{ + pool_init(&pfr_ktable_pl, sizeof(struct pfr_ktable), 0, 0, 0, + "pfr_ktable", NULL); + pool_init(&pfr_kentry_pl, sizeof(struct pfr_kentry), 0, 0, 0, + "pfr_kentry", NULL); + + pfr_sin.sin_len = sizeof(pfr_sin); + pfr_sin.sin_family = AF_INET; + pfr_sin6.sin6_len = sizeof(pfr_sin6); + pfr_sin6.sin6_family = AF_INET6; +} + int pfr_clr_addrs(struct pfr_table *tbl, int *ndel, int flags) { diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 67d2ebdcaaa..29910674357 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pfvar.h,v 1.127 2003/01/05 22:14:23 dhartmei Exp $ */ +/* $OpenBSD: pfvar.h,v 1.128 2003/01/06 14:19:40 cedric Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -929,7 +929,6 @@ extern void pf_update_anchor_rules(void); extern void pf_dynaddr_copyout(struct pf_addr_wrap *); extern struct pool pf_tree_pl, pf_rule_pl, pf_addr_pl; extern struct pool pf_state_pl, pf_altq_pl, pf_pooladdr_pl; -extern struct pool pfr_ktable_pl, pfr_kentry_pl; extern void pf_purge_timeout(void *); extern int pftm_interval; extern void pf_purge_expired_states(void); @@ -963,6 +962,7 @@ void pf_normalize_init(void); int pf_normalize_ip(struct mbuf **, int, struct ifnet *, u_short *); void pf_purge_expired_fragments(void); int pf_routable(struct pf_addr *addr, sa_family_t af); +void pfr_initialize(void); int pfr_match_addr(struct pf_addr *, struct pf_addr *, struct pf_addr *, sa_family_t); void pfr_update_stats(struct pf_addr *, struct pf_addr *, |