diff options
author | Joakim Tjernlund <joakim.tjernlund@transmode.se> | 2009-11-29 11:08:38 +0000 |
---|---|---|
committer | David Lamparter <equinox@diac24.net> | 2010-02-04 02:10:13 +0100 |
commit | f65b8886cc94cce3afef3e199b538a4263947f09 (patch) | |
tree | 92ca5ac936c24f460150a6fcb5316ff06e0b3abe /ospfd/ospf_ism.c | |
parent | 84cc670c3764d1032730ffa5abe444264f39de33 (diff) | |
download | quagga-f65b8886cc94cce3afef3e199b538a4263947f09.tar.bz2 quagga-f65b8886cc94cce3afef3e199b538a4263947f09.tar.xz |
ospfd: replace route_nodes with a list
It is wasteful to use route nodes for something
as simple as a neighbor list.
Replace with a list.
Diffstat (limited to 'ospfd/ospf_ism.c')
-rw-r--r-- | ospfd/ospf_ism.c | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/ospfd/ospf_ism.c b/ospfd/ospf_ism.c index 18402836..e7bdbf2c 100644 --- a/ospfd/ospf_ism.c +++ b/ospfd/ospf_ism.c @@ -163,38 +163,36 @@ ospf_ism_state (struct ospf_interface *oi) } static void -ospf_dr_eligible_routers (struct route_table *nbrs, struct list *el_list) +ospf_dr_eligible_routers (struct list *nbrs, struct list *el_list) { - struct route_node *rn; + struct listnode *node; struct ospf_neighbor *nbr; - for (rn = route_top (nbrs); rn; rn = route_next (rn)) - if ((nbr = rn->info) != NULL) - /* Ignore 0.0.0.0 node*/ - if (nbr->router_id.s_addr != 0) - /* Is neighbor eligible? */ - if (nbr->priority > 0) - /* Is neighbor upper 2-Way? */ - if (nbr->state >= NSM_TwoWay) - listnode_add (el_list, nbr); + for (ALL_LIST_ELEMENTS_RO (nbrs, node, nbr)) + /* Ignore 0.0.0.0 node*/ + if (nbr->router_id.s_addr != 0) + /* Is neighbor eligible? */ + if (nbr->priority > 0) + /* Is neighbor upper 2-Way? */ + if (nbr->state >= NSM_TwoWay) + listnode_add (el_list, nbr); } /* Generate AdjOK? NSM event. */ static void -ospf_dr_change (struct ospf *ospf, struct route_table *nbrs) +ospf_dr_change (struct ospf *ospf, struct list *nbrs) { - struct route_node *rn; + struct listnode *node; struct ospf_neighbor *nbr; - for (rn = route_top (nbrs); rn; rn = route_next (rn)) - if ((nbr = rn->info) != NULL) - /* Ignore 0.0.0.0 node*/ - if (nbr->router_id.s_addr != 0) - /* Is neighbor upper 2-Way? */ - if (nbr->state >= NSM_TwoWay) - /* Ignore myself. */ - if (!IPV4_ADDR_SAME (&nbr->router_id, &ospf->router_id)) - OSPF_NSM_EVENT_SCHEDULE (nbr, NSM_AdjOK); + for (ALL_LIST_ELEMENTS_RO (nbrs, node, nbr)) + /* Ignore 0.0.0.0 node*/ + if (nbr->router_id.s_addr != 0) + /* Is neighbor upper 2-Way? */ + if (nbr->state >= NSM_TwoWay) + /* Ignore myself. */ + if (!IPV4_ADDR_SAME (&nbr->router_id, &ospf->router_id)) + OSPF_NSM_EVENT_SCHEDULE (nbr, NSM_AdjOK); } static int |