? ospfd/.nfs000ec4760000fe94 ? ospfd/DEADJOE Index: ospfd/ospf_abr.c =================================================================== RCS file: /var/cvsroot/quagga/ospfd/ospf_abr.c,v retrieving revision 1.7 diff -u -r1.7 ospf_abr.c --- ospfd/ospf_abr.c 4 Mar 2004 17:45:01 -0000 1.7 +++ ospfd/ospf_abr.c 8 Apr 2004 03:10:10 -0000 @@ -555,8 +555,7 @@ if (IS_DEBUG_OSPF_EVENT) zlog_info ("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); } } @@ -752,7 +751,7 @@ zlog_info ("ospf_abr_announce_network_to_area(): " "refreshing summary"); set_metric (old, cost); - lsa = ospf_summary_lsa_refresh (area->ospf, old); + ospf_lsa_refresh (area->ospf, old); /* This will flood through area. */ } } @@ -1123,7 +1122,7 @@ if (old) { set_metric (old, cost); - lsa = ospf_summary_asbr_lsa_refresh (area->ospf, old); + ospf_lsa_refresh (area->ospf, old); } else lsa = ospf_summary_asbr_lsa_originate (p, cost, area); Index: ospfd/ospf_asbr.c =================================================================== RCS file: /var/cvsroot/quagga/ospfd/ospf_asbr.c,v retrieving revision 1.1.1.3 diff -u -r1.1.1.3 ospf_asbr.c --- ospfd/ospf_asbr.c 4 Apr 2003 02:35:30 -0000 1.1.1.3 +++ ospfd/ospf_asbr.c 8 Apr 2004 03:10:10 -0000 @@ -265,8 +265,7 @@ /* 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: ospfd/ospf_flood.c =================================================================== RCS file: /var/cvsroot/quagga/ospfd/ospf_flood.c,v retrieving revision 1.8 diff -u -r1.8 ospf_flood.c --- ospfd/ospf_flood.c 4 Mar 2004 17:45:01 -0000 1.8 +++ ospfd/ospf_flood.c 8 Apr 2004 03:10:11 -0000 @@ -137,7 +137,7 @@ 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 @@ oi->network_lsa_self = ospf_lsa_lock (new); /* Schedule network-LSA origination. */ - ospf_network_lsa_timer_add (oi); + ospf_lsa_refresh (oi->ospf, oi->network_lsa_self); return; } break; Index: ospfd/ospf_interface.c =================================================================== RCS file: /var/cvsroot/quagga/ospfd/ospf_interface.c,v retrieving revision 1.21 diff -u -r1.21 ospf_interface.c --- ospfd/ospf_interface.c 17 Feb 2004 20:07:30 -0000 1.21 +++ ospfd/ospf_interface.c 8 Apr 2004 03:10:12 -0000 @@ -97,7 +97,7 @@ if (oi->output_cost != newcost) { oi->output_cost = newcost; - ospf_router_lsa_timer_add (oi->area); + ospf_router_lsa_update_area (oi->area); } } } @@ -302,7 +302,6 @@ ospf_lsa_unlock (oi->network_lsa_self); oi->network_lsa_self = NULL; - OSPF_TIMER_OFF (oi->t_network_lsa_self); } void @@ -1007,7 +1006,7 @@ if (IS_DEBUG_OSPF (ism, ISM_EVENTS)) zlog_info ("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_info ("ospf_vl_up_check: VL cost change, no backbone!"); } Index: ospfd/ospf_interface.h =================================================================== RCS file: /var/cvsroot/quagga/ospfd/ospf_interface.h,v retrieving revision 1.2 diff -u -r1.2 ospf_interface.h --- ospfd/ospf_interface.h 11 Feb 2004 21:52:13 -0000 1.2 +++ ospfd/ospf_interface.h 8 Apr 2004 03:10:12 -0000 @@ -168,8 +168,7 @@ 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: ospfd/ospf_ism.c =================================================================== RCS file: /var/cvsroot/quagga/ospfd/ospf_ism.c,v retrieving revision 1.3 diff -u -r1.3 ospf_ism.c --- ospfd/ospf_ism.c 25 Mar 2003 05:07:53 -0000 1.3 +++ ospfd/ospf_ism.c 8 Apr 2004 03:10:13 -0000 @@ -595,13 +595,18 @@ 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); + { + if (oi->network_lsa_self) + ospf_lsa_refresh (oi->ospf, oi->network_lsa_self); + else + ospf_network_lsa_originate (oi); + } else if (old_state == ISM_DR && state != ISM_DR) { /* Free self originated network LSA. */ @@ -609,7 +614,6 @@ 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: ospfd/ospf_lsa.c =================================================================== RCS file: /var/cvsroot/quagga/ospfd/ospf_lsa.c,v retrieving revision 1.23 diff -u -r1.23 ospf_lsa.c --- ospfd/ospf_lsa.c 13 Oct 2003 09:06:46 -0000 1.23 +++ ospfd/ospf_lsa.c 8 Apr 2004 03:10:15 -0000 @@ -389,6 +389,15 @@ 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 @@ 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 = 0x7ffffffa; + static int inseqc = 0; +#endif /* test seqnum wrapping */ lsah = (struct lsa_header *) STREAM_DATA (s); @@ -405,6 +419,15 @@ 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); ospf_output_forward (s, OSPF_LSA_HEADER_SIZE); @@ -783,14 +806,21 @@ if (new->data->adv_router.s_addr == 0) { if (IS_DEBUG_OSPF_EVENT) - zlog_info ("LSA[Type1]: AdvRouter is 0, discard"); + zlog_info ("LSA[Type1]: AdvRouter is 0, discard"); ospf_lsa_discard (new); return NULL; } /* Install LSA to LSDB. */ - new = ospf_lsa_install (area->ospf, NULL, new); - + if ( (new = ospf_lsa_install (area->ospf, NULL, new)) == NULL) + { + if (IS_DEBUG_OSPF (lsa, LSA_GENERATE)) + { + zlog_err ("LSA: ospf_lsa_install failed"); + } + return NULL; + } + /* Update LSA origination count. */ area->ospf->lsa_originate_count++; @@ -820,12 +850,21 @@ /* Delete LSA from neighbor retransmit-list. */ ospf_ls_retransmit_delete_nbr_area (area, lsa); + /* Unregister LSA from refresh-list */ + ospf_refresher_unregister_lsa (area->ospf, 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); - + if ( (new= ospf_lsa_install (area->ospf, NULL, new)) == NULL) + { + if (IS_DEBUG_OSPF (lsa, LSA_GENERATE)) + { + zlog_err ("LSA: ospf_lsa_install failed"); + } + return NULL; + } /* Flood LSA through area. */ ospf_flood_through_area (area, NULL, new); @@ -841,19 +880,15 @@ } 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_info ("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->ospf, area->router_lsa_self); /* Newly originate router-LSA. */ else ospf_router_lsa_originate (area); @@ -861,6 +896,7 @@ return 0; } +#if 0 void ospf_router_lsa_timer_add (struct ospf_area *area) { @@ -892,11 +928,11 @@ /* 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); listnode node; if (IS_DEBUG_OSPF (lsa, LSA_GENERATE)) @@ -917,38 +953,37 @@ /* If LSA not exist in this Area, originate new. */ if (lsa == NULL) { - if (IS_DEBUG_OSPF (lsa, LSA_GENERATE)) - zlog_info("LSA[Type1]: Create router-LSA for Area %s", area_str); + if (IS_DEBUG_OSPF (lsa, LSA_GENERATE)) + zlog_info ("LSA[Type1]: Create router-LSA for Area %s", area_str); - ospf_router_lsa_originate (area); + ospf_router_lsa_originate (area); } /* If router-ID is changed, Link ID must change. - First flush old LSA, then originate new. */ + First flush old LSA, then originate new. */ else if (!IPV4_ADDR_SAME (&lsa->data->id, &ospf->router_id)) - { - if (IS_DEBUG_OSPF (lsa, LSA_GENERATE)) - zlog_info("LSA[Type%d:%s]: Refresh router-LSA for Area %s", - lsa->data->type, inet_ntoa (lsa->data->id), area_str); - ospf_lsa_flush_area (lsa, area); - ospf_lsa_unlock (area->router_lsa_self); - area->router_lsa_self = NULL; + { + if (IS_DEBUG_OSPF (lsa, LSA_GENERATE)) + zlog_info ("LSA[Type%d:%s]: Refresh router-LSA for Area %s", + lsa->data->type, inet_ntoa (lsa->data->id), area_str); + ospf_lsa_flush_area (lsa, area); + ospf_lsa_unlock (area->router_lsa_self); + area->router_lsa_self = NULL; - /* Refresh router-LSA, (not install) and flood through area. */ - ospf_router_lsa_timer_add (area); - } + /* Refresh router-LSA, (not install) and flood through 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); - } + { + rl = (struct router_lsa *) lsa->data; + /* Refresh router-LSA, (not install) and flood through area. */ + if (rl->flags != ospf->flags) + ospf_router_lsa_update_area (area); + } } return 0; } - /* network-LSA related functions. */ /* Originate Network-LSA. */ void @@ -1027,7 +1062,14 @@ return NULL; /* Install LSA to LSDB. */ - new = ospf_lsa_install (oi->ospf, oi, new); + if ( (new = ospf_lsa_install (oi->ospf, oi, new)) == NULL) + { + if (IS_DEBUG_OSPF (lsa, LSA_GENERATE)) + { + zlog_err ("LSA: ospf_lsa_install failed"); + } + return NULL; + } /* Update LSA origination count. */ oi->ospf->lsa_originate_count++; @@ -1056,13 +1098,23 @@ /* Delete LSA from neighbor retransmit-list. */ ospf_ls_retransmit_delete_nbr_area (area, lsa); + /* Unregister LSA from refresh-list */ + ospf_refresher_unregister_lsa (area->ospf, lsa); + /* Create new network-LSA instance. */ new = ospf_network_lsa_new (oi); if (new == NULL) return -1; new->data->ls_seqnum = lsa_seqnum_increment (lsa); - ospf_lsa_install (area->ospf, oi, new); + if ( (new = ospf_lsa_install (area->ospf, oi, new)) == NULL) + { + if (IS_DEBUG_OSPF (lsa, LSA_GENERATE)) + { + zlog_err ("LSA: ospf_lsa_install failed"); + } + return 1; + } /* Flood LSA through aera. */ ospf_flood_through_area (area, NULL, new); @@ -1077,13 +1129,13 @@ 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. */ @@ -1127,6 +1179,7 @@ oi->t_network_lsa_self = thread_add_event (master, ospf_network_lsa_refresh_timer, oi, 0); } +#endif void @@ -1214,7 +1267,14 @@ new = ospf_summary_lsa_new (area, (struct prefix *) p, metric, id); /* Instlal LSA to LSDB. */ - new = ospf_lsa_install (area->ospf, NULL, new); + if ( (new = ospf_lsa_install (area->ospf, NULL, new)) == NULL) + { + if (IS_DEBUG_OSPF (lsa, LSA_GENERATE)) + { + zlog_err ("LSA: ospf_lsa_install failed"); + } + return NULL; + } /* Update LSA origination count. */ area->ospf->lsa_originate_count++; @@ -1242,17 +1302,30 @@ /* Sanity check. */ assert (lsa->data); + /* Delete LSA from neighbor retransmit-list. */ + ospf_ls_retransmit_delete_nbr_area (lsa->area, lsa); + + /* Unregister LSA from refresh-list */ + ospf_refresher_unregister_lsa (ospf, lsa); + sl = (struct summary_lsa *)lsa->data; p.prefixlen = ip_masklen (sl->mask); new = ospf_summary_lsa_new (lsa->area, &p, GET_METRIC (sl->metric), sl->header.id); - + new->data->ls_seqnum = lsa_seqnum_increment (lsa); /* Re-calculate checksum. */ ospf_lsa_checksum (new->data); - ospf_lsa_install (ospf, NULL, new); + if ( (new = ospf_lsa_install (ospf, NULL, new)) == NULL) + { + if (IS_DEBUG_OSPF (lsa, LSA_GENERATE)) + { + zlog_err ("LSA: ospf_lsa_install failed"); + } + return NULL; + } /* Flood LSA through AS. */ ospf_flood_through_area (new->area, NULL, new); @@ -1341,7 +1414,14 @@ new = ospf_summary_asbr_lsa_new (area, (struct prefix *) p, metric, id); /* Install LSA to LSDB. */ - new = ospf_lsa_install (area->ospf, NULL, new); + if ( (new = ospf_lsa_install (area->ospf, NULL, new)) == NULL) + { + if (IS_DEBUG_OSPF (lsa, LSA_GENERATE)) + { + zlog_err ("LSA: ospf_lsa_install failed"); + } + return NULL; + } /* Update LSA origination count. */ area->ospf->lsa_originate_count++; @@ -1369,6 +1449,12 @@ /* Sanity check. */ assert (lsa->data); + /* Delete LSA from neighbor retransmit-list. */ + ospf_ls_retransmit_delete_nbr_area (lsa->area, lsa); + + /* Unregister LSA from refresh-list */ + ospf_refresher_unregister_lsa (ospf, lsa); + sl = (struct summary_lsa *)lsa->data; p.prefixlen = ip_masklen (sl->mask); new = ospf_summary_asbr_lsa_new (lsa->area, &p, GET_METRIC (sl->metric), @@ -1379,7 +1465,14 @@ /* Re-calculate checksum. */ ospf_lsa_checksum (new->data); - ospf_lsa_install (ospf, NULL, new); + if ( (new = ospf_lsa_install (ospf, NULL, new)) == NULL) + { + if (IS_DEBUG_OSPF (lsa, LSA_GENERATE)) + { + zlog_err ("LSA: ospf_lsa_install failed"); + } + return NULL; + } /* Flood LSA through area. */ ospf_flood_through_area (new->area, NULL, new); @@ -1703,7 +1796,7 @@ ospf_lsa_checksum (new->data); /* install also as Type-7 */ - ospf_lsa_install (ospf, NULL, new); /* Remove Old, Lock New = 2 */ + new = ospf_lsa_install (ospf, 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 */ @@ -1918,6 +2011,9 @@ /* Delete LSA from neighbor retransmit-list. */ ospf_ls_retransmit_delete_nbr_as (ospf, type5); + /* Unregister LSA from refresh-list */ + ospf_refresher_unregister_lsa (ospf, type5); + /* create new translated LSA */ if ( (new = ospf_lsa_translated_nssa_new (ospf, type7)) == NULL) { @@ -1928,7 +2024,7 @@ return NULL; } - if ( !(new = ospf_lsa_install (ospf, NULL, new)) ) + if ( (new = ospf_lsa_install (ospf, NULL, new)) == NULL) { if (IS_DEBUG_OSPF_NSSA) zlog_info ("ospf_translated_nssa_refresh(): Could not install " @@ -2011,7 +2107,14 @@ } /* Install newly created LSA into Type-5 LSDB, lock = 1. */ - ospf_lsa_install (ospf, NULL, new); + if ( (new = ospf_lsa_install (ospf, NULL, new)) == NULL) + { + if (IS_DEBUG_OSPF (lsa, LSA_GENERATE)) + { + zlog_err ("LSA: ospf_lsa_install failed"); + } + return NULL; + } /* Update LSA origination count. */ ospf->lsa_originate_count++; @@ -2319,7 +2422,14 @@ /* Re-calculate checksum. */ ospf_lsa_checksum (new->data); - ospf_lsa_install (ospf, NULL, new); /* As type-5. */ + if ( (new = ospf_lsa_install (ospf, NULL, new)) == NULL) + { + if (IS_DEBUG_OSPF (lsa, LSA_GENERATE)) + { + zlog_err ("LSA: ospf_lsa_install failed"); + } + return; + } /* Flood LSA through AS. */ ospf_flood_through_as (ospf, NULL, new); @@ -2370,19 +2480,16 @@ 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 (ospf, new); + if (IS_DEBUG_OSPF (lsa, LSA_INSTALL)) - zlog_info("LSA[Type%d]: ID %s seq 0x%x is self-originated", + zlog_info("LSA[Type%d]: ID %s seq 0x%x is self-originated", new->data->type, inet_ntoa (new->data->id), - new->data->ls_seqnum); + ntohl(new->data->ls_seqnum)); } return new; @@ -2413,15 +2520,15 @@ 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); + + ospf_refresher_register_lsa (ospf, new); + + if (IS_DEBUG_OSPF (lsa, LSA_INSTALL)) + zlog_info("LSA[Type%d]: ID %s seq 0x%x is self-originated", + new->data->type, inet_ntoa (new->data->id), + ntohl(new->data->ls_seqnum)); } return new; @@ -2453,7 +2560,13 @@ } if (IS_LSA_SELF (new)) - ospf_refresher_register_lsa (ospf, new); + { + ospf_refresher_register_lsa (ospf, new); + if (IS_DEBUG_OSPF (lsa, LSA_INSTALL)) + zlog_info("LSA[Type%d]: ID %s seq 0x%x is self-originated", + new->data->type, inet_ntoa (new->data->id), + ntohl(new->data->ls_seqnum)); + } return new; } @@ -2484,7 +2597,13 @@ /* register LSA to refresh-list. */ if (IS_LSA_SELF (new)) - ospf_refresher_register_lsa (ospf, new); + { + ospf_refresher_register_lsa (ospf, new); + if (IS_DEBUG_OSPF (lsa, LSA_INSTALL)) + zlog_info("LSA[Type%d]: ID %s seq 0x%x is self-originated", + new->data->type, inet_ntoa (new->data->id), + ntohl(new->data->ls_seqnum)); + } return new; } @@ -2533,8 +2652,13 @@ && !CHECK_FLAG (new->flags, OSPF_LSA_LOCAL_XLT ) #endif /* HAVE_NSSA */ ) - - ospf_refresher_register_lsa (ospf, new); + { + ospf_refresher_register_lsa (ospf, new); + if (IS_DEBUG_OSPF (lsa, LSA_INSTALL)) + zlog_info("LSA[Type%d]: ID %s seq 0x%x is self-originated", + new->data->type, inet_ntoa (new->data->id), + ntohl(new->data->ls_seqnum)); + } return new; } @@ -2652,19 +2776,19 @@ can be originated. " */ - if (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)) { - 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_info ("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); } } @@ -2672,8 +2796,9 @@ { if (IS_DEBUG_OSPF (lsa, LSA_GENERATE)) { - zlog_info ("ospf_lsa_install() got an lsa with seq 0x80000000 " - "that was not self originated. Ignoring\n"); + zlog_info ("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; @@ -2765,12 +2890,12 @@ 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)) - zlog_info ("LSA[Type%d:%s]: Install LSA 0x%lx, MaxAge", - new->data->type, inet_ntoa (new->data->id), (u_long)lsa); + zlog_info ("LSA[Type%d:%s]: Install LSA 0x%lx, MaxAge", + new->data->type, inet_ntoa (new->data->id), (u_long)lsa); ospf_lsa_maxage (ospf, lsa); } @@ -2879,12 +3004,20 @@ 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_info ("originating new router lsa for lsa 0x%lx \n", + zlog_info ("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 (ospf, lsa); } /* Remove from lsdb. */ @@ -3354,7 +3487,6 @@ 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)) @@ -3372,7 +3504,6 @@ 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 @@ -3607,7 +3738,10 @@ { /* Router and Network LSAs are processed differently. */ case OSPF_ROUTER_LSA: + ospf_router_lsa_refresh (lsa); + break; case OSPF_NETWORK_LSA: + ospf_summary_lsa_refresh (ospf, lsa); break; case OSPF_SUMMARY_LSA: ospf_summary_lsa_refresh (ospf, lsa); Index: ospfd/ospf_lsa.h =================================================================== RCS file: /var/cvsroot/quagga/ospfd/ospf_lsa.h,v retrieving revision 1.7 diff -u -r1.7 ospf_lsa.h --- ospfd/ospf_lsa.h 13 Oct 2003 09:06:46 -0000 1.7 +++ ospfd/ospf_lsa.h 8 Apr 2004 03:10:15 -0000 @@ -81,6 +81,7 @@ #define OSPF_LSA_LOCAL_XLT 0x20 #endif /* HAVE_NSSA */ #define OSPF_LSA_PREMATURE_AGE 0x40 +#define OSPF_LSA_SEQ_WRAPPED 0x80 /* LSA data. */ struct lsa_header *data; @@ -251,8 +252,8 @@ /* 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 *); @@ -297,6 +298,7 @@ u_int32_t get_metric (u_char *); int ospf_lsa_maxage_walker (struct thread *); +void ospf_lsa_refresh (struct ospf *, struct ospf_lsa *); void ospf_external_lsa_refresh_default (struct ospf *); Index: ospfd/ospf_nsm.c =================================================================== RCS file: /var/cvsroot/quagga/ospfd/ospf_nsm.c,v retrieving revision 1.5 diff -u -r1.5 ospf_nsm.c --- ospfd/ospf_nsm.c 25 Mar 2003 05:07:54 -0000 1.5 +++ ospfd/ospf_nsm.c 8 Apr 2004 03:10:15 -0000 @@ -731,7 +731,7 @@ zlog_info ("nsm_change_state(): " "scheduling new router-LSA origination"); - ospf_router_lsa_timer_add (oi->area); + ospf_router_lsa_update_area (oi->area); if (oi->type == OSPF_IFTYPE_VIRTUALLINK) { @@ -739,7 +739,7 @@ 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. */ @@ -750,10 +750,9 @@ 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->ospf, oi->network_lsa_self); } } Index: ospfd/ospf_packet.c =================================================================== RCS file: /var/cvsroot/quagga/ospfd/ospf_packet.c,v retrieving revision 1.26 diff -u -r1.26 ospf_packet.c --- ospfd/ospf_packet.c 4 Apr 2004 12:52:33 -0000 1.26 +++ ospfd/ospf_packet.c 8 Apr 2004 03:10:18 -0000 @@ -1699,6 +1699,7 @@ } } #endif /* HAVE_OPAQUE_LSA */ + /* It might be happen that received LSA is self-originated network LSA, but * router ID is cahnged. So, we should check if LSA is a network-LSA whose * Link State ID is one of the router's own IP interface addresses but whose Index: ospfd/ospfd.c =================================================================== RCS file: /var/cvsroot/quagga/ospfd/ospfd.c,v retrieving revision 1.19 diff -u -r1.19 ospfd.c --- ospfd/ospfd.c 5 Dec 2003 14:01:43 -0000 1.19 +++ ospfd/ospfd.c 8 Apr 2004 03:10:19 -0000 @@ -145,8 +145,8 @@ 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); } } @@ -528,9 +528,6 @@ 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; @@ -1014,7 +1011,7 @@ break; } - ospf_router_lsa_timer_add (area); + ospf_router_lsa_update_area (area); ospf_schedule_abr_task (area->ospf); } @@ -1025,7 +1022,7 @@ 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); @@ -1037,7 +1034,7 @@ 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/ospfd.h =================================================================== RCS file: /var/cvsroot/quagga/ospfd/ospfd.h,v retrieving revision 1.8 diff -u -r1.8 ospfd.h --- ospfd/ospfd.h 12 Jul 2003 21:30:57 -0000 1.8 +++ ospfd/ospfd.h 8 Apr 2004 03:10:20 -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 @@ -404,7 +405,6 @@ 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 */