? DEADJOE ? cscope.out Index: ospf_abr.c =================================================================== RCS file: /var/cvsroot/quagga/ospfd/ospf_abr.c,v retrieving revision 1.13 diff -u -w -b -p -r1.13 ospf_abr.c --- ospf_abr.c 8 Dec 2004 17:28:56 -0000 1.13 +++ ospf_abr.c 25 Feb 2005 10:50:53 -0000 @@ -553,8 +553,7 @@ ospf_check_abr_status (struct ospf *ospf if (IS_DEBUG_OSPF_EVENT) zlog_debug ("ospf_check_abr_status(): new router flags: %x",new_flags); ospf->flags = new_flags; - OSPF_TIMER_ON (ospf->t_router_lsa_update, - ospf_router_lsa_update_timer, OSPF_LSA_UPDATE_DELAY); + ospf_router_lsa_update (ospf); } } @@ -748,7 +747,7 @@ ospf_abr_announce_network_to_area (struc zlog_debug ("ospf_abr_announce_network_to_area(): " "refreshing summary"); set_metric (old, cost); - lsa = ospf_summary_lsa_refresh (area->ospf, old); + ospf_lsa_refresh (old); /* This will flood through area. */ } } @@ -982,8 +981,7 @@ ospf_abr_process_nssa_translates (struct } void -ospf_abr_process_network_rt (struct ospf *ospf, - struct route_table *rt) +ospf_abr_process_network_rt (struct ospf *ospf, struct route_table *rt) { struct ospf_area *area; struct ospf_route *or; @@ -1083,7 +1081,8 @@ void ospf_abr_announce_rtr_to_area (struct prefix_ipv4 *p, u_int32_t cost, struct ospf_area *area) { - struct ospf_lsa *lsa, *old = NULL; + struct ospf_lsa *lsa = NULL, + *old = NULL; struct summary_lsa *slsa = NULL; if (IS_DEBUG_OSPF_EVENT) @@ -1117,7 +1116,7 @@ ospf_abr_announce_rtr_to_area (struct pr if (old) { set_metric (old, cost); - lsa = ospf_summary_asbr_lsa_refresh (area->ospf, old); + lsa = ospf_summary_asbr_lsa_refresh (old); } else lsa = ospf_summary_asbr_lsa_originate (p, cost, area); @@ -1130,14 +1129,12 @@ ospf_abr_announce_rtr_to_area (struct pr lsa = ospf_summary_asbr_lsa (p, cost, area, old); */ SET_FLAG (lsa->flags, OSPF_LSA_APPROVED); - /* ospf_flood_through_area (area, NULL, lsa);*/ } if (IS_DEBUG_OSPF_EVENT) zlog_debug ("ospf_abr_announce_rtr_to_area(): Stop"); } - void ospf_abr_announce_rtr (struct ospf *ospf, struct prefix_ipv4 *p, struct ospf_route *or) @@ -1342,7 +1339,7 @@ ospf_abr_unapprove_summaries (struct osp "considering area %s", inet_ntoa (area->area_id)); LSDB_LOOP (SUMMARY_LSDB (area), rn, lsa) - if (ospf_lsa_is_self_originated (ospf, lsa)) + if (ospf_lsa_is_self_originated (lsa)) { if (IS_DEBUG_OSPF_EVENT) zlog_debug ("ospf_abr_unapprove_summaries(): " @@ -1352,7 +1349,7 @@ ospf_abr_unapprove_summaries (struct osp } LSDB_LOOP (ASBR_SUMMARY_LSDB (area), rn, lsa) - if (ospf_lsa_is_self_originated (ospf, lsa)) + if (ospf_lsa_is_self_originated (lsa)) { if (IS_DEBUG_OSPF_EVENT) zlog_debug ("ospf_abr_unapprove_summaries(): " @@ -1639,7 +1636,7 @@ ospf_abr_remove_unapproved_translates_ap inet_ntoa (lsa->data->id)); /* FLUSH THROUGHOUT AS */ - ospf_lsa_flush_as (ospf, lsa); + ospf_lsa_flush_as (lsa); /* DISCARD from LSDB */ } @@ -1684,12 +1681,12 @@ ospf_abr_remove_unapproved_summaries (st "looking at area %s", inet_ntoa (area->area_id)); LSDB_LOOP (SUMMARY_LSDB (area), rn, lsa) - if (ospf_lsa_is_self_originated (ospf, lsa)) + if (ospf_lsa_is_self_originated (lsa)) if (!CHECK_FLAG (lsa->flags, OSPF_LSA_APPROVED)) ospf_lsa_flush_area (lsa, area); LSDB_LOOP (ASBR_SUMMARY_LSDB (area), rn, lsa) - if (ospf_lsa_is_self_originated (ospf, lsa)) + if (ospf_lsa_is_self_originated (lsa)) if (!CHECK_FLAG (lsa->flags, OSPF_LSA_APPROVED)) ospf_lsa_flush_area (lsa, area); } Index: ospf_apiserver.c =================================================================== RCS file: /var/cvsroot/quagga/ospfd/ospf_apiserver.c,v retrieving revision 1.17 diff -u -w -b -p -r1.17 ospf_apiserver.c --- ospf_apiserver.c 9 Dec 2004 16:30:04 -0000 1.17 +++ ospf_apiserver.c 25 Feb 2005 10:50:54 -0000 @@ -1538,6 +1538,7 @@ ospf_apiserver_opaque_lsa_new (struct os new->area = area; new->oi = oi; + new->ospf = oi->ospf; SET_FLAG (new->flags, OSPF_LSA_SELF); memcpy (new->data, newlsa, length); Index: ospf_asbr.c =================================================================== RCS file: /var/cvsroot/quagga/ospfd/ospf_asbr.c,v retrieving revision 1.2 diff -u -w -b -p -r1.2 ospf_asbr.c --- ospf_asbr.c 8 Dec 2004 17:38:29 -0000 1.2 +++ ospf_asbr.c 25 Feb 2005 10:50:55 -0000 @@ -265,8 +265,7 @@ ospf_asbr_status_update (struct ospf *os /* Transition from/to status ASBR, schedule timer. */ ospf_spf_calculate_schedule (ospf); - OSPF_TIMER_ON (ospf->t_router_lsa_update, - ospf_router_lsa_update_timer, OSPF_LSA_UPDATE_DELAY); + ospf_router_lsa_update (ospf); } void Index: ospf_flood.c =================================================================== RCS file: /var/cvsroot/quagga/ospfd/ospf_flood.c,v retrieving revision 1.13 diff -u -w -b -p -r1.13 ospf_flood.c --- ospf_flood.c 8 Dec 2004 17:46:58 -0000 1.13 +++ ospf_flood.c 25 Feb 2005 10:50:55 -0000 @@ -137,7 +137,7 @@ ospf_process_self_originated_lsa (struct ospf_lsa_unlock (area->router_lsa_self); area->router_lsa_self = ospf_lsa_lock (new); - ospf_router_lsa_timer_add (area); + ospf_router_lsa_update_area (area); return; case OSPF_NETWORK_LSA: #ifdef HAVE_OPAQUE_LSA @@ -175,7 +175,7 @@ ospf_process_self_originated_lsa (struct oi->network_lsa_self = ospf_lsa_lock (new); /* Schedule network-LSA origination. */ - ospf_network_lsa_timer_add (oi); + ospf_lsa_refresh (oi->network_lsa_self); return; } break; @@ -193,9 +193,9 @@ ospf_process_self_originated_lsa (struct } ei = ospf_external_info_check (new); if (ei) - ospf_external_lsa_refresh (ospf, new, ei, LSA_REFRESH_FORCE); + ospf_external_lsa_refresh (new, ei, LSA_REFRESH_FORCE); else - ospf_lsa_flush_as (ospf, new); + ospf_lsa_flush_as (new); break; #ifdef HAVE_OPAQUE_LSA case OSPF_OPAQUE_AREA_LSA: @@ -308,7 +308,7 @@ ospf_flood (struct ospf *ospf, struct os #ifdef HAVE_OPAQUE_LSA case OSPF_OPAQUE_AS_LSA: #endif /* HAVE_OPAQUE_LSA */ - ospf_ls_retransmit_delete_nbr_as (ospf, current); + ospf_ls_retransmit_delete_nbr_as (current); break; default: ospf_ls_retransmit_delete_nbr_area (nbr->oi->area, current); @@ -318,7 +318,7 @@ ospf_flood (struct ospf *ospf, struct os /* Do some internal house keeping that is needed here */ SET_FLAG (new->flags, OSPF_LSA_RECEIVED); - ospf_lsa_is_self_originated (ospf, new); /* Let it set the flag */ + ospf_lsa_is_self_originated (new); /* Let it set the flag */ /* Install the new LSA in the link state database (replacing the current database copy). This may cause the @@ -327,7 +327,7 @@ ospf_flood (struct ospf *ospf, struct os procedure cannot overwrite the newly installed LSA until MinLSArrival seconds have elapsed. */ - new = ospf_lsa_install (ospf, nbr->oi, new); + new = ospf_lsa_install (nbr->oi, new); /* Acknowledge the receipt of the LSA by sending a Link State Acknowledgment packet back out the receiving interface. */ @@ -338,7 +338,7 @@ ospf_flood (struct ospf *ospf, struct os receiving router itself, the router must take special action, either updating the LSA or in some cases flushing it from the routing domain. */ - if (ospf_lsa_is_self_originated (ospf, new)) + if (ospf_lsa_is_self_originated (new)) ospf_process_self_originated_lsa (ospf, new, oi->area); else /* Update statistics value for OSPF-MIB. */ @@ -833,11 +833,12 @@ ospf_ls_request_lookup (struct ospf_neig } struct ospf_lsa * -ospf_ls_request_new (struct lsa_header *lsah) +ospf_ls_request_new (struct ospf *ospf, struct lsa_header *lsah) { struct ospf_lsa *new; new = ospf_lsa_new (); + new->ospf = ospf; new->data = ospf_lsa_data_new (OSPF_LSA_HEADER_SIZE); memcpy (new->data, lsah, OSPF_LSA_HEADER_SIZE); @@ -972,11 +973,11 @@ ospf_ls_retransmit_delete_nbr_area (stru } void -ospf_ls_retransmit_delete_nbr_as (struct ospf *ospf, struct ospf_lsa *lsa) +ospf_ls_retransmit_delete_nbr_as (struct ospf_lsa *lsa) { struct listnode *node; - for (node = listhead (ospf->oiflist); node; nextnode (node)) + for (node = listhead (lsa->ospf->oiflist); node; nextnode (node)) ospf_ls_retransmit_delete_nbr_if (getdata (node), lsa); } @@ -989,13 +990,13 @@ ospf_lsa_flush_area (struct ospf_lsa *ls { lsa->data->ls_age = htons (OSPF_LSA_MAXAGE); ospf_flood_through_area (area, NULL, lsa); - ospf_lsa_maxage (area->ospf, lsa); + ospf_lsa_maxage (lsa); } void -ospf_lsa_flush_as (struct ospf *ospf, struct ospf_lsa *lsa) +ospf_lsa_flush_as (struct ospf_lsa *lsa) { lsa->data->ls_age = htons (OSPF_LSA_MAXAGE); - ospf_flood_through_as (ospf, NULL, lsa); - ospf_lsa_maxage (ospf, lsa); + ospf_flood_through_as (lsa->ospf, NULL, lsa); + ospf_lsa_maxage (lsa); } Index: ospf_flood.h =================================================================== RCS file: /var/cvsroot/quagga/ospfd/ospf_flood.h,v retrieving revision 1.1.1.2 diff -u -w -b -p -r1.1.1.2 ospf_flood.h --- ospf_flood.h 25 Mar 2003 02:37:17 -0000 1.1.1.2 +++ ospf_flood.h 25 Feb 2005 10:50:55 -0000 @@ -34,7 +34,7 @@ int ospf_flood_through_as (struct ospf * unsigned long ospf_ls_request_count (struct ospf_neighbor *); int ospf_ls_request_isempty (struct ospf_neighbor *); -struct ospf_lsa *ospf_ls_request_new (struct lsa_header *); +struct ospf_lsa *ospf_ls_request_new (struct ospf *, struct lsa_header *); void ospf_ls_request_free (struct ospf_lsa *); void ospf_ls_request_add (struct ospf_neighbor *, struct ospf_lsa *); void ospf_ls_request_delete (struct ospf_neighbor *, struct ospf_lsa *); @@ -52,14 +52,14 @@ struct ospf_lsa *ospf_ls_retransmit_look struct ospf_lsa *); void ospf_ls_retransmit_delete_nbr_area (struct ospf_area *, struct ospf_lsa *); -void ospf_ls_retransmit_delete_nbr_as (struct ospf *, struct ospf_lsa *); +void ospf_ls_retransmit_delete_nbr_as (struct ospf_lsa *); void ospf_ls_retransmit_add_nbr_all (struct ospf_interface *, struct ospf_lsa *); -void ospf_flood_lsa_area (struct ospf_lsa *, struct ospf_area *); +void ospf_flood_lsa_area (struct ospf_area *); void ospf_flood_lsa_as (struct ospf_lsa *); void ospf_lsa_flush_area (struct ospf_lsa *, struct ospf_area *); -void ospf_lsa_flush_as (struct ospf *, struct ospf_lsa *); +void ospf_lsa_flush_as (struct ospf_lsa *); struct external_info *ospf_external_info_check (struct ospf_lsa *); void ospf_lsdb_init (struct ospf_lsdb *); Index: ospf_ia.c =================================================================== RCS file: /var/cvsroot/quagga/ospfd/ospf_ia.c,v retrieving revision 1.6 diff -u -w -b -p -r1.6 ospf_ia.c --- ospf_ia.c 8 Dec 2004 17:49:05 -0000 1.6 +++ ospf_ia.c 25 Feb 2005 10:50:56 -0000 @@ -223,7 +223,7 @@ process_summary_lsa (struct ospf_area *a if (IS_LSA_MAXAGE (lsa)) return 0; - if (ospf_lsa_is_self_originated (area->ospf, lsa)) + if (ospf_lsa_is_self_originated (lsa)) return 0; p.family = AF_INET; @@ -248,8 +248,7 @@ process_summary_lsa (struct ospf_area *a if (IS_OSPF_ABR(ospf) && ospf->abr_type != OSPF_ABR_STAND && area->external_routing != OSPF_AREA_DEFAULT && - p.prefix.s_addr == OSPF_DEFAULT_DESTINATION && - p.prefixlen == 0) + p.prefix.s_addr == OSPF_DEFAULT_DESTINATION && p.prefixlen == 0) return 0; /* Ignore summary default from a stub area */ abr.family = AF_INET; @@ -566,7 +565,7 @@ process_transit_summary_lsa (struct ospf return 0; } - if (ospf_lsa_is_self_originated (area->ospf, lsa)) + if (ospf_lsa_is_self_originated (lsa)) { if (IS_DEBUG_OSPF_EVENT) zlog_debug ("process_transit_summaries(): This LSA is mine, skip"); Index: ospf_interface.c =================================================================== RCS file: /var/cvsroot/quagga/ospfd/ospf_interface.c,v retrieving revision 1.30 diff -u -w -b -p -r1.30 ospf_interface.c --- ospf_interface.c 8 Feb 2005 15:37:30 -0000 1.30 +++ ospf_interface.c 25 Feb 2005 10:50:56 -0000 @@ -97,7 +97,7 @@ ospf_if_recalculate_output_cost (struct if (oi->output_cost != newcost) { oi->output_cost = newcost; - ospf_router_lsa_timer_add (oi->area); + ospf_router_lsa_update_area (oi->area); } } } @@ -300,7 +300,6 @@ ospf_if_cleanup (struct ospf_interface * ospf_lsa_unlock (oi->network_lsa_self); oi->network_lsa_self = NULL; - OSPF_TIMER_OFF (oi->t_network_lsa_self); } void @@ -1111,7 +1110,7 @@ ospf_vl_up_check (struct ospf_area *area zlog_debug ("ospf_vl_up_check: VL cost change," " scheduling router lsa refresh"); if(ospf->backbone) - ospf_router_lsa_timer_add (ospf->backbone); + ospf_router_lsa_update_area (ospf->backbone); else if (IS_DEBUG_OSPF (ism, ISM_EVENTS)) zlog_debug ("ospf_vl_up_check: VL cost change, no backbone!"); } Index: ospf_interface.h =================================================================== RCS file: /var/cvsroot/quagga/ospfd/ospf_interface.h,v retrieving revision 1.8 diff -u -w -b -p -r1.8 ospf_interface.h --- ospf_interface.h 8 Feb 2005 15:59:16 -0000 1.8 +++ ospf_interface.h 25 Feb 2005 10:50:56 -0000 @@ -172,8 +172,7 @@ struct ospf_interface struct thread *t_ls_ack; /* timer */ struct thread *t_ls_ack_direct; /* event */ struct thread *t_ls_upd_event; /* event */ - struct thread *t_network_lsa_self; /* self-originated network-LSA - reflesh thread. timer */ + #ifdef HAVE_OPAQUE_LSA struct thread *t_opaque_lsa_self; /* Type-9 Opaque-LSAs */ #endif /* HAVE_OPAQUE_LSA */ Index: ospf_ism.c =================================================================== RCS file: /var/cvsroot/quagga/ospfd/ospf_ism.c,v retrieving revision 1.7 diff -u -w -b -p -r1.7 ospf_ism.c --- ospf_ism.c 8 Feb 2005 15:37:30 -0000 1.7 +++ ospf_ism.c 25 Feb 2005 10:50:57 -0000 @@ -587,13 +587,13 @@ ism_change_state (struct ospf_interface else if (old_state == ISM_Down) oi->area->act_ints++; - /* schedule router-LSA originate. */ - ospf_router_lsa_timer_add (oi->area); + /* router-LSA originate. */ + ospf_router_lsa_update_area (oi->area); } /* Originate network-LSA. */ if (old_state != ISM_DR && state == ISM_DR) - ospf_network_lsa_timer_add (oi); + ospf_lsa_refresh (oi->network_lsa_self); else if (old_state == ISM_DR && state != ISM_DR) { /* Free self originated network LSA. */ @@ -601,7 +601,6 @@ ism_change_state (struct ospf_interface if (lsa) { ospf_lsa_flush_area (lsa, oi->area); - OSPF_TIMER_OFF (oi->t_network_lsa_self); } ospf_lsa_unlock (oi->network_lsa_self); Index: ospf_lsa.c =================================================================== RCS file: /var/cvsroot/quagga/ospfd/ospf_lsa.c,v retrieving revision 1.33 diff -u -w -b -p -r1.33 ospf_lsa.c --- ospf_lsa.c 9 Feb 2005 15:51:57 -0000 1.33 +++ ospf_lsa.c 25 Feb 2005 10:51:00 -0000 @@ -389,6 +389,15 @@ lsa_seqnum_increment (struct ospf_lsa *l seqnum = ntohl (lsa->data->ls_seqnum) + 1; + /* it is LSA refresh code's job to do flood of maxage + * LSA in case of seqnum wrap before calling seqnum increment. + * we just ensure here we always increment to valid seqnum. + * ie not 0x8000000 + */ + if ( seqnum >= OSPF_MAX_SEQUENCE_NUMBER + && seqnum < OSPF_INITIAL_SEQUENCE_NUMBER) + seqnum = OSPF_INITIAL_SEQUENCE_NUMBER; + return htonl (seqnum); } @@ -396,7 +405,12 @@ void lsa_header_set (struct stream *s, u_char options, u_char type, struct in_addr id, struct in_addr router_id) { +#define SEQNUMHIGHTEST 1 struct lsa_header *lsah; +#if SEQNUMHIGHTEST /* for testing sequence number wrapping */ + static int high_seqnum = 0x7fffff0; + static int inseqc = 0; +#endif /* test seqnum wrapping */ lsah = (struct lsa_header *) STREAM_DATA (s); @@ -405,6 +419,15 @@ lsa_header_set (struct stream *s, u_char lsah->type = type; lsah->id = id; lsah->adv_router = router_id; +#if SEQNUMHIGHTEST /* useful for testing seqnum wrapping */ + if (inseqc <= 0x100) + { + fprintf(stdout, "pong\n"); + lsah->ls_seqnum = htonl (high_seqnum); + inseqc++; + } + else +#endif /* test seqnum wrapping */ lsah->ls_seqnum = htonl (OSPF_INITIAL_SEQUENCE_NUMBER); stream_forward_endp (s, OSPF_LSA_HEADER_SIZE); @@ -753,6 +776,8 @@ ospf_router_lsa_new (struct ospf_area *a /* Now, create OSPF LSA instance. */ new = ospf_lsa_new (); new->area = area; + new->ospf = area->ospf; + SET_FLAG (new->flags, OSPF_LSA_SELF); /* Copy LSA data to store, discard stream. */ @@ -782,7 +807,7 @@ ospf_router_lsa_originate (struct ospf_a } /* Install LSA to LSDB. */ - new = ospf_lsa_install (area->ospf, NULL, new); + new = ospf_lsa_install (NULL, new); /* Update LSA origination count. */ area->ospf->lsa_originate_count++; @@ -813,11 +838,14 @@ ospf_router_lsa_refresh (struct ospf_lsa /* Delete LSA from neighbor retransmit-list. */ ospf_ls_retransmit_delete_nbr_area (area, lsa); + /* Unregister LSA from refresh-list */ + ospf_refresher_unregister_lsa (lsa); + /* Create new router-LSA instance. */ new = ospf_router_lsa_new (area); new->data->ls_seqnum = lsa_seqnum_increment (lsa); - ospf_lsa_install (area->ospf, NULL, new); + ospf_lsa_install (NULL, new); /* Flood LSA through area. */ ospf_flood_through_area (area, NULL, new); @@ -834,19 +862,15 @@ ospf_router_lsa_refresh (struct ospf_lsa } int -ospf_router_lsa_timer (struct thread *t) +ospf_router_lsa_update_area (struct ospf_area *area) { - struct ospf_area *area; if (IS_DEBUG_OSPF_EVENT) zlog_debug ("Timer[router-LSA]: (router-LSA Refresh expire)"); - area = THREAD_ARG (t); - area->t_router_lsa_self = NULL; - /* Now refresh router-LSA. */ if (area->router_lsa_self) - ospf_router_lsa_refresh (area->router_lsa_self); + ospf_lsa_refresh (area->router_lsa_self); /* Newly originate router-LSA. */ else ospf_router_lsa_originate (area); @@ -854,6 +878,7 @@ ospf_router_lsa_timer (struct thread *t) return 0; } +#if 0 void ospf_router_lsa_timer_add (struct ospf_area *area) { @@ -885,11 +910,11 @@ ospf_router_lsa_timer_add (struct ospf_a /* Immediately refresh router-LSA. */ OSPF_AREA_TIMER_ON (area->t_router_lsa_self, ospf_router_lsa_timer, 0); } +#endif int -ospf_router_lsa_update_timer (struct thread *thread) +ospf_router_lsa_update (struct ospf *ospf) { - struct ospf *ospf = THREAD_ARG (thread); struct listnode *node; if (IS_DEBUG_OSPF (lsa, LSA_GENERATE)) @@ -927,21 +952,20 @@ ospf_router_lsa_update_timer (struct thr area->router_lsa_self = NULL; /* Refresh router-LSA, (not install) and flood through area. */ - ospf_router_lsa_timer_add (area); + ospf_router_lsa_update_area (area); } else { rl = (struct router_lsa *) lsa->data; /* Refresh router-LSA, (not install) and flood through area. */ if (rl->flags != ospf->flags) - ospf_router_lsa_timer_add (area); + ospf_router_lsa_update_area (area); } } return 0; } - /* network-LSA related functions. */ /* Originate Network-LSA. */ void @@ -998,6 +1022,8 @@ ospf_network_lsa_new (struct ospf_interf /* Create OSPF LSA instance. */ new = ospf_lsa_new (); new->area = oi->area; + new->oi = oi; + new->ospf = oi->ospf; SET_FLAG (new->flags, OSPF_LSA_SELF); /* Copy LSA to store. */ @@ -1020,7 +1046,7 @@ ospf_network_lsa_originate (struct ospf_ return NULL; /* Install LSA to LSDB. */ - new = ospf_lsa_install (oi->ospf, oi, new); + new = ospf_lsa_install (oi, new); /* Update LSA origination count. */ oi->ospf->lsa_originate_count++; @@ -1039,10 +1065,11 @@ ospf_network_lsa_originate (struct ospf_ } int -ospf_network_lsa_refresh (struct ospf_lsa *lsa, struct ospf_interface *oi) +ospf_network_lsa_refresh (struct ospf_lsa *lsa) { struct ospf_area *area = lsa->area; struct ospf_lsa *new; + struct ospf_interface *oi = lsa->oi; assert (lsa->data); @@ -1055,7 +1082,7 @@ ospf_network_lsa_refresh (struct ospf_ls return -1; new->data->ls_seqnum = lsa_seqnum_increment (lsa); - ospf_lsa_install (area->ospf, oi, new); + ospf_lsa_install (oi, new); /* Flood LSA through aera. */ ospf_flood_through_area (area, NULL, new); @@ -1070,13 +1097,13 @@ ospf_network_lsa_refresh (struct ospf_ls return 0; } +#if 0 int ospf_network_lsa_refresh_timer (struct thread *t) { struct ospf_interface *oi; oi = THREAD_ARG (t); - oi->t_network_lsa_self = NULL; if (oi->network_lsa_self) /* Now refresh network-LSA. */ @@ -1120,6 +1147,7 @@ ospf_network_lsa_timer_add (struct ospf_ oi->t_network_lsa_self = thread_add_event (master, ospf_network_lsa_refresh_timer, oi, 0); } +#endif void @@ -1183,6 +1211,7 @@ ospf_summary_lsa_new (struct ospf_area * /* Create OSPF LSA instance. */ new = ospf_lsa_new (); new->area = area; + new->ospf = area->ospf; SET_FLAG (new->flags, OSPF_LSA_SELF); /* Copy LSA to store. */ @@ -1207,7 +1236,7 @@ ospf_summary_lsa_originate (struct prefi new = ospf_summary_lsa_new (area, (struct prefix *) p, metric, id); /* Instlal LSA to LSDB. */ - new = ospf_lsa_install (area->ospf, NULL, new); + new = ospf_lsa_install (NULL, new); /* Update LSA origination count. */ area->ospf->lsa_originate_count++; @@ -1226,7 +1255,7 @@ ospf_summary_lsa_originate (struct prefi } struct ospf_lsa* -ospf_summary_lsa_refresh (struct ospf *ospf, struct ospf_lsa *lsa) +ospf_summary_lsa_refresh (struct ospf_lsa *lsa) { struct ospf_lsa *new; struct summary_lsa *sl; @@ -1245,7 +1274,7 @@ ospf_summary_lsa_refresh (struct ospf *o /* Re-calculate checksum. */ ospf_lsa_checksum (new->data); - ospf_lsa_install (ospf, NULL, new); + ospf_lsa_install (NULL, new); /* Flood LSA through AS. */ ospf_flood_through_area (new->area, NULL, new); @@ -1310,6 +1339,7 @@ ospf_summary_asbr_lsa_new (struct ospf_a /* Create OSPF LSA instance. */ new = ospf_lsa_new (); new->area = area; + new->ospf = area->ospf; SET_FLAG (new->flags, OSPF_LSA_SELF); /* Copy LSA to store. */ @@ -1334,7 +1364,7 @@ ospf_summary_asbr_lsa_originate (struct new = ospf_summary_asbr_lsa_new (area, (struct prefix *) p, metric, id); /* Install LSA to LSDB. */ - new = ospf_lsa_install (area->ospf, NULL, new); + new = ospf_lsa_install (NULL, new); /* Update LSA origination count. */ area->ospf->lsa_originate_count++; @@ -1353,7 +1383,7 @@ ospf_summary_asbr_lsa_originate (struct } struct ospf_lsa* -ospf_summary_asbr_lsa_refresh (struct ospf *ospf, struct ospf_lsa *lsa) +ospf_summary_asbr_lsa_refresh (struct ospf_lsa *lsa) { struct ospf_lsa *new; struct summary_lsa *sl; @@ -1372,7 +1402,7 @@ ospf_summary_asbr_lsa_refresh (struct os /* Re-calculate checksum. */ ospf_lsa_checksum (new->data); - ospf_lsa_install (ospf, NULL, new); + ospf_lsa_install (NULL, new); /* Flood LSA through area. */ ospf_flood_through_area (new->area, NULL, new); @@ -1601,6 +1631,8 @@ ospf_external_lsa_new (struct ospf *ospf /* Now, create OSPF LSA instance. */ new = ospf_lsa_new (); new->area = NULL; + new->ospf = ospf; + SET_FLAG (new->flags, OSPF_LSA_SELF|OSPF_LSA_APPROVED); /* Copy LSA data to store, discard stream. */ @@ -1693,7 +1725,7 @@ ospf_install_flood_nssa (struct ospf *os ospf_lsa_checksum (new->data); /* install also as Type-7 */ - ospf_lsa_install (ospf, NULL, new); /* Remove Old, Lock New = 2 */ + ospf_lsa_install (NULL, new); /* Remove Old, Lock New = 2 */ /* will send each copy, lock=2+n */ ospf_flood_through_as (ospf, NULL, new); /* all attached NSSA's, no AS/STUBs */ @@ -1814,7 +1846,7 @@ ospf_translated_nssa_originate (struct o zlog_debug (" Forward addr: %s", inet_ntoa (extnew->e[0].fwd_addr)); } - if ( (new = ospf_lsa_install (ospf, NULL, new)) == NULL) + if ( (new = ospf_lsa_install (NULL, new)) == NULL) { if (IS_DEBUG_OSPF_NSSA); zlog_debug ("ospf_lsa_translated_nssa_originate(): " @@ -1906,7 +1938,7 @@ ospf_translated_nssa_refresh (struct osp } /* Delete LSA from neighbor retransmit-list. */ - ospf_ls_retransmit_delete_nbr_as (ospf, type5); + ospf_ls_retransmit_delete_nbr_as (type5); /* create new translated LSA */ if ( (new = ospf_lsa_translated_nssa_new (ospf, type7)) == NULL) @@ -1918,7 +1950,7 @@ ospf_translated_nssa_refresh (struct osp return NULL; } - if ( !(new = ospf_lsa_install (ospf, NULL, new)) ) + if ( !(new = ospf_lsa_install (NULL, new)) ) { if (IS_DEBUG_OSPF_NSSA) zlog_debug ("ospf_translated_nssa_refresh(): Could not install " @@ -2000,7 +2032,7 @@ ospf_external_lsa_originate (struct ospf } /* Install newly created LSA into Type-5 LSDB, lock = 1. */ - ospf_lsa_install (ospf, NULL, new); + ospf_lsa_install (NULL, new); /* Update LSA origination count. */ ospf->lsa_originate_count++; @@ -2132,7 +2164,7 @@ ospf_nssa_lsa_flush (struct ospf *ospf, ospf_ls_retransmit_delete_nbr_area (area, lsa); if (!IS_LSA_MAXAGE (lsa)) { - ospf_refresher_unregister_lsa (ospf, lsa); + ospf_refresher_unregister_lsa (lsa); ospf_lsa_flush_area (lsa, area); } } @@ -2168,7 +2200,7 @@ ospf_external_lsa_flush (struct ospf *os ospf_nssa_lsa_flush (ospf, p); /* Sweep LSA from Link State Retransmit List. */ - ospf_ls_retransmit_delete_nbr_as (ospf, lsa); + ospf_ls_retransmit_delete_nbr_as (lsa); /* There must be no self-originated LSA in rtrs_external. */ #if 0 @@ -2179,10 +2211,10 @@ ospf_external_lsa_flush (struct ospf *os if (!IS_LSA_MAXAGE (lsa)) { /* Unregister LSA from Refresh queue. */ - ospf_refresher_unregister_lsa (ospf, lsa); + ospf_refresher_unregister_lsa (lsa); /* Flush AS-external-LSA through AS. */ - ospf_lsa_flush_as (ospf, lsa); + ospf_lsa_flush_as (lsa); } if (IS_DEBUG_OSPF (lsa, LSA_FLOODING)) @@ -2209,7 +2241,7 @@ ospf_external_lsa_refresh_default (struc { if (IS_DEBUG_OSPF_EVENT) zlog_debug ("LSA[Type5:0.0.0.0]: Refresh AS-external-LSA %p", lsa); - ospf_external_lsa_refresh (ospf, lsa, ei, LSA_REFRESH_FORCE); + ospf_external_lsa_refresh (lsa, ei, LSA_REFRESH_FORCE); } else { @@ -2224,7 +2256,7 @@ ospf_external_lsa_refresh_default (struc { if (IS_DEBUG_OSPF_EVENT) zlog_debug ("LSA[Type5:0.0.0.0]: Flush AS-external-LSA"); - ospf_lsa_flush_as (ospf, lsa); + ospf_lsa_flush_as (lsa); } } } @@ -2245,7 +2277,7 @@ ospf_external_lsa_refresh_type (struct o struct ospf_lsa *lsa; if ((lsa = ospf_external_info_find_lsa (ospf, &ei->p))) - ospf_external_lsa_refresh (ospf, lsa, ei, force); + ospf_external_lsa_refresh (lsa, ei, force); else ospf_external_lsa_originate (ospf, ei); } @@ -2253,20 +2285,20 @@ ospf_external_lsa_refresh_type (struct o /* Refresh AS-external-LSA. */ void -ospf_external_lsa_refresh (struct ospf *ospf, struct ospf_lsa *lsa, +ospf_external_lsa_refresh (struct ospf_lsa *lsa, struct external_info *ei, int force) { struct ospf_lsa *new; int changed; /* Check the AS-external-LSA should be originated. */ - if (!ospf_redistribute_check (ospf, ei, &changed)) + if (!ospf_redistribute_check (lsa->ospf, ei, &changed)) { if (IS_DEBUG_OSPF (lsa, LSA_GENERATE)) zlog_debug ("LSA[Type%d:%s]: Could not be refreshed, " "redist check fail", lsa->data->type, inet_ntoa (lsa->data->id)); - ospf_external_lsa_flush (ospf, ei->type, &ei->p, + ospf_external_lsa_flush (lsa->ospf, ei->type, &ei->p, ei->ifindex, ei->nexthop); return; } @@ -2280,12 +2312,12 @@ ospf_external_lsa_refresh (struct ospf * } /* Delete LSA from neighbor retransmit-list. */ - ospf_ls_retransmit_delete_nbr_as (ospf, lsa); + ospf_ls_retransmit_delete_nbr_as (lsa); /* Unregister AS-external-LSA from refresh-list. */ - ospf_refresher_unregister_lsa (ospf, lsa); + ospf_refresher_unregister_lsa (lsa); - new = ospf_external_lsa_new (ospf, ei, &lsa->data->id); + new = ospf_external_lsa_new (lsa->ospf, ei, &lsa->data->id); if (new == NULL) { @@ -2303,21 +2335,21 @@ ospf_external_lsa_refresh (struct ospf * /* Re-calculate checksum. */ ospf_lsa_checksum (new->data); - ospf_lsa_install (ospf, NULL, new); /* As type-5. */ + ospf_lsa_install (NULL, new); /* As type-5. */ /* Flood LSA through AS. */ - ospf_flood_through_as (ospf, NULL, new); + ospf_flood_through_as (new->ospf, NULL, new); /* If any attached NSSA, install as Type-7, flood to all NSSA Areas */ - if (ospf->anyNSSA && !(CHECK_FLAG (new->flags, OSPF_LSA_LOCAL_XLT))) - ospf_install_flood_nssa (ospf, new, ei); /* Install/Flood per new rules */ + if (new->ospf->anyNSSA && !(CHECK_FLAG (new->flags, OSPF_LSA_LOCAL_XLT))) + ospf_install_flood_nssa (new->ospf, new, ei); /* Install/Flood per new rules */ /* Register self-originated LSA to refresh queue. * Translated LSAs should not be registered, but refreshed upon * refresh of the Type-7 */ if ( !CHECK_FLAG (new->flags, OSPF_LSA_LOCAL_XLT) ) - ospf_refresher_register_lsa (ospf, new); + ospf_refresher_register_lsa (new); /* Debug logging. */ if (IS_DEBUG_OSPF (lsa, LSA_GENERATE)) @@ -2335,10 +2367,12 @@ ospf_external_lsa_refresh (struct ospf * /* Install router-LSA to an area. */ struct ospf_lsa * -ospf_router_lsa_install (struct ospf *ospf, - struct ospf_lsa *new, int rt_recalc) +ospf_router_lsa_install (struct ospf_lsa *new, int rt_recalc) { struct ospf_area *area = new->area; + struct ospf *ospf = new->ospf; + + assert (area->ospf == ospf); /* RFC 2328 Section 13.2 Router-LSAs and network-LSAs The entire routing table must be recalculated, starting with @@ -2350,15 +2384,12 @@ ospf_router_lsa_install (struct ospf *os if (IS_LSA_SELF (new)) { - /* Set router-LSA refresh timer. */ - OSPF_TIMER_OFF (area->t_router_lsa_self); - OSPF_AREA_TIMER_ON (area->t_router_lsa_self, - ospf_router_lsa_timer, OSPF_LS_REFRESH_TIME); - /* Set self-originated router-LSA. */ ospf_lsa_unlock (area->router_lsa_self); area->router_lsa_self = ospf_lsa_lock (new); + ospf_refresher_register_lsa (new); + if (IS_DEBUG_OSPF (lsa, LSA_INSTALL)) zlog_debug("LSA[Type%d]: ID %s seq 0x%x is self-originated", new->data->type, inet_ntoa (new->data->id), @@ -2374,12 +2405,14 @@ ospf_router_lsa_install (struct ospf *os /* Install network-LSA to an area. */ struct ospf_lsa * -ospf_network_lsa_install (struct ospf *ospf, - struct ospf_interface *oi, - struct ospf_lsa *new, +ospf_network_lsa_install (struct ospf_interface *oi, struct ospf_lsa *new, int rt_recalc) { + struct ospf *ospf = new->ospf; + + assert (ospf == oi->ospf); + /* RFC 2328 Section 13.2 Router-LSAs and network-LSAs The entire routing table must be recalculated, starting with the shortest path calculations for each area (not just the @@ -2393,13 +2426,6 @@ ospf_network_lsa_install (struct ospf *o the RECEIVED flag is set, so we do not link the LSA to the int. */ if (IS_LSA_SELF (new) && !CHECK_FLAG (new->flags, OSPF_LSA_RECEIVED)) { - /* Set LSRefresh timer. */ - OSPF_TIMER_OFF (oi->t_network_lsa_self); - - OSPF_INTERFACE_TIMER_ON (oi->t_network_lsa_self, - ospf_network_lsa_refresh_timer, - OSPF_LS_REFRESH_TIME); - ospf_lsa_unlock (oi->network_lsa_self); oi->network_lsa_self = ospf_lsa_lock (new); } @@ -2409,9 +2435,11 @@ ospf_network_lsa_install (struct ospf *o /* Install summary-LSA to an area. */ struct ospf_lsa * -ospf_summary_lsa_install (struct ospf *ospf, struct ospf_lsa *new, - int rt_recalc) +ospf_summary_lsa_install (struct ospf_lsa *new, int rt_recalc) { + + struct ospf *ospf = new->ospf; + if (rt_recalc && !IS_LSA_SELF (new)) { /* RFC 2328 Section 13.2 Summary-LSAs @@ -2433,16 +2461,17 @@ ospf_summary_lsa_install (struct ospf *o } if (IS_LSA_SELF (new)) - ospf_refresher_register_lsa (ospf, new); + ospf_refresher_register_lsa (new); return new; } /* Install ASBR-summary-LSA to an area. */ struct ospf_lsa * -ospf_summary_asbr_lsa_install (struct ospf *ospf, struct ospf_lsa *new, - int rt_recalc) +ospf_summary_asbr_lsa_install (struct ospf_lsa *new, int rt_recalc) { + struct ospf *ospf = new->ospf; + if (rt_recalc && !IS_LSA_SELF (new)) { /* RFC 2328 Section 13.2 Summary-LSAs @@ -2464,16 +2493,17 @@ ospf_summary_asbr_lsa_install (struct os /* register LSA to refresh-list. */ if (IS_LSA_SELF (new)) - ospf_refresher_register_lsa (ospf, new); + ospf_refresher_register_lsa (new); return new; } /* Install AS-external-LSA. */ struct ospf_lsa * -ospf_external_lsa_install (struct ospf *ospf, struct ospf_lsa *new, - int rt_recalc) +ospf_external_lsa_install (struct ospf_lsa *new, int rt_recalc) { + struct ospf *ospf = new->ospf; + ospf_ase_register_external_lsa (new, ospf); /* If LSA is not self-originated, calculate an external route. */ if (rt_recalc) @@ -2507,16 +2537,15 @@ ospf_external_lsa_install (struct ospf * * Leave Translated LSAs alone if NSSA is enabled */ if (IS_LSA_SELF (new) && !CHECK_FLAG (new->flags, OSPF_LSA_LOCAL_XLT ) ) - ospf_refresher_register_lsa (ospf, new); - + ospf_refresher_register_lsa (new); return new; } void -ospf_discard_from_db (struct ospf *ospf, - struct ospf_lsdb *lsdb, struct ospf_lsa *lsa) +ospf_discard_from_db (struct ospf_lsdb *lsdb, struct ospf_lsa *lsa) { struct ospf_lsa *old; + struct ospf *ospf = lsa->ospf; old = ospf_lsdb_lookup (lsdb, lsa); @@ -2524,7 +2553,7 @@ ospf_discard_from_db (struct ospf *ospf, return; if (old->refresh_list >= 0) - ospf_refresher_unregister_lsa (ospf, old); + ospf_refresher_unregister_lsa (old); switch (old->data->type) { @@ -2532,7 +2561,7 @@ ospf_discard_from_db (struct ospf *ospf, #ifdef HAVE_OPAQUE_LSA case OSPF_OPAQUE_AS_LSA: #endif /* HAVE_OPAQUE_LSA */ - ospf_ls_retransmit_delete_nbr_as (ospf, old); + ospf_ls_retransmit_delete_nbr_as (old); ospf_ase_unregister_external_lsa (old, ospf); break; case OSPF_AS_NSSA_LSA: @@ -2544,13 +2573,12 @@ ospf_discard_from_db (struct ospf *ospf, break; } - ospf_lsa_maxage_delete (ospf, old); + ospf_lsa_maxage_delete (old); ospf_lsa_discard (old); } struct ospf_lsa * -ospf_lsa_install (struct ospf *ospf, struct ospf_interface *oi, - struct ospf_lsa *lsa) +ospf_lsa_install (struct ospf_interface *oi, struct ospf_lsa *lsa) { struct ospf_lsa *new = NULL; struct ospf_lsa *old = NULL; @@ -2565,13 +2593,13 @@ ospf_lsa_install (struct ospf *ospf, str if (lsa->area) lsdb = lsa->area->lsdb; else - lsdb = ospf->lsdb; + lsdb = lsa->ospf->lsdb; break; case OSPF_AS_EXTERNAL_LSA: #ifdef HAVE_OPAQUE_LSA case OSPF_OPAQUE_AS_LSA: #endif /* HAVE_OPAQUE_LSA */ - lsdb = ospf->lsdb; + lsdb = lsa->ospf->lsdb; break; default: lsdb = lsa->area->lsdb; @@ -2621,20 +2649,19 @@ ospf_lsa_install (struct ospf *ospf, str can be originated. " */ - if (ntohl(lsa->data->ls_seqnum) - 1 == htonl(OSPF_MAX_SEQUENCE_NUMBER)) + if (ntohl(lsa->data->ls_seqnum) == (OSPF_MAX_SEQUENCE_NUMBER)) { - if (ospf_lsa_is_self_originated(ospf, lsa)) + if (ospf_lsa_is_self_originated(lsa)) { - lsa->data->ls_seqnum = htonl(OSPF_MAX_SEQUENCE_NUMBER); - - if (!IS_LSA_MAXAGE(lsa)) - lsa->flags |= OSPF_LSA_PREMATURE_AGE; + SET_FLAG (lsa->flags, OSPF_LSA_PREMATURE_AGE); + SET_FLAG (lsa->flags, OSPF_LSA_SEQ_WRAPPED); lsa->data->ls_age = htons (OSPF_LSA_MAXAGE); if (IS_DEBUG_OSPF (lsa, LSA_REFRESH)) { zlog_debug ("ospf_lsa_install() Premature Aging " - "lsa 0x%lx", (u_long)lsa); + "lsa 0x%p, seqnum %d", lsa, + ntohl(lsa->data->ls_seqnum)); ospf_lsa_header_dump (lsa->data); } } @@ -2642,8 +2669,9 @@ ospf_lsa_install (struct ospf *ospf, str { if (IS_DEBUG_OSPF (lsa, LSA_GENERATE)) { - zlog_debug ("ospf_lsa_install() got an lsa with seq 0x80000000 " - "that was not self originated. Ignoring\n"); + zlog_debug ("ospf_lsa_install() got an lsa with seq %d " + "that was not self originated. Ignoring\n", + ntohl(lsa->data->ls_seqnum)); ospf_lsa_header_dump (lsa->data); } return old; @@ -2652,7 +2680,7 @@ ospf_lsa_install (struct ospf *ospf, str /* discard old LSA from LSDB */ if (old != NULL) - ospf_discard_from_db (ospf, lsdb, lsa); + ospf_discard_from_db (lsdb, lsa); /* Calculate Checksum if self-originated?. */ if (IS_LSA_SELF (lsa)) @@ -2666,20 +2694,20 @@ ospf_lsa_install (struct ospf *ospf, str switch (lsa->data->type) { case OSPF_ROUTER_LSA: - new = ospf_router_lsa_install (ospf, lsa, rt_recalc); + new = ospf_router_lsa_install (lsa, rt_recalc); break; case OSPF_NETWORK_LSA: assert (oi); - new = ospf_network_lsa_install (ospf, oi, lsa, rt_recalc); + new = ospf_network_lsa_install (oi, lsa, rt_recalc); break; case OSPF_SUMMARY_LSA: - new = ospf_summary_lsa_install (ospf, lsa, rt_recalc); + new = ospf_summary_lsa_install (lsa, rt_recalc); break; case OSPF_ASBR_SUMMARY_LSA: - new = ospf_summary_asbr_lsa_install (ospf, lsa, rt_recalc); + new = ospf_summary_asbr_lsa_install (lsa, rt_recalc); break; case OSPF_AS_EXTERNAL_LSA: - new = ospf_external_lsa_install (ospf, lsa, rt_recalc); + new = ospf_external_lsa_install (lsa, rt_recalc); break; #ifdef HAVE_OPAQUE_LSA case OSPF_OPAQUE_LINK_LSA: @@ -2694,7 +2722,7 @@ ospf_lsa_install (struct ospf *ospf, str break; #endif /* HAVE_OPAQUE_LSA */ case OSPF_AS_NSSA_LSA: - new = ospf_external_lsa_install (ospf, lsa, rt_recalc); + new = ospf_external_lsa_install (lsa, rt_recalc); default: /* type-6,8,9....nothing special */ break; } @@ -2731,7 +2759,7 @@ ospf_lsa_install (struct ospf *ospf, str If received LSA' ls_age is MaxAge, or lsa is being prematurely aged (it's getting flushed out of the area), set LSA on MaxAge LSA list. */ - if ((lsa->flags & OSPF_LSA_PREMATURE_AGE) || + if ( (CHECK_FLAG (lsa->flags, OSPF_LSA_PREMATURE_AGE)) || (IS_LSA_MAXAGE (new) && !IS_LSA_SELF (new))) { if (IS_DEBUG_OSPF (lsa, LSA_INSTALL)) @@ -2739,7 +2767,7 @@ ospf_lsa_install (struct ospf *ospf, str new->data->type, inet_ntoa (new->data->id), lsa); - ospf_lsa_maxage (ospf, lsa); + ospf_lsa_maxage (lsa); } return new; @@ -2845,16 +2873,24 @@ ospf_maxage_lsa_remover (struct thread * ospf_flood_through (ospf, NULL, lsa); #endif /* ORIGINAL_CODING */ - if (lsa->flags & OSPF_LSA_PREMATURE_AGE) + if ( CHECK_FLAG (lsa->flags, OSPF_LSA_SEQ_WRAPPED) ) { if (IS_DEBUG_OSPF (lsa, LSA_FLOODING)) - zlog_debug ("originating new router lsa for lsa 0x%lx \n", + zlog_debug ("originating new lsa for lsa 0x%lx \n", (u_long)lsa); - ospf_router_lsa_originate(lsa->area); + UNSET_FLAG (lsa->flags, OSPF_LSA_SEQ_WRAPPED); + UNSET_FLAG (lsa->flags, OSPF_LSA_PREMATURE_AGE); + /* really we should be waiting for all neighbours + * to acknowledge the flush before reoriginating, however + * we dont have ability to do this at moment. + */ + lsa->data->ls_seqnum = htonl(OSPF_INITIAL_SEQUENCE_NUMBER); + lsa->data->ls_age = htons(OSPF_LSA_MINAGE); + ospf_lsa_refresh (lsa); } /* Remove from lsdb. */ - ospf_discard_from_db (ospf, lsa->lsdb, lsa); + ospf_discard_from_db (lsa->lsdb, lsa); ospf_lsdb_delete (lsa->lsdb, lsa); } @@ -2869,11 +2905,11 @@ ospf_maxage_lsa_remover (struct thread * } int -ospf_lsa_maxage_exist (struct ospf *ospf, struct ospf_lsa *new) +ospf_lsa_maxage_exist (struct ospf_lsa *new) { struct listnode *node; - for (node = listhead (ospf->maxage_lsa); node; nextnode (node)) + for (node = listhead (new->ospf->maxage_lsa); node; nextnode (node)) if (((struct ospf_lsa *) node->data) == new) return 1; @@ -2881,23 +2917,25 @@ ospf_lsa_maxage_exist (struct ospf *ospf } void -ospf_lsa_maxage_delete (struct ospf *ospf, struct ospf_lsa *lsa) +ospf_lsa_maxage_delete (struct ospf_lsa *lsa) { struct listnode *n; - if ((n = listnode_lookup (ospf->maxage_lsa, lsa))) + if ((n = listnode_lookup (lsa->ospf->maxage_lsa, lsa))) { - list_delete_node (ospf->maxage_lsa, n); + list_delete_node (lsa->ospf->maxage_lsa, n); ospf_lsa_unlock (lsa); } } void -ospf_lsa_maxage (struct ospf *ospf, struct ospf_lsa *lsa) +ospf_lsa_maxage (struct ospf_lsa *lsa) { + struct ospf *ospf = lsa->ospf; + /* When we saw a MaxAge LSA flooded to us, we put it on the list and schedule the MaxAge LSA remover. */ - if (ospf_lsa_maxage_exist (ospf, lsa)) + if (ospf_lsa_maxage_exist (lsa)) { if (IS_DEBUG_OSPF (lsa, LSA_FLOODING)) zlog_debug ("LSA[Type%d:%s]: %p already exists on MaxAge LSA list", @@ -2914,8 +2952,10 @@ ospf_lsa_maxage (struct ospf *ospf, stru } int -ospf_lsa_maxage_walker_remover (struct ospf *ospf, struct ospf_lsa *lsa) +ospf_lsa_maxage_walker_remover (struct ospf_lsa *lsa) { + struct ospf *ospf = lsa->ospf; + /* Stay away from any Local Translated Type-7 LSAs */ if (CHECK_FLAG (lsa->flags, OSPF_LSA_LOCAL_XLT)) return 0; @@ -2923,7 +2963,7 @@ ospf_lsa_maxage_walker_remover (struct o if (IS_LSA_MAXAGE (lsa)) /* Self-originated LSAs should NOT time-out instead, they're flushed and submitted to the max_age list explicitly. */ - if (!ospf_lsa_is_self_originated (ospf, lsa)) + if (!ospf_lsa_is_self_originated (lsa)) { if (IS_DEBUG_OSPF (lsa, LSA_FLOODING)) zlog_debug("LSA[%s]: is MaxAge", dump_lsa_key (lsa)); @@ -2952,7 +2992,7 @@ ospf_lsa_maxage_walker_remover (struct o ospf_spf_calculate_schedule (ospf); break; } - ospf_lsa_maxage (ospf, lsa); + ospf_lsa_maxage (lsa); } return 0; @@ -2974,31 +3014,31 @@ ospf_lsa_maxage_walker (struct thread *t struct ospf_area *area = node->data; LSDB_LOOP (ROUTER_LSDB (area), rn, lsa) - ospf_lsa_maxage_walker_remover (ospf, lsa); + ospf_lsa_maxage_walker_remover (lsa); LSDB_LOOP (NETWORK_LSDB (area), rn, lsa) - ospf_lsa_maxage_walker_remover (ospf, lsa); + ospf_lsa_maxage_walker_remover (lsa); LSDB_LOOP (SUMMARY_LSDB (area), rn, lsa) - ospf_lsa_maxage_walker_remover (ospf, lsa); + ospf_lsa_maxage_walker_remover (lsa); LSDB_LOOP (ASBR_SUMMARY_LSDB (area), rn, lsa) - ospf_lsa_maxage_walker_remover (ospf, lsa); + ospf_lsa_maxage_walker_remover (lsa); #ifdef HAVE_OPAQUE_LSA LSDB_LOOP (OPAQUE_AREA_LSDB (area), rn, lsa) - ospf_lsa_maxage_walker_remover (ospf, lsa); + ospf_lsa_maxage_walker_remover (lsa); LSDB_LOOP (OPAQUE_LINK_LSDB (area), rn, lsa) - ospf_lsa_maxage_walker_remover (ospf, lsa); + ospf_lsa_maxage_walker_remover (lsa); #endif /* HAVE_OPAQUE_LSA */ LSDB_LOOP (NSSA_LSDB (area), rn, lsa) - ospf_lsa_maxage_walker_remover (ospf, lsa); + ospf_lsa_maxage_walker_remover (lsa); } /* for AS-external-LSAs. */ if (ospf->lsdb) { LSDB_LOOP (EXTERNAL_LSDB (ospf), rn, lsa) - ospf_lsa_maxage_walker_remover (ospf, lsa); + ospf_lsa_maxage_walker_remover (lsa); #ifdef HAVE_OPAQUE_LSA LSDB_LOOP (OPAQUE_AS_LSDB (ospf), rn, lsa) - ospf_lsa_maxage_walker_remover (ospf, lsa); + ospf_lsa_maxage_walker_remover (lsa); #endif /* HAVE_OPAQUE_LSA */ } @@ -3282,7 +3322,7 @@ ospf_lsa_flush_schedule (struct ospf *os break; #endif /* HAVE_OPAQUE_LSA */ default: - ospf_lsa_maxage (ospf, lsa); + ospf_lsa_maxage (lsa); break; } @@ -3312,7 +3352,6 @@ ospf_flush_self_originated_lsas_now (str ospf_lsa_flush_area (lsa, area); ospf_lsa_unlock (area->router_lsa_self); area->router_lsa_self = NULL; - OSPF_TIMER_OFF (area->t_router_lsa_self); } for (n2 = listhead (area->oiflist); n2; nextnode (n2)) @@ -3330,7 +3369,6 @@ ospf_flush_self_originated_lsas_now (str ospf_lsa_flush_area (oi->network_lsa_self, area); ospf_lsa_unlock (oi->network_lsa_self); oi->network_lsa_self = NULL; - OSPF_TIMER_OFF (oi->t_network_lsa_self); } if (oi->type != OSPF_IFTYPE_VIRTUALLINK @@ -3377,8 +3415,9 @@ ospf_flush_self_originated_lsas_now (str /* If there is self-originated LSA, then return 1, otherwise return 0. */ /* An interface-independent version of ospf_lsa_is_self_originated */ int -ospf_lsa_is_self_originated (struct ospf *ospf, struct ospf_lsa *lsa) +ospf_lsa_is_self_originated (struct ospf_lsa *lsa) { + struct ospf *ospf = lsa->ospf; struct listnode *node; /* This LSA is already checked. */ @@ -3514,7 +3553,7 @@ ospf_lsa_action (struct thread *t) ospf_lsa_flush_area (data->lsa, data->area); break; case LSA_ACTION_FLUSH_AS: - ospf_lsa_flush_as (ospf, data->lsa); + ospf_lsa_flush_as (data->lsa); break; } @@ -3554,9 +3593,8 @@ ospf_schedule_lsa_flush_area (struct osp } -/* LSA Refreshment functions. */ void -ospf_lsa_refresh (struct ospf *ospf, struct ospf_lsa *lsa) +ospf_lsa_refresh (struct ospf_lsa *lsa) { struct external_info *ei; assert (CHECK_FLAG (lsa->flags, OSPF_LSA_SELF)); @@ -3565,13 +3603,16 @@ ospf_lsa_refresh (struct ospf *ospf, str { /* Router and Network LSAs are processed differently. */ case OSPF_ROUTER_LSA: + ospf_router_lsa_refresh (lsa); + break; case OSPF_NETWORK_LSA: + ospf_network_lsa_refresh (lsa); break; case OSPF_SUMMARY_LSA: - ospf_summary_lsa_refresh (ospf, lsa); + ospf_summary_lsa_refresh (lsa); break; case OSPF_ASBR_SUMMARY_LSA: - ospf_summary_asbr_lsa_refresh (ospf, lsa); + ospf_summary_asbr_lsa_refresh (lsa); break; case OSPF_AS_EXTERNAL_LSA: /* Translated from NSSA Type-5s are refreshed when @@ -3581,9 +3622,9 @@ ospf_lsa_refresh (struct ospf *ospf, str break; ei = ospf_external_info_check (lsa); if (ei) - ospf_external_lsa_refresh (ospf, lsa, ei, LSA_REFRESH_FORCE); + ospf_external_lsa_refresh (lsa, ei, LSA_REFRESH_FORCE); else - ospf_lsa_flush_as (ospf, lsa); + ospf_lsa_flush_as (lsa); break; #ifdef HAVE_OPAQUE_LSA case OSPF_OPAQUE_LINK_LSA: @@ -3597,10 +3638,12 @@ ospf_lsa_refresh (struct ospf *ospf, str } } +/* LSA Refreshment functions. */ void -ospf_refresher_register_lsa (struct ospf *ospf, struct ospf_lsa *lsa) +ospf_refresher_register_lsa (struct ospf_lsa *lsa) { u_int16_t index, current_index; + struct ospf *ospf = lsa->ospf; assert (CHECK_FLAG (lsa->flags, OSPF_LSA_SELF)); @@ -3621,7 +3664,8 @@ ospf_refresher_register_lsa (struct ospf delay = 0; current_index = ospf->lsa_refresh_queue.index + - (time (NULL) - ospf->lsa_refresher_started)/OSPF_LSA_REFRESHER_GRANULARITY; + (time (NULL) - + ospf->lsa_refresher_started) / OSPF_LSA_REFRESHER_GRANULARITY; index = (current_index + delay/OSPF_LSA_REFRESHER_GRANULARITY) % (OSPF_LSA_REFRESHER_SLOTS); @@ -3641,8 +3685,10 @@ ospf_refresher_register_lsa (struct ospf } void -ospf_refresher_unregister_lsa (struct ospf *ospf, struct ospf_lsa *lsa) +ospf_refresher_unregister_lsa (struct ospf_lsa *lsa) { + struct ospf *ospf = lsa->ospf; + assert (CHECK_FLAG (lsa->flags, OSPF_LSA_SELF)); if (lsa->refresh_list >= 0) { @@ -3675,8 +3721,9 @@ ospf_lsa_refresh_walker (struct thread * ospf->lsa_refresh_queue.index = (ospf->lsa_refresh_queue.index + - (time (NULL) - ospf->lsa_refresher_started) / OSPF_LSA_REFRESHER_GRANULARITY) - % OSPF_LSA_REFRESHER_SLOTS; + (time (NULL) - + ospf->lsa_refresher_started) / OSPF_LSA_REFRESHER_GRANULARITY) % + OSPF_LSA_REFRESHER_SLOTS; if (IS_DEBUG_OSPF (lsa, LSA_REFRESH)) zlog_debug ("LSA[Refresh]: ospf_lsa_refresh_walker(): next index %d", @@ -3721,7 +3768,7 @@ ospf_lsa_refresh_walker (struct thread * ospf->lsa_refresher_started = time (NULL); for (node = listhead (lsa_to_refresh); node; nextnode (node)) - ospf_lsa_refresh (ospf, getdata (node)); + ospf_lsa_refresh (getdata (node)); list_delete (lsa_to_refresh); @@ -3730,4 +3777,3 @@ ospf_lsa_refresh_walker (struct thread * return 0; } - Index: ospf_lsa.h =================================================================== RCS file: /var/cvsroot/quagga/ospfd/ospf_lsa.h,v retrieving revision 1.10 diff -u -w -b -p -r1.10 ospf_lsa.h --- ospf_lsa.h 23 Feb 2005 11:29:02 -0000 1.10 +++ ospf_lsa.h 25 Feb 2005 10:51:01 -0000 @@ -68,6 +68,9 @@ struct lsa_header /* OSPF LSA. */ struct ospf_lsa { + /* OSPF instance */ + struct ospf *ospf; + /* LSA origination flag. */ u_char flags; #define OSPF_LSA_SELF 0x01 @@ -77,6 +80,8 @@ struct ospf_lsa #define OSPF_LSA_DISCARD 0x10 #define OSPF_LSA_LOCAL_XLT 0x20 #define OSPF_LSA_PREMATURE_AGE 0x40 +#define OSPF_LSA_PREMATURE_AGE 0x40 +#define OSPF_LSA_SEQ_WRAPPED 0x80 /* LSA data. */ struct lsa_header *data; @@ -111,10 +116,8 @@ struct ospf_lsa /* Refreshement List or Queue */ int refresh_list; -#ifdef HAVE_OPAQUE_LSA - /* For Type-9 Opaque-LSAs, reference to ospf-interface is required. */ + /* For Type-9 Opaque-LSAs or Network-LSAs */ struct ospf_interface *oi; -#endif /* HAVE_OPAQUE_LSA */ }; /* OSPF LSA Link Type. */ @@ -253,22 +256,21 @@ void ospf_lsa_data_free (struct lsa_head /* Prototype for various LSAs */ struct ospf_lsa *ospf_router_lsa_originate (struct ospf_area *); -int ospf_router_lsa_update_timer (struct thread *); -void ospf_router_lsa_timer_add (struct ospf_area *); +int ospf_router_lsa_update (struct ospf *); +int ospf_router_lsa_update_area (struct ospf_area *); -int ospf_network_lsa_refresh (struct ospf_lsa *, struct ospf_interface *); -void ospf_network_lsa_timer_add (struct ospf_interface *); +int ospf_network_lsa_refresh (struct ospf_lsa *); +void ospf_network_lsa_update (struct ospf_interface *); struct ospf_lsa *ospf_summary_lsa_originate (struct prefix_ipv4 *, u_int32_t, struct ospf_area *); struct ospf_lsa *ospf_summary_asbr_lsa_originate (struct prefix_ipv4 *, u_int32_t, struct ospf_area *); -struct ospf_lsa *ospf_summary_lsa_refresh (struct ospf *, struct ospf_lsa *); -struct ospf_lsa *ospf_summary_asbr_lsa_refresh (struct ospf *, struct ospf_lsa *); +struct ospf_lsa *ospf_summary_lsa_refresh (struct ospf_lsa *); +struct ospf_lsa *ospf_summary_asbr_lsa_refresh (struct ospf_lsa *); -struct ospf_lsa *ospf_lsa_install (struct ospf *, - struct ospf_interface *, struct ospf_lsa *); +struct ospf_lsa *ospf_lsa_install (struct ospf_interface *, struct ospf_lsa *); void ospf_nssa_lsa_flush (struct ospf *ospf, struct prefix_ipv4 *p); void ospf_external_lsa_flush (struct ospf *, u_char, struct prefix_ipv4 *, @@ -289,34 +291,34 @@ int ospf_lsa_more_recent (struct ospf_ls int ospf_lsa_different (struct ospf_lsa *, struct ospf_lsa *); void ospf_flush_self_originated_lsas_now (struct ospf *); -int ospf_lsa_is_self_originated (struct ospf *, struct ospf_lsa *); +int ospf_lsa_is_self_originated (struct ospf_lsa *); struct ospf_lsa *ospf_lsa_lookup_by_prefix (struct ospf_lsdb *, u_char, struct prefix_ipv4 *, struct in_addr); -void ospf_lsa_maxage (struct ospf *, struct ospf_lsa *); +void ospf_lsa_maxage (struct ospf_lsa *); u_int32_t get_metric (u_char *); int ospf_lsa_maxage_walker (struct thread *); +void ospf_lsa_refresh (struct ospf_lsa *); void ospf_external_lsa_refresh_default (struct ospf *); void ospf_external_lsa_refresh_type (struct ospf *, u_char, int); -void ospf_external_lsa_refresh (struct ospf *, struct ospf_lsa *, - struct external_info *, int); +void ospf_external_lsa_refresh (struct ospf_lsa *, struct external_info *, int); struct in_addr ospf_lsa_unique_id (struct ospf *, struct ospf_lsdb *, u_char, struct prefix_ipv4 *); void ospf_schedule_lsa_flood_area (struct ospf_area *, struct ospf_lsa *); void ospf_schedule_lsa_flush_area (struct ospf_area *, struct ospf_lsa *); -void ospf_refresher_register_lsa (struct ospf *, struct ospf_lsa *); -void ospf_refresher_unregister_lsa (struct ospf *, struct ospf_lsa *); +void ospf_refresher_register_lsa (struct ospf_lsa *); +void ospf_refresher_unregister_lsa (struct ospf_lsa *); int ospf_lsa_refresh_walker (struct thread *); -void ospf_lsa_maxage_delete (struct ospf *, struct ospf_lsa *); +void ospf_lsa_maxage_delete (struct ospf_lsa *); -void ospf_discard_from_db (struct ospf *, struct ospf_lsdb *, struct ospf_lsa*); +void ospf_discard_from_db (struct ospf_lsdb *, struct ospf_lsa*); int is_prefix_default (struct prefix_ipv4 *); int metric_type (struct ospf *, u_char); Index: ospf_nsm.c =================================================================== RCS file: /var/cvsroot/quagga/ospfd/ospf_nsm.c,v retrieving revision 1.9 diff -u -w -b -p -r1.9 ospf_nsm.c --- ospf_nsm.c 11 Dec 2004 18:00:06 -0000 1.9 +++ ospf_nsm.c 25 Feb 2005 10:51:02 -0000 @@ -732,7 +732,7 @@ nsm_change_state (struct ospf_neighbor * LOOKUP(ospf_nsm_state_msg, old_state), LOOKUP(ospf_nsm_state_msg, state)); - ospf_router_lsa_timer_add (oi->area); + ospf_router_lsa_update_area (oi->area); if (oi->type == OSPF_IFTYPE_VIRTUALLINK) { @@ -740,7 +740,7 @@ nsm_change_state (struct ospf_neighbor * ospf_area_lookup_by_area_id (oi->ospf, oi->vl_data->vl_area_id); if (vl_area) - ospf_router_lsa_timer_add (vl_area); + ospf_router_lsa_update_area (vl_area); } /* Originate network-LSA. */ @@ -751,10 +751,9 @@ nsm_change_state (struct ospf_neighbor * ospf_lsa_flush_area (oi->network_lsa_self, oi->area); ospf_lsa_unlock (oi->network_lsa_self); oi->network_lsa_self = NULL; - OSPF_TIMER_OFF (oi->t_network_lsa_self); } else - ospf_network_lsa_timer_add (oi); + ospf_lsa_refresh (oi->network_lsa_self); } } Index: ospf_opaque.c =================================================================== RCS file: /var/cvsroot/quagga/ospfd/ospf_opaque.c,v retrieving revision 1.13 diff -u -w -b -p -r1.13 ospf_opaque.c --- ospf_opaque.c 9 Dec 2004 14:49:51 -0000 1.13 +++ ospf_opaque.c 25 Feb 2005 10:51:04 -0000 @@ -2027,7 +2027,7 @@ ospf_opaque_lsa_refresh_schedule (struct ospf_ls_retransmit_delete_nbr_area (lsa->area, lsa); break; case OSPF_OPAQUE_AS_LSA: - ospf_ls_retransmit_delete_nbr_as (ospf, lsa); + ospf_ls_retransmit_delete_nbr_as (lsa); break; default: zlog_warn ("ospf_opaque_lsa_refresh_schedule: Unexpected LSA-type(%u)", lsa->data->type); @@ -2098,7 +2098,7 @@ ospf_opaque_lsa_flush_schedule (struct o ospf_ls_retransmit_delete_nbr_area (lsa->area, lsa); break; case OSPF_OPAQUE_AS_LSA: - ospf_ls_retransmit_delete_nbr_as (ospf, lsa); + ospf_ls_retransmit_delete_nbr_as (lsa); break; default: zlog_warn ("ospf_opaque_lsa_flush_schedule: Unexpected LSA-type(%u)", lsa->data->type); Index: ospf_packet.c =================================================================== RCS file: /var/cvsroot/quagga/ospfd/ospf_packet.c,v retrieving revision 1.72 diff -u -w -b -p -r1.72 ospf_packet.c --- ospf_packet.c 23 Feb 2005 15:43:01 -0000 1.72 +++ ospf_packet.c 25 Feb 2005 10:51:06 -0000 @@ -1026,7 +1026,7 @@ ospf_db_desc_proc (struct stream *s, str } /* Create LS-request object. */ - new = ospf_ls_request_new (lsah); + new = ospf_ls_request_new (oi->ospf, lsah); /* Lookup received LSA, then add LS request list. */ find = ospf_lsa_lookup_by_header (oi->area, lsah); @@ -1520,7 +1520,8 @@ ospf_ls_upd_list_lsa (struct ospf_neighb * This neighbor must know the exact usage of O-bit; * the bit will be set in Type-9,10,11 LSAs only. */ - zlog_warn ("LSA[Type%d:%s]: O-bit abuse?", lsah->type, inet_ntoa (lsah->id)); + zlog_warn ("LSA[Type%d:%s]: O-bit abuse?", lsah->type, + inet_ntoa (lsah->id)); continue; } #endif /* STRICT_OBIT_USAGE_CHECK */ @@ -1536,13 +1537,15 @@ ospf_ls_upd_list_lsa (struct ospf_neighb } else if (IS_OPAQUE_LSA(lsah->type)) { - zlog_warn ("LSA[Type%d:%s]: Opaque capability mismatch?", lsah->type, inet_ntoa (lsah->id)); + zlog_warn ("LSA[Type%d:%s]: Opaque capability mismatch?", + lsah->type, inet_ntoa (lsah->id)); continue; } #endif /* HAVE_OPAQUE_LSA */ /* Create OSPF LSA instance. */ lsa = ospf_lsa_new (); + lsa->ospf = nbr->oi->ospf; /* We may wish to put some error checking if type NSSA comes in and area not in NSSA mode */ @@ -1993,6 +1996,7 @@ ospf_ls_ack (struct ip *iph, struct ospf struct ospf_lsa *lsa, *lsr; lsa = ospf_lsa_new (); + lsa->ospf = nbr->oi->ospf; lsa->data = (struct lsa_header *) STREAM_PNT (s); /* lsah = (struct lsa_header *) STREAM_PNT (s); */ Index: ospf_route.c =================================================================== RCS file: /var/cvsroot/quagga/ospfd/ospf_route.c,v retrieving revision 1.11 diff -u -w -b -p -r1.11 ospf_route.c --- ospf_route.c 8 Dec 2004 18:53:34 -0000 1.11 +++ ospf_route.c 25 Feb 2005 10:51:07 -0000 @@ -193,7 +193,8 @@ ospf_route_delete_same_ext(struct route_ if (rn && rn->info) { struct prefix_ipv4 *p = (struct prefix_ipv4 *)(&rn->p); - if ( (ext_rn = route_node_lookup (external_routes, (struct prefix *)p)) ) + if ( (ext_rn = route_node_lookup (external_routes, + (struct prefix *) p)) ) { ospf_zebra_delete (p, ext_rn->info); if (ext_rn->info) Index: ospf_zebra.c =================================================================== RCS file: /var/cvsroot/quagga/ospfd/ospf_zebra.c,v retrieving revision 1.26 diff -u -w -b -p -r1.26 ospf_zebra.c --- ospf_zebra.c 15 Dec 2004 15:07:19 -0000 1.26 +++ ospf_zebra.c 25 Feb 2005 10:51:07 -0000 @@ -853,7 +853,7 @@ ospf_zebra_read_ipv4 (int command, struc if (!current) ospf_external_lsa_originate (ospf, ei); else if (IS_LSA_MAXAGE (current)) - ospf_external_lsa_refresh (ospf, current, + ospf_external_lsa_refresh (current, ei, LSA_REFRESH_FORCE); else zlog_warn ("ospf_zebra_read_ipv4() : %s already exists", @@ -946,7 +946,7 @@ ospf_distribute_list_update_timer (struc if (is_prefix_default (&ei->p)) ospf_external_lsa_refresh_default (ospf); else if ((lsa = ospf_external_info_find_lsa (ospf, &ei->p))) - ospf_external_lsa_refresh (ospf, lsa, ei, LSA_REFRESH_IF_CHANGED); + ospf_external_lsa_refresh (lsa, ei, LSA_REFRESH_IF_CHANGED); else ospf_external_lsa_originate (ospf, ei); } Index: ospfd.c =================================================================== RCS file: /var/cvsroot/quagga/ospfd/ospfd.c,v retrieving revision 1.29 diff -u -w -b -p -r1.29 ospfd.c --- ospfd.c 23 Feb 2005 15:43:01 -0000 1.29 +++ ospfd.c 25 Feb 2005 10:51:08 -0000 @@ -119,8 +119,8 @@ ospf_router_id_update (struct ospf *ospf ospf->external_origin = 0; } - OSPF_TIMER_ON (ospf->t_router_lsa_update, - ospf_router_lsa_update_timer, OSPF_LSA_UPDATE_DELAY); + /* update router-lsa's for each area */ + ospf_router_lsa_update (ospf); } } @@ -374,10 +374,10 @@ ospf_finish (struct ospf *ospf) #ifdef HAVE_OPAQUE_LSA LSDB_LOOP (OPAQUE_AS_LSDB (ospf), rn, lsa) - ospf_discard_from_db (ospf, ospf->lsdb, lsa); + ospf_discard_from_db (ospf->lsdb, lsa); #endif /* HAVE_OPAQUE_LSA */ LSDB_LOOP (EXTERNAL_LSDB (ospf), rn, lsa) - ospf_discard_from_db (ospf, ospf->lsdb, lsa); + ospf_discard_from_db (ospf->lsdb, lsa); ospf_lsdb_delete_all (ospf->lsdb); ospf_lsdb_free (ospf->lsdb); @@ -480,21 +480,21 @@ ospf_area_free (struct ospf_area *area) /* Free LSDBs. */ LSDB_LOOP (ROUTER_LSDB (area), rn, lsa) - ospf_discard_from_db (area->ospf, area->lsdb, lsa); + ospf_discard_from_db (area->lsdb, lsa); LSDB_LOOP (NETWORK_LSDB (area), rn, lsa) - ospf_discard_from_db (area->ospf, area->lsdb, lsa); + ospf_discard_from_db (area->lsdb, lsa); LSDB_LOOP (SUMMARY_LSDB (area), rn, lsa) - ospf_discard_from_db (area->ospf, area->lsdb, lsa); + ospf_discard_from_db (area->lsdb, lsa); LSDB_LOOP (ASBR_SUMMARY_LSDB (area), rn, lsa) - ospf_discard_from_db (area->ospf, area->lsdb, lsa); + ospf_discard_from_db (area->lsdb, lsa); LSDB_LOOP (NSSA_LSDB (area), rn, lsa) - ospf_discard_from_db (area->ospf, area->lsdb, lsa); + ospf_discard_from_db (area->lsdb, lsa); #ifdef HAVE_OPAQUE_LSA LSDB_LOOP (OPAQUE_AREA_LSDB (area), rn, lsa) - ospf_discard_from_db (area->ospf, area->lsdb, lsa); + ospf_discard_from_db (area->lsdb, lsa); LSDB_LOOP (OPAQUE_LINK_LSDB (area), rn, lsa) - ospf_discard_from_db (area->ospf, area->lsdb, lsa); + ospf_discard_from_db (area->lsdb, lsa); #endif /* HAVE_OPAQUE_LSA */ ospf_lsdb_delete_all (area->lsdb); @@ -511,9 +511,6 @@ ospf_area_free (struct ospf_area *area) if (IMPORT_NAME (area)) free (IMPORT_NAME (area)); - /* Cancel timer. */ - OSPF_TIMER_OFF (area->t_router_lsa_self); - if (OSPF_IS_AREA_BACKBONE (area)) area->ospf->backbone = NULL; @@ -999,7 +996,7 @@ ospf_area_type_set (struct ospf_area *ar break; } - ospf_router_lsa_timer_add (area); + ospf_router_lsa_update_area (area); ospf_schedule_abr_task (area->ospf); } @@ -1010,7 +1007,7 @@ ospf_area_shortcut_set (struct ospf *osp return 0; area->shortcut_configured = mode; - ospf_router_lsa_timer_add (area); + ospf_router_lsa_update_area (area); ospf_schedule_abr_task (ospf); ospf_area_check_free (ospf, area->area_id); @@ -1022,7 +1019,7 @@ int ospf_area_shortcut_unset (struct ospf *ospf, struct ospf_area *area) { area->shortcut_configured = OSPF_SHORTCUT_DEFAULT; - ospf_router_lsa_timer_add (area); + ospf_router_lsa_update_area (area); ospf_area_check_free (ospf, area->area_id); ospf_schedule_abr_task (ospf); Index: ospfd.h =================================================================== RCS file: /var/cvsroot/quagga/ospfd/ospfd.h,v retrieving revision 1.12 diff -u -w -b -p -r1.12 ospfd.h --- ospfd.h 23 Feb 2005 15:43:01 -0000 1.12 +++ ospfd.h 25 Feb 2005 10:51:09 -0000 @@ -55,6 +55,7 @@ #endif #define OSPF_MIN_LS_INTERVAL 5 #define OSPF_MIN_LS_ARRIVAL 1 +#define OSPF_LSA_MINAGE 0 #define OSPF_LSA_MAXAGE 3600 #define OSPF_CHECK_AGE 300 #define OSPF_LSA_MAXAGE_DIFF 900 @@ -405,7 +406,6 @@ struct ospf_area struct vertex *spf; /* Threads. */ - struct thread *t_router_lsa_self;/* Self-originated router-LSA timer. */ #ifdef HAVE_OPAQUE_LSA struct thread *t_opaque_lsa_self; /* Type-10 Opaque-LSAs origin. */ #endif /* HAVE_OPAQUE_LSA */