diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2006-03-22 16:01:21 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2006-03-22 16:01:21 +0000 |
commit | 71946a94a0ee5c0ea815edab4f318e757ae2c26b (patch) | |
tree | 165b11bc34b75bb88abe76d70667b03554b8f4be | |
parent | 733bd6779f3ce03d715d9dec879e662e883e072f (diff) |
Move the AS external LSA tree out of struct ospfd_config. This simplifies
the code and makes config reloads easier. OK norby@
-rw-r--r-- | usr.sbin/ospfd/ospfd.h | 3 | ||||
-rw-r--r-- | usr.sbin/ospfd/rde.c | 14 | ||||
-rw-r--r-- | usr.sbin/ospfd/rde.h | 4 | ||||
-rw-r--r-- | usr.sbin/ospfd/rde_lsdb.c | 15 | ||||
-rw-r--r-- | usr.sbin/ospfd/rde_spf.c | 4 |
5 files changed, 19 insertions, 21 deletions
diff --git a/usr.sbin/ospfd/ospfd.h b/usr.sbin/ospfd/ospfd.h index 6b66a3c4937..bd0bd373286 100644 --- a/usr.sbin/ospfd/ospfd.h +++ b/usr.sbin/ospfd/ospfd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ospfd.h,v 1.52 2006/03/15 13:25:33 claudio Exp $ */ +/* $OpenBSD: ospfd.h,v 1.53 2006/03/22 16:01:20 claudio Exp $ */ /* * Copyright (c) 2004 Esben Norby <norby@openbsd.org> @@ -370,7 +370,6 @@ enum { struct ospfd_conf { struct event ev; struct in_addr rtr_id; - struct lsa_tree lsa_tree; LIST_HEAD(, area) area_list; LIST_HEAD(, vertex) cand_list; diff --git a/usr.sbin/ospfd/rde.c b/usr.sbin/ospfd/rde.c index cffbe713651..fe90a2a96b9 100644 --- a/usr.sbin/ospfd/rde.c +++ b/usr.sbin/ospfd/rde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.c,v 1.43 2006/03/09 16:55:51 claudio Exp $ */ +/* $OpenBSD: rde.c,v 1.44 2006/03/22 16:01:20 claudio Exp $ */ /* * Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org> @@ -66,6 +66,7 @@ struct ospfd_conf *rdeconf = NULL; struct imsgbuf *ibuf_ospfe; struct imsgbuf *ibuf_main; struct rde_nbr *nbrself; +struct lsa_tree asext_tree; /* ARGSUSED */ void @@ -104,7 +105,7 @@ rde(struct ospfd_conf *xconf, int pipe_parent2rde[2], int pipe_ospfe2rde[2], return (pid); } - rdeconf = xconf; /* XXX may not be replaced because of the lsa_tree */ + rdeconf = xconf; if ((pw = getpwnam(OSPFD_USER)) == NULL) fatal("getpwnam"); @@ -124,7 +125,7 @@ rde(struct ospfd_conf *xconf, int pipe_parent2rde[2], int pipe_ospfe2rde[2], event_init(); rde_nbr_init(NBR_HASHSIZE); - lsa_init(&rdeconf->lsa_tree); + lsa_init(&asext_tree); /* setup signal handler */ signal_set(&ev_sigint, SIGINT, rde_sig_handler, NULL); @@ -509,7 +510,7 @@ rde_dispatch_imsg(int fd, short event, void *bula) lsa_dump(&area->lsa_tree, imsg.hdr.type, imsg.hdr.pid); } - lsa_dump(&rdeconf->lsa_tree, imsg.hdr.type, + lsa_dump(&asext_tree, imsg.hdr.type, imsg.hdr.pid); } else { memcpy(&aid, imsg.data, sizeof(aid)); @@ -520,7 +521,7 @@ rde_dispatch_imsg(int fd, short event, void *bula) lsa_dump(&area->lsa_tree, imsg.hdr.type, imsg.hdr.pid); if (!area->stub) - lsa_dump(&rdeconf->lsa_tree, + lsa_dump(&asext_tree, imsg.hdr.type, imsg.hdr.pid); } @@ -684,7 +685,6 @@ void rde_send_summary(pid_t pid) { static struct ctl_sum sumctl; - struct lsa_tree *tree = &rdeconf->lsa_tree; struct area *area; struct vertex *v; @@ -697,7 +697,7 @@ rde_send_summary(pid_t pid) LIST_FOREACH(area, &rdeconf->area_list, entry) sumctl.num_area++; - RB_FOREACH(v, lsa_tree, tree) + RB_FOREACH(v, lsa_tree, &asext_tree) sumctl.num_ext_lsa++; sumctl.rfc1583compat = rdeconf->rfc1583compat; diff --git a/usr.sbin/ospfd/rde.h b/usr.sbin/ospfd/rde.h index 4c543cbb958..6e454b28d5b 100644 --- a/usr.sbin/ospfd/rde.h +++ b/usr.sbin/ospfd/rde.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.h,v 1.27 2006/03/13 09:36:06 claudio Exp $ */ +/* $OpenBSD: rde.h,v 1.28 2006/03/22 16:01:20 claudio Exp $ */ /* * Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org> @@ -87,6 +87,8 @@ struct abr_rtr { u_int16_t metric; }; +extern struct lsa_tree asext_tree; + /* rde.c */ pid_t rde(struct ospfd_conf *, int [2], int [2], int [2]); int rde_imsg_compose_parent(int, pid_t, void *, u_int16_t); diff --git a/usr.sbin/ospfd/rde_lsdb.c b/usr.sbin/ospfd/rde_lsdb.c index 2f91f646d8d..8bf3bd2a8d2 100644 --- a/usr.sbin/ospfd/rde_lsdb.c +++ b/usr.sbin/ospfd/rde_lsdb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde_lsdb.c,v 1.29 2006/03/13 09:36:06 claudio Exp $ */ +/* $OpenBSD: rde_lsdb.c,v 1.30 2006/03/22 16:01:20 claudio Exp $ */ /* * Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org> @@ -34,15 +34,12 @@ void lsa_timeout(int, short, void *); void lsa_refresh(struct vertex *); int lsa_equal(struct lsa *, struct lsa *); -struct lsa_tree *global_lsa_tree; - RB_GENERATE(lsa_tree, vertex, entry, lsa_compare) void lsa_init(struct lsa_tree *t) { - global_lsa_tree = t; - RB_INIT(global_lsa_tree); + RB_INIT(t); } int @@ -336,7 +333,7 @@ lsa_add(struct rde_nbr *nbr, struct lsa *lsa) struct timeval tv; if (lsa->hdr.type == LSA_TYPE_EXTERNAL) - tree = global_lsa_tree; + tree = &asext_tree; else tree = &nbr->area->lsa_tree; @@ -383,7 +380,7 @@ lsa_del(struct rde_nbr *nbr, struct lsa_hdr *lsa) } if (lsa->type == LSA_TYPE_EXTERNAL) - tree = global_lsa_tree; + tree = &asext_tree; else tree = &nbr->area->lsa_tree; @@ -432,7 +429,7 @@ lsa_find(struct area *area, u_int8_t type, u_int32_t ls_id, u_int32_t adv_rtr) key.type = type; if (type == LSA_TYPE_EXTERNAL) - tree = global_lsa_tree; + tree = &asext_tree; else tree = &area->lsa_tree; @@ -495,7 +492,7 @@ lsa_snap(struct area *area, u_int32_t peerid) } if (tree != &area->lsa_tree) break; - tree = global_lsa_tree; + tree = &asext_tree; } while (1); } diff --git a/usr.sbin/ospfd/rde_spf.c b/usr.sbin/ospfd/rde_spf.c index c07fcf3e648..09e1643d9a2 100644 --- a/usr.sbin/ospfd/rde_spf.c +++ b/usr.sbin/ospfd/rde_spf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde_spf.c,v 1.51 2006/03/21 08:36:27 claudio Exp $ */ +/* $OpenBSD: rde_spf.c,v 1.52 2006/03/22 16:01:20 claudio Exp $ */ /* * Copyright (c) 2005 Esben Norby <norby@openbsd.org> @@ -555,7 +555,7 @@ spf_timer(int fd, short event, void *arg) /* calculate as-external routes, first invalidate them */ rt_invalidate(NULL); - RB_FOREACH(v, lsa_tree, &conf->lsa_tree) { + RB_FOREACH(v, lsa_tree, &asext_tree) { asext_calc(v); } |