From b29800a676b7c3cf00d8a4086b7783ccb7e2f29f Mon Sep 17 00:00:00 2001 From: paul Date: Sun, 20 Nov 2005 14:50:45 +0000 Subject: 2005-11-20 Paul Jakma * ospfd.h: remove the OSPF_ROUTER_ID_UPDATE_DELAY define (struct ospf) remove the router_id timer thread. remove export of ospf_router_id_update_timer. * ospfd.c: (ospf_router_id_update) call ospf_if_update to poke interfaces into action after ID has been configured. (ospf_router_id_update_timer) removed. (ospf_finish_final) t_router_id_update timer is gone. (ospf_network_run) router-id update timer gone. call ospf_router_id_update directly if ID not configured. In the per-iface loop, don't ospf_if_up interfaces if ID is still not configured. The update function will call ospf_if_update anyway. (ospf_if_update) ID update timer is gone. Just return if no ID is set. * ospf_vty.c: (ospf_router_id) call ospf_router_id_update, no timer needed. * ospf_zebra.c: (ospf_router_id_update_zebra) call ospf_router_id_update directly, not via timer. --- ospfd/ChangeLog | 21 +++++++++++++++++++++ ospfd/ospf_vty.c | 8 +++----- ospfd/ospf_zebra.c | 8 +++----- ospfd/ospfd.c | 47 ++++++++++++++++------------------------------- ospfd/ospfd.h | 5 ----- 5 files changed, 43 insertions(+), 46 deletions(-) diff --git a/ospfd/ChangeLog b/ospfd/ChangeLog index 41453bf9..08a3fcb5 100644 --- a/ospfd/ChangeLog +++ b/ospfd/ChangeLog @@ -1,3 +1,24 @@ +2005-11-20 Paul Jakma + + * ospfd.h: remove the OSPF_ROUTER_ID_UPDATE_DELAY define + (struct ospf) remove the router_id timer thread. + remove export of ospf_router_id_update_timer. + * ospfd.c: (ospf_router_id_update) call ospf_if_update to + poke interfaces into action after ID has been configured. + (ospf_router_id_update_timer) removed. + (ospf_finish_final) t_router_id_update timer is gone. + (ospf_network_run) router-id update timer gone. + call ospf_router_id_update directly if ID not configured. + In the per-iface loop, don't ospf_if_up interfaces if + ID is still not configured. The update function will call + ospf_if_update anyway. + (ospf_if_update) ID update timer is gone. Just return if no + ID is set. + * ospf_vty.c: (ospf_router_id) call ospf_router_id_update, no + timer needed. + * ospf_zebra.c: (ospf_router_id_update_zebra) call + ospf_router_id_update directly, not via timer. + 2005-11-16 Andrew J. Schorr * ospf_dump.h: Define OSPF_TIME_DUMP_SIZE as appropriate buffer size diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index de021bc2..385eb8d4 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -215,11 +215,9 @@ DEFUN (ospf_router_id, } ospf->router_id_static = router_id; - - if (ospf->t_router_id_update == NULL) - OSPF_TIMER_ON (ospf->t_router_id_update, ospf_router_id_update_timer, - OSPF_ROUTER_ID_UPDATE_DELAY); - + + ospf_router_id_update (ospf); + return CMD_SUCCESS; } diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c index 0d98008d..af82e979 100644 --- a/ospfd/ospf_zebra.c +++ b/ospfd/ospf_zebra.c @@ -68,12 +68,10 @@ ospf_router_id_update_zebra (int command, struct zclient *zclient, router_id_zebra = router_id.u.prefix4; ospf = ospf_lookup (); + if (ospf != NULL) - { - if (ospf->t_router_id_update == NULL) - OSPF_TIMER_ON (ospf->t_router_id_update, ospf_router_id_update_timer, - OSPF_ROUTER_ID_UPDATE_DELAY); - } + ospf_router_id_update (ospf); + return 0; } diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c index 3cc02020..7c9fb8f0 100644 --- a/ospfd/ospfd.c +++ b/ospfd/ospfd.c @@ -119,22 +119,11 @@ ospf_router_id_update (struct ospf *ospf) OSPF_TIMER_ON (ospf->t_router_lsa_update, ospf_router_lsa_update_timer, OSPF_LSA_UPDATE_DELAY); + + /* update ospf_interface's */ + ospf_if_update (ospf); } } - -int -ospf_router_id_update_timer (struct thread *thread) -{ - struct ospf *ospf = THREAD_ARG (thread); - - if (IS_DEBUG_OSPF_EVENT) - zlog_debug ("Router-ID: Update timer fired!"); - - ospf->t_router_id_update = NULL; - ospf_router_id_update (ospf); - - return 0; -} /* For OSPF area sort by area id. */ static int @@ -454,7 +443,6 @@ ospf_finish_final (struct ospf *ospf) /* Cancel all timers. */ OSPF_TIMER_OFF (ospf->t_external_lsa); - OSPF_TIMER_OFF (ospf->t_router_id_update); OSPF_TIMER_OFF (ospf->t_router_lsa_update); OSPF_TIMER_OFF (ospf->t_spf_calc); OSPF_TIMER_OFF (ospf->t_ase_calc); @@ -834,12 +822,8 @@ ospf_network_run (struct ospf *ospf, struct prefix *p, struct ospf_area *area) /* Schedule Router ID Update. */ if (ospf->router_id_static.s_addr == 0) - if (ospf->t_router_id_update == NULL) - { - OSPF_TIMER_ON (ospf->t_router_id_update, ospf_router_id_update_timer, - OSPF_ROUTER_ID_UPDATE_DELAY); - } - + ospf_router_id_update (ospf); + /* Get target interface. */ for (ALL_LIST_ELEMENTS_RO (om->iflist, node, ifp)) { @@ -913,8 +897,14 @@ ospf_network_run (struct ospf *ospf, struct prefix *p, struct ospf_area *area) } ospf_area_add_if (oi->area, oi); - - if (if_is_operative (ifp)) + + /* if router_id is not configured, dont bring up + * interfaces. + * ospf_router_id_update() will call ospf_if_update + * whenever r-id is configured instead. + */ + if ((ospf->router_id_static.s_addr != 0) + && if_is_operative (ifp)) ospf_if_up (oi); break; @@ -961,15 +951,10 @@ ospf_if_update (struct ospf *ospf) if (ospf != NULL) { - /* Update Router ID scheduled. */ + /* Router-ID must be configured. */ if (ospf->router_id_static.s_addr == 0) - if (ospf->t_router_id_update == NULL) - { - OSPF_TIMER_ON (ospf->t_router_id_update, - ospf_router_id_update_timer, - OSPF_ROUTER_ID_UPDATE_DELAY); - } - + return; + /* Find interfaces that not configured already. */ for (ALL_LIST_ELEMENTS (ospf->oiflist, node, nnode, oi)) { diff --git a/ospfd/ospfd.h b/ospfd/ospfd.h index ff27a327..ebacc1b2 100644 --- a/ospfd/ospfd.h +++ b/ospfd/ospfd.h @@ -126,9 +126,6 @@ #define OSPF_DD_FLAG_I 0x04 #define OSPF_DD_FLAG_ALL 0x07 -/* Timer value. */ -#define OSPF_ROUTER_ID_UPDATE_DELAY 1 - #define OSPF_LS_REFRESH_SHIFT (60 * 15) #define OSPF_LS_REFRESH_JITTER 60 @@ -249,7 +246,6 @@ struct ospf int redistribute; /* Num of redistributed protocols. */ /* Threads. */ - struct thread *t_router_id_update; /* Router ID update timer. */ struct thread *t_router_lsa_update; /* router-LSA update timer. */ struct thread *t_abr_task; /* ABR task timer. */ struct thread *t_asbr_check; /* ASBR check timer. */ @@ -555,7 +551,6 @@ extern const char *ospf_redist_string(u_int route_type); extern struct ospf *ospf_lookup (void); extern struct ospf *ospf_get (void); extern void ospf_finish (struct ospf *); -extern int ospf_router_id_update_timer (struct thread *); extern void ospf_router_id_update (struct ospf *ospf); extern int ospf_network_match_iface (struct connected *, struct prefix *); extern int ospf_network_set (struct ospf *, struct prefix_ipv4 *, -- cgit v1.2.1