diff options
author | paul <paul> | 2003-03-25 02:37:13 +0000 |
---|---|---|
committer | paul <paul> | 2003-03-25 02:37:13 +0000 |
commit | f7ccadc4a079d585770cb5fc6add832d4384facc (patch) | |
tree | c2c96f7405c46112eb3d8f6efcc693e040bc222b /ospfd/ospf_spf.c | |
parent | 139c7c96b474a90aa3685b7efb8f23b550be1ff1 (diff) | |
download | quagga-zebra.org.20030325.tar.bz2 quagga-zebra.org.20030325.tar.xz |
Import of Zebra CVS 20030325-02:30zebra.org.20030325
Diffstat (limited to 'ospfd/ospf_spf.c')
-rw-r--r-- | ospfd/ospf_spf.c | 102 |
1 files changed, 62 insertions, 40 deletions
diff --git a/ospfd/ospf_spf.c b/ospfd/ospf_spf.c index d6254717..759304c8 100644 --- a/ospfd/ospf_spf.c +++ b/ospfd/ospf_spf.c @@ -365,18 +365,42 @@ ospf_nexthop_calculation (struct ospf_area *area, if (l->m[0].type == LSA_LINK_TYPE_POINTOPOINT) { - while ((l2 = ospf_get_next_link (w, v, l2))) + /* Check for PtMP, signified by PtP link V->W + with link_data our PtMP interface. */ + oi = ospf_if_is_configured (area->ospf, &l->link_data); + if (oi && oi->type == OSPF_IFTYPE_POINTOMULTIPOINT) { - oi = ospf_if_is_configured (&(l2->link_data)); + struct prefix_ipv4 la; + la.prefixlen = oi->address->prefixlen; - if (oi == NULL) - continue; - - if (! IPV4_ADDR_SAME (&oi->address->u.prefix4, - &l->link_data)) - continue; - - break; + /* We link to them on PtMP interface + - find the interface on w */ + while ((l2 = ospf_get_next_link (w, v, l2))) + { + la.prefix = l2->link_data; + + if (prefix_cmp ((struct prefix *)&la, + oi->address) == 0) + /* link_data is on our PtMP network */ + break; + } + } + else + { + while ((l2 = ospf_get_next_link (w, v, l2))) + { + oi = ospf_if_is_configured (area->ospf, + &(l2->link_data)); + + if (oi == NULL) + continue; + + if (!IPV4_ADDR_SAME (&oi->address->u.prefix4, + &l->link_data)) + continue; + + break; + } } if (oi && l2) @@ -393,7 +417,7 @@ ospf_nexthop_calculation (struct ospf_area *area, { while ((l = ospf_get_next_link (v, w, l))) { - oi = ospf_if_is_configured (&(l->link_data)); + oi = ospf_if_is_configured (area->ospf, &(l->link_data)); if (oi) { nh = vertex_nexthop_new (v); @@ -974,7 +998,7 @@ ospf_spf_calculate (struct ospf_area *area, struct route_table *new_table, /* Increment SPF Calculation Counter. */ area->spf_calculation++; - ospf_top->ts_spf = time (NULL); + area->ospf->ts_spf = time (NULL); if (IS_DEBUG_OSPF_EVENT) zlog_info ("ospf_spf_calculate: Stop"); @@ -982,32 +1006,30 @@ ospf_spf_calculate (struct ospf_area *area, struct route_table *new_table, /* Timer for SPF calculation. */ int -ospf_spf_calculate_timer (struct thread *t) +ospf_spf_calculate_timer (struct thread *thread) { + struct ospf *ospf = THREAD_ARG (thread); struct route_table *new_table, *new_rtrs; - struct ospf *ospf; - /* struct ospf_area *area; */ listnode node; if (IS_DEBUG_OSPF_EVENT) zlog_info ("SPF: Timer (SPF calculation expire)"); - ospf = THREAD_ARG (t); ospf->t_spf_calc = NULL; /* Allocate new table tree. */ new_table = route_table_init (); new_rtrs = route_table_init (); - ospf_vl_unapprove (); + ospf_vl_unapprove (ospf); /* Calculate SPF for each area. */ for (node = listhead (ospf->areas); node; node = nextnode (node)) ospf_spf_calculate (node->data, new_table, new_rtrs); - ospf_vl_shut_unapproved (); + ospf_vl_shut_unapproved (ospf); - ospf_ia_routing (new_table, new_rtrs); + ospf_ia_routing (ospf, new_table, new_rtrs); ospf_prune_unreachable_networks (new_table); ospf_prune_unreachable_routers (new_rtrs); @@ -1017,26 +1039,26 @@ ospf_spf_calculate_timer (struct thread *t) /* If new Router Route is installed, then schedule re-calculate External routes. */ if (1) - ospf_ase_calculate_schedule (); + ospf_ase_calculate_schedule (ospf); - ospf_ase_calculate_timer_add (); + ospf_ase_calculate_timer_add (ospf); /* Update routing table. */ - ospf_route_install (new_table); + ospf_route_install (ospf, new_table); /* Update ABR/ASBR routing table */ - if (ospf_top->old_rtrs) + if (ospf->old_rtrs) { /* old_rtrs's node holds linked list of ospf_route. --kunihiro. */ - /* ospf_route_delete (ospf_top->old_rtrs); */ - ospf_rtrs_free (ospf_top->old_rtrs); + /* ospf_route_delete (ospf->old_rtrs); */ + ospf_rtrs_free (ospf->old_rtrs); } - ospf_top->old_rtrs = ospf_top->new_rtrs; - ospf_top->new_rtrs = new_rtrs; + ospf->old_rtrs = ospf->new_rtrs; + ospf->new_rtrs = new_rtrs; if (OSPF_IS_ABR) - ospf_abr_task (new_table, new_rtrs); + ospf_abr_task (ospf); if (IS_DEBUG_OSPF_EVENT) zlog_info ("SPF: calculation complete"); @@ -1047,7 +1069,7 @@ ospf_spf_calculate_timer (struct thread *t) /* Add schedule for SPF calculation. To avoid frequenst SPF calc, we set timer for SPF calc. */ void -ospf_spf_calculate_schedule () +ospf_spf_calculate_schedule (struct ospf *ospf) { time_t ht, delay; @@ -1055,34 +1077,34 @@ ospf_spf_calculate_schedule () zlog_info ("SPF: calculation timer scheduled"); /* OSPF instance does not exist. */ - if (!ospf_top) + if (ospf == NULL) return; /* SPF calculation timer is already scheduled. */ - if (ospf_top->t_spf_calc) + if (ospf->t_spf_calc) { if (IS_DEBUG_OSPF_EVENT) zlog_info ("SPF: calculation timer is already scheduled: %p", - ospf_top->t_spf_calc); + ospf->t_spf_calc); return; } - ht = time (NULL) - ospf_top->ts_spf; + ht = time (NULL) - ospf->ts_spf; /* Get SPF calculation delay time. */ - if (ht < ospf_top->spf_holdtime) + if (ht < ospf->spf_holdtime) { - if (ospf_top->spf_holdtime - ht < ospf_top->spf_delay) - delay = ospf_top->spf_delay; + if (ospf->spf_holdtime - ht < ospf->spf_delay) + delay = ospf->spf_delay; else - delay = ospf_top->spf_holdtime - ht; + delay = ospf->spf_holdtime - ht; } else - delay = ospf_top->spf_delay; + delay = ospf->spf_delay; if (IS_DEBUG_OSPF_EVENT) zlog_info ("SPF: calculation timer delay = %ld", delay); - ospf_top->t_spf_calc = - thread_add_timer (master, ospf_spf_calculate_timer, ospf_top, delay); + ospf->t_spf_calc = + thread_add_timer (master, ospf_spf_calculate_timer, ospf, delay); } |