diff options
author | David Lamparter <equinox@diac24.net> | 2010-02-04 02:23:39 +0100 |
---|---|---|
committer | David Lamparter <equinox@diac24.net> | 2010-02-04 02:23:39 +0100 |
commit | 8f8f4dec2e41b217a0651a2f33112447ae04f73b (patch) | |
tree | f574a43c81c7cca6f00226abafa5422722ed7c61 /ospfd/ospf_ism.c | |
parent | 58bfa5562817306f14cd7d41953a2740056e1afc (diff) | |
parent | 43f93a5b3a491052b8206e6d94dd3c986aa9f45b (diff) | |
download | quagga-8f8f4dec2e41b217a0651a2f33112447ae04f73b.tar.bz2 quagga-8f8f4dec2e41b217a0651a2f33112447ae04f73b.tar.xz |
Merge branch 'patches/jt_ospf-fixes-20091129' into ospf-merge-3
Diffstat (limited to 'ospfd/ospf_ism.c')
-rw-r--r-- | ospfd/ospf_ism.c | 48 |
1 files changed, 23 insertions, 25 deletions
diff --git a/ospfd/ospf_ism.c b/ospfd/ospf_ism.c index 18402836..2186e894 100644 --- a/ospfd/ospf_ism.c +++ b/ospfd/ospf_ism.c @@ -88,7 +88,7 @@ ospf_elect_dr (struct ospf_interface *oi, struct list *el_list) listnode_add (dr_list, nbr); /* Preserve neighbor BDR. */ - if (IPV4_ADDR_SAME (&BDR (oi), &nbr->address.u.prefix4)) + if (IPV4_ADDR_SAME (&BDR (oi), &nbr->src)) bdr = nbr; } @@ -100,7 +100,7 @@ ospf_elect_dr (struct ospf_interface *oi, struct list *el_list) /* Set DR to interface. */ if (dr) - DR (oi) = dr->address.u.prefix4; + DR (oi) = dr->src; else DR (oi).s_addr = 0; @@ -141,7 +141,7 @@ ospf_elect_bdr (struct ospf_interface *oi, struct list *el_list) /* Set BDR to interface. */ if (bdr) - BDR (oi) = bdr->address.u.prefix4; + BDR (oi) = bdr->src; else BDR (oi).s_addr = 0; @@ -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 |