summaryrefslogtreecommitdiff
path: root/ospfd
diff options
context:
space:
mode:
Diffstat (limited to 'ospfd')
-rw-r--r--ospfd/ospf_abr.c7
-rw-r--r--ospfd/ospf_asbr.c3
-rw-r--r--ospfd/ospf_flood.c4
-rw-r--r--ospfd/ospf_interface.c8
-rw-r--r--ospfd/ospf_interface.h2
-rw-r--r--ospfd/ospf_ism.c9
-rw-r--r--ospfd/ospf_lsa.c224
-rw-r--r--ospfd/ospf_lsa.h22
-rw-r--r--ospfd/ospf_nsm.c7
-rw-r--r--ospfd/ospf_vty.c6
-rw-r--r--ospfd/ospfd.c14
-rw-r--r--ospfd/ospfd.h2
12 files changed, 107 insertions, 201 deletions
diff --git a/ospfd/ospf_abr.c b/ospfd/ospf_abr.c
index 7e32195b..7a75194a 100644
--- a/ospfd/ospf_abr.c
+++ b/ospfd/ospf_abr.c
@@ -565,8 +565,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);
}
}
@@ -760,7 +759,7 @@ ospf_abr_announce_network_to_area (struct prefix_ipv4 *p, u_int32_t cost,
zlog_debug ("ospf_abr_announce_network_to_area(): "
"refreshing summary");
set_metric (old, cost);
- lsa = ospf_summary_lsa_refresh (area->ospf, old);
+ lsa = ospf_lsa_refresh (area->ospf, old);
if (!lsa)
{
@@ -1148,7 +1147,7 @@ ospf_abr_announce_rtr_to_area (struct prefix_ipv4 *p, u_int32_t cost,
if (old)
{
set_metric (old, cost);
- lsa = ospf_summary_asbr_lsa_refresh (area->ospf, old);
+ lsa = ospf_lsa_refresh (area->ospf, old);
}
else
lsa = ospf_summary_asbr_lsa_originate (p, cost, area);
diff --git a/ospfd/ospf_asbr.c b/ospfd/ospf_asbr.c
index 6f1b0b06..c39efee1 100644
--- a/ospfd/ospf_asbr.c
+++ b/ospfd/ospf_asbr.c
@@ -264,8 +264,7 @@ ospf_asbr_status_update (struct ospf *ospf, u_char status)
/* 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
diff --git a/ospfd/ospf_flood.c b/ospfd/ospf_flood.c
index 41661da2..06d75740 100644
--- a/ospfd/ospf_flood.c
+++ b/ospfd/ospf_flood.c
@@ -135,7 +135,7 @@ ospf_process_self_originated_lsa (struct ospf *ospf,
/* Originate a new instance and schedule flooding */
if (area->router_lsa_self)
area->router_lsa_self->data->ls_seqnum = new->data->ls_seqnum;
- ospf_router_lsa_timer_add (area);
+ ospf_router_lsa_update_area (area);
return;
case OSPF_NETWORK_LSA:
#ifdef HAVE_OPAQUE_LSA
@@ -171,7 +171,7 @@ ospf_process_self_originated_lsa (struct ospf *ospf,
if (oi->network_lsa_self)
oi->network_lsa_self->data->ls_seqnum = new->data->ls_seqnum;
/* Schedule network-LSA origination. */
- ospf_network_lsa_timer_add (oi);
+ ospf_network_lsa_update (oi);
return;
}
break;
diff --git a/ospfd/ospf_interface.c b/ospfd/ospf_interface.c
index a812dd90..dc0787d5 100644
--- a/ospfd/ospf_interface.c
+++ b/ospfd/ospf_interface.c
@@ -97,7 +97,7 @@ ospf_if_recalculate_output_cost (struct interface *ifp)
if (oi->output_cost != newcost)
{
oi->output_cost = newcost;
- ospf_router_lsa_timer_add (oi->area);
+ ospf_router_lsa_update_area (oi->area);
}
}
}
@@ -298,8 +298,6 @@ ospf_if_cleanup (struct ospf_interface *oi)
ospf_nbr_delete (oi->nbr_self);
oi->nbr_self = ospf_nbr_new (oi);
ospf_nbr_add_self (oi);
-
- OSPF_TIMER_OFF (oi->t_network_lsa_self);
}
void
@@ -1121,8 +1119,8 @@ ospf_vl_up_check (struct ospf_area *area, struct in_addr rid,
if (IS_DEBUG_OSPF (ism, ISM_EVENTS))
zlog_debug ("ospf_vl_up_check: VL cost change,"
" scheduling router lsa refresh");
- if(ospf->backbone)
- ospf_router_lsa_timer_add (ospf->backbone);
+ if (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!");
}
diff --git a/ospfd/ospf_interface.h b/ospfd/ospf_interface.h
index f495c499..6db88773 100644
--- a/ospfd/ospf_interface.h
+++ b/ospfd/ospf_interface.h
@@ -210,8 +210,6 @@ 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 */
diff --git a/ospfd/ospf_ism.c b/ospfd/ospf_ism.c
index 3172587a..db53882d 100644
--- a/ospfd/ospf_ism.c
+++ b/ospfd/ospf_ism.c
@@ -578,20 +578,17 @@ ism_change_state (struct ospf_interface *oi, int state)
oi->area->act_ints++;
/* schedule router-LSA originate. */
- ospf_router_lsa_timer_add (oi->area);
+ 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_network_lsa_update (oi);
else if (old_state == ISM_DR && state != ISM_DR)
{
/* Free self originated network LSA. */
lsa = oi->network_lsa_self;
if (lsa)
- {
- ospf_lsa_flush_area (lsa, oi->area);
- OSPF_TIMER_OFF (oi->t_network_lsa_self);
- }
+ ospf_lsa_flush_area (lsa, oi->area);
ospf_lsa_unlock (&oi->network_lsa_self);
oi->network_lsa_self = NULL;
diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c
index ec736fc1..bdc40151 100644
--- a/ospfd/ospf_lsa.c
+++ b/ospfd/ospf_lsa.c
@@ -741,7 +741,7 @@ ospf_stub_router_timer (struct thread *t)
UNSET_FLAG (area->stub_router_state, OSPF_AREA_IS_STUB_ROUTED);
- ospf_router_lsa_timer_add (area);
+ ospf_router_lsa_update_area (area);
return 0;
}
@@ -885,6 +885,9 @@ ospf_router_lsa_refresh (struct ospf_lsa *lsa)
/* 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. */
if ( (new = ospf_router_lsa_new (area)) == NULL)
{
@@ -910,20 +913,15 @@ ospf_router_lsa_refresh (struct ospf_lsa *lsa)
return NULL;
}
-static int
-ospf_router_lsa_timer (struct thread *t)
+int
+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;
+ zlog_debug ("[router-LSA]: (router-LSA area update)");
/* 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);
@@ -931,50 +929,15 @@ ospf_router_lsa_timer (struct thread *t)
return 0;
}
-void
-ospf_router_lsa_timer_add (struct ospf_area *area)
-{
- /* Keep area's self-originated router-LSA. */
- struct ospf_lsa *lsa = area->router_lsa_self;
-
- /* Cancel previously scheduled router-LSA timer. */
- if (area->t_router_lsa_self)
- if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))
- zlog_debug ("LSA[Type1]: Cancel previous router-LSA timer");
-
- OSPF_TIMER_OFF (area->t_router_lsa_self);
-
- /* If router-LSA is originated previously, check the interval time. */
- if (lsa)
- {
- int delay;
- if ((delay = ospf_lsa_refresh_delay (lsa)) > 0)
- {
- OSPF_AREA_TIMER_ON (area->t_router_lsa_self,
- ospf_router_lsa_timer, delay);
- return;
- }
- }
-
- if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))
- zlog_debug ("LSA[Type1]: Scheduling router-LSA origination right away");
-
- /* Immediately refresh router-LSA. */
- OSPF_AREA_TIMER_ON (area->t_router_lsa_self, ospf_router_lsa_timer, 0);
-}
-
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, *nnode;
struct ospf_area *area;
if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))
zlog_debug ("Timer[router-LSA Update]: (timer expire)");
- ospf->t_router_lsa_update = NULL;
-
for (ALL_LIST_ELEMENTS (ospf->areas, node, nnode, area))
{
struct ospf_lsa *lsa = area->router_lsa_self;
@@ -1004,14 +967,14 @@ ospf_router_lsa_update_timer (struct thread *thread)
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);
}
}
@@ -1081,6 +1044,7 @@ ospf_network_lsa_new (struct ospf_interface *oi)
}
new->area = oi->area;
+ new->oi = oi;
SET_FLAG (new->flags, OSPF_LSA_SELF | OSPF_LSA_SELF_CHECKED);
/* Copy LSA to store. */
@@ -1108,15 +1072,21 @@ ospf_network_lsa_new (struct ospf_interface *oi)
}
/* Originate network-LSA. */
-static struct ospf_lsa *
-ospf_network_lsa_originate (struct ospf_interface *oi)
+void
+ospf_network_lsa_update (struct ospf_interface *oi)
{
struct ospf_lsa *new;
-
+
+ if (oi->network_lsa_self != NULL)
+ {
+ ospf_lsa_refresh (oi->ospf, oi->network_lsa_self);
+ return;
+ }
+
/* Create new network-LSA instance. */
new = ospf_network_lsa_new (oi);
if (new == NULL)
- return NULL;
+ return;
/* Install LSA to LSDB. */
new = ospf_lsa_install (oi->ospf, oi, new);
@@ -1134,32 +1104,38 @@ ospf_network_lsa_originate (struct ospf_interface *oi)
ospf_lsa_header_dump (new->data);
}
- return new;
+ return;
}
-int
-ospf_network_lsa_refresh (struct ospf_lsa *lsa, struct ospf_interface *oi)
+static struct ospf_lsa *
+ospf_network_lsa_refresh (struct ospf_lsa *lsa)
{
struct ospf_area *area = lsa->area;
- struct ospf_lsa *new;
+ struct ospf_lsa *new, *new2;
struct ospf_if_params *oip;
-
+ struct ospf_interface *oi = lsa->oi;
+
assert (lsa->data);
/* 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;
+ return NULL;
oip = ospf_lookup_if_params (oi->ifp, oi->address->u.prefix4);
assert (oip != NULL);
oip->network_lsa_seqnum = new->data->ls_seqnum = lsa_seqnum_increment (lsa);
- ospf_lsa_install (area->ospf, oi, new);
-
+ new2 = ospf_lsa_install (area->ospf, oi, new);
+
+ assert (new2 == new);
+
/* Flood LSA through aera. */
ospf_flood_through_area (area, NULL, new);
@@ -1170,60 +1146,8 @@ ospf_network_lsa_refresh (struct ospf_lsa *lsa, struct ospf_interface *oi)
ospf_lsa_header_dump (new->data);
}
- return 0;
-}
-
-static 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. */
- ospf_network_lsa_refresh (oi->network_lsa_self, oi);
- else
- /* Newly create network-LSA. */
- ospf_network_lsa_originate (oi);
-
- return 0;
-}
-
-void
-ospf_network_lsa_timer_add (struct ospf_interface *oi)
-{
- /* Keep interface's self-originated network-LSA. */
- struct ospf_lsa *lsa = oi->network_lsa_self;
-
- /* Cancel previously schedules network-LSA timer. */
- if (oi->t_network_lsa_self)
- if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))
- zlog_debug ("LSA[Type2]: Cancel previous network-LSA timer");
- OSPF_TIMER_OFF (oi->t_network_lsa_self);
-
- /* If network-LSA is originated previously, check the interval time. */
- if (lsa)
- {
- int delay;
- if ((delay = ospf_lsa_refresh_delay (lsa)) > 0)
- {
- oi->t_network_lsa_self =
- thread_add_timer (master, ospf_network_lsa_refresh_timer,
- oi, delay);
- return;
- }
- }
-
- if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))
- zlog_debug ("Scheduling network-LSA origination right away");
-
- /* Immediately refresh network-LSA. */
- oi->t_network_lsa_self =
- thread_add_event (master, ospf_network_lsa_refresh_timer, oi, 0);
+ return new;
}
-
static void
stream_put_ospf_metric (struct stream *s, u_int32_t metric_value)
@@ -1347,7 +1271,7 @@ ospf_summary_lsa_originate (struct prefix_ipv4 *p, u_int32_t metric,
return new;
}
-struct ospf_lsa*
+static struct ospf_lsa*
ospf_summary_lsa_refresh (struct ospf *ospf, struct ospf_lsa *lsa)
{
struct ospf_lsa *new;
@@ -1494,7 +1418,7 @@ ospf_summary_asbr_lsa_originate (struct prefix_ipv4 *p, u_int32_t metric,
return new;
}
-struct ospf_lsa*
+static struct ospf_lsa*
ospf_summary_asbr_lsa_refresh (struct ospf *ospf, struct ospf_lsa *lsa)
{
struct ospf_lsa *new;
@@ -2348,7 +2272,7 @@ ospf_external_lsa_refresh_type (struct ospf *ospf, u_char type, int force)
}
/* Refresh AS-external-LSA. */
-void
+struct ospf_lsa *
ospf_external_lsa_refresh (struct ospf *ospf, struct ospf_lsa *lsa,
struct external_info *ei, int force)
{
@@ -2364,7 +2288,7 @@ ospf_external_lsa_refresh (struct ospf *ospf, struct ospf_lsa *lsa,
lsa->data->type, inet_ntoa (lsa->data->id));
ospf_external_lsa_flush (ospf, ei->type, &ei->p,
ei->ifindex /*, ei->nexthop */);
- return;
+ return NULL;
}
if (!changed && !force)
@@ -2372,7 +2296,7 @@ ospf_external_lsa_refresh (struct ospf *ospf, struct ospf_lsa *lsa,
if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))
zlog_debug ("LSA[Type%d:%s]: Not refreshed, not changed/forced",
lsa->data->type, inet_ntoa (lsa->data->id));
- return;
+ return NULL;
}
/* Delete LSA from neighbor retransmit-list. */
@@ -2388,7 +2312,7 @@ ospf_external_lsa_refresh (struct ospf *ospf, struct ospf_lsa *lsa,
if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))
zlog_debug ("LSA[Type%d:%s]: Could not be refreshed", lsa->data->type,
inet_ntoa (lsa->data->id));
- return;
+ return NULL;
}
new->data->ls_seqnum = lsa_seqnum_increment (lsa);
@@ -2417,7 +2341,7 @@ ospf_external_lsa_refresh (struct ospf *ospf, struct ospf_lsa *lsa,
ospf_lsa_header_dump (new->data);
}
- return;
+ return new;
}
@@ -2425,8 +2349,8 @@ ospf_external_lsa_refresh (struct ospf *ospf, struct ospf_lsa *lsa,
/* Install router-LSA to an area. */
static struct ospf_lsa *
-ospf_router_lsa_install (struct ospf *ospf,
- struct ospf_lsa *new, int rt_recalc)
+ospf_router_lsa_install (struct ospf *ospf, struct ospf_lsa *new,
+ int rt_recalc)
{
struct ospf_area *area = new->area;
@@ -2445,15 +2369,11 @@ ospf_router_lsa_install (struct ospf *ospf,
if (CHECK_FLAG (new->flags, OSPF_LSA_RECEIVED))
return new; /* ignore stale LSA */
- /* 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 (rt_recalc)
ospf_spf_calculate_schedule (ospf);
@@ -2486,15 +2406,9 @@ ospf_network_lsa_install (struct ospf *ospf,
if (CHECK_FLAG (new->flags, OSPF_LSA_RECEIVED))
return new; /* ignore stale LSA */
- /* 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 (rt_recalc)
ospf_spf_calculate_schedule (ospf);
@@ -2742,7 +2656,8 @@ ospf_lsa_install (struct ospf *ospf, struct ospf_interface *oi,
if (IS_DEBUG_OSPF (lsa, LSA_REFRESH))
{
zlog_debug ("ospf_lsa_install() Premature Aging "
- "lsa 0x%lx", (u_long)lsa);
+ "lsa 0x%p, seqnum 0x%x",
+ lsa, ntohl(lsa->data->ls_seqnum));
ospf_lsa_header_dump (lsa->data);
}
}
@@ -2954,12 +2869,11 @@ ospf_maxage_lsa_remover (struct thread *thread)
ospf_flood_through (ospf, NULL, lsa);
#endif /* ORIGINAL_CODING */
- if (lsa->flags & OSPF_LSA_PREMATURE_AGE)
+ if (CHECK_FLAG (lsa->flags, OSPF_LSA_PREMATURE_AGE))
{
if (IS_DEBUG_OSPF (lsa, LSA_FLOODING))
- zlog_debug ("originating new router lsa for lsa 0x%lx \n",
- (u_long)lsa);
- ospf_router_lsa_originate(lsa->area);
+ zlog_debug ("originating new lsa for lsa 0x%p\n", lsa);
+ ospf_lsa_refresh (ospf, lsa);
}
/* Remove from lsdb. */
@@ -3060,6 +2974,10 @@ ospf_lsa_maxage_walker_remover (struct ospf *ospf, struct ospf_lsa *lsa)
ospf_lsa_maxage (ospf, lsa);
}
+ if (IS_LSA_MAXAGE (lsa) && !ospf_lsa_is_self_originated (ospf, lsa))
+ if (LS_AGE (lsa) > OSPF_LSA_MAXAGE + 30)
+ printf ("Eek! Shouldn't happen!\n");
+
return 0;
}
@@ -3413,7 +3331,6 @@ ospf_flush_self_originated_lsas_now (struct ospf *ospf)
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 (ALL_LIST_ELEMENTS (area->oiflist, node2, nnode2, oi))
@@ -3428,7 +3345,6 @@ ospf_flush_self_originated_lsas_now (struct ospf *ospf)
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
@@ -3628,10 +3544,11 @@ ospf_schedule_lsa_flush_area (struct ospf_area *area, struct ospf_lsa *lsa)
/* LSA Refreshment functions. */
-static void
+struct ospf_lsa *
ospf_lsa_refresh (struct ospf *ospf, struct ospf_lsa *lsa)
{
struct external_info *ei;
+ struct ospf_lsa *new = NULL;
assert (CHECK_FLAG (lsa->flags, OSPF_LSA_SELF));
assert (lsa->lock > 0);
@@ -3639,13 +3556,16 @@ ospf_lsa_refresh (struct ospf *ospf, struct ospf_lsa *lsa)
{
/* Router and Network LSAs are processed differently. */
case OSPF_ROUTER_LSA:
+ new = ospf_router_lsa_refresh (lsa);
+ break;
case OSPF_NETWORK_LSA:
+ new = ospf_network_lsa_refresh (lsa);
break;
case OSPF_SUMMARY_LSA:
- ospf_summary_lsa_refresh (ospf, lsa);
+ new = ospf_summary_lsa_refresh (ospf, lsa);
break;
case OSPF_ASBR_SUMMARY_LSA:
- ospf_summary_asbr_lsa_refresh (ospf, lsa);
+ new = ospf_summary_asbr_lsa_refresh (ospf, lsa);
break;
case OSPF_AS_EXTERNAL_LSA:
/* Translated from NSSA Type-5s are refreshed when
@@ -3655,7 +3575,7 @@ ospf_lsa_refresh (struct ospf *ospf, struct ospf_lsa *lsa)
break;
ei = ospf_external_info_check (lsa);
if (ei)
- ospf_external_lsa_refresh (ospf, lsa, ei, LSA_REFRESH_FORCE);
+ new = ospf_external_lsa_refresh (ospf, lsa, ei, LSA_REFRESH_FORCE);
else
ospf_lsa_flush_as (ospf, lsa);
break;
@@ -3663,12 +3583,13 @@ ospf_lsa_refresh (struct ospf *ospf, struct ospf_lsa *lsa)
case OSPF_OPAQUE_LINK_LSA:
case OSPF_OPAQUE_AREA_LSA:
case OSPF_OPAQUE_AS_LSA:
- ospf_opaque_lsa_refresh (lsa);
+ new = ospf_opaque_lsa_refresh (lsa);
break;
#endif /* HAVE_OPAQUE_LSA */
default:
break;
}
+ return new;
}
void
@@ -3695,11 +3616,11 @@ ospf_refresher_register_lsa (struct ospf *ospf, struct ospf_lsa *lsa)
if (delay < 0)
delay = 0;
- current_index = ospf->lsa_refresh_queue.index +
- (quagga_time (NULL) - ospf->lsa_refresher_started)/OSPF_LSA_REFRESHER_GRANULARITY;
+ current_index = ospf->lsa_refresh_queue.index + (quagga_time (NULL)
+ - ospf->lsa_refresher_started)/OSPF_LSA_REFRESHER_GRANULARITY;
index = (current_index + delay/OSPF_LSA_REFRESHER_GRANULARITY)
- % (OSPF_LSA_REFRESHER_SLOTS);
+ % (OSPF_LSA_REFRESHER_SLOTS);
if (IS_DEBUG_OSPF (lsa, LSA_REFRESH))
zlog_debug ("LSA[Refresh]: lsa %s with age %d added to index %d",
@@ -3756,8 +3677,9 @@ ospf_lsa_refresh_walker (struct thread *t)
modulus. */
ospf->lsa_refresh_queue.index =
((unsigned long)(ospf->lsa_refresh_queue.index +
- (quagga_time (NULL) - ospf->lsa_refresher_started) /
- OSPF_LSA_REFRESHER_GRANULARITY)) % OSPF_LSA_REFRESHER_SLOTS;
+ (quagga_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",
diff --git a/ospfd/ospf_lsa.h b/ospfd/ospf_lsa.h
index 251d4731..0959a638 100644
--- a/ospfd/ospf_lsa.h
+++ b/ospfd/ospf_lsa.h
@@ -115,10 +115,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 Type-2 Network-LSAs */
struct ospf_interface *oi;
-#endif /* HAVE_OPAQUE_LSA */
};
/* OSPF LSA Link Type. */
@@ -254,19 +252,16 @@ extern struct lsa_header *ospf_lsa_data_dup (struct lsa_header *);
extern void ospf_lsa_data_free (struct lsa_header *);
/* Prototype for various LSAs */
-extern int ospf_router_lsa_update_timer (struct thread *);
-extern void ospf_router_lsa_timer_add (struct ospf_area *);
+extern int ospf_router_lsa_update (struct ospf *);
+extern int ospf_router_lsa_update_area (struct ospf_area *);
-extern int ospf_network_lsa_refresh (struct ospf_lsa *, struct ospf_interface *);
-extern void ospf_network_lsa_timer_add (struct ospf_interface *);
+extern void ospf_network_lsa_update (struct ospf_interface *);
extern struct ospf_lsa *ospf_summary_lsa_originate (struct prefix_ipv4 *, u_int32_t,
struct ospf_area *);
extern struct ospf_lsa *ospf_summary_asbr_lsa_originate (struct prefix_ipv4 *,
u_int32_t,
struct ospf_area *);
-extern struct ospf_lsa *ospf_summary_lsa_refresh (struct ospf *, struct ospf_lsa *);
-extern struct ospf_lsa *ospf_summary_asbr_lsa_refresh (struct ospf *, struct ospf_lsa *);
extern struct ospf_lsa *ospf_lsa_install (struct ospf *,
struct ospf_interface *, struct ospf_lsa *);
@@ -300,12 +295,15 @@ extern void ospf_lsa_maxage (struct ospf *, struct ospf_lsa *);
extern u_int32_t get_metric (u_char *);
extern int ospf_lsa_maxage_walker (struct thread *);
-
+extern struct ospf_lsa *ospf_lsa_refresh (struct ospf *, struct ospf_lsa *);
+
extern void ospf_external_lsa_refresh_default (struct ospf *);
extern void ospf_external_lsa_refresh_type (struct ospf *, u_char, int);
-extern void ospf_external_lsa_refresh (struct ospf *, struct ospf_lsa *,
- struct external_info *, int);
+extern struct ospf_lsa *ospf_external_lsa_refresh (struct ospf *,
+ struct ospf_lsa *,
+ struct external_info *,
+ int);
extern struct in_addr ospf_lsa_unique_id (struct ospf *, struct ospf_lsdb *, u_char,
struct prefix_ipv4 *);
extern void ospf_schedule_lsa_flood_area (struct ospf_area *, struct ospf_lsa *);
diff --git a/ospfd/ospf_nsm.c b/ospfd/ospf_nsm.c
index 1ab6ce31..279d2a01 100644
--- a/ospfd/ospf_nsm.c
+++ b/ospfd/ospf_nsm.c
@@ -711,7 +711,7 @@ nsm_change_state (struct ospf_neighbor *nbr, int state)
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)
{
@@ -719,7 +719,7 @@ nsm_change_state (struct ospf_neighbor *nbr, int state)
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. */
@@ -730,10 +730,9 @@ nsm_change_state (struct ospf_neighbor *nbr, int state)
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_network_lsa_update (oi);
}
}
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index 4e52a113..46e7ffa5 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -7029,7 +7029,7 @@ DEFUN (ospf_max_metric_router_lsa_admin,
SET_FLAG (area->stub_router_state, OSPF_AREA_ADMIN_STUB_ROUTED);
if (!CHECK_FLAG (area->stub_router_state, OSPF_AREA_IS_STUB_ROUTED))
- ospf_router_lsa_timer_add (area);
+ ospf_router_lsa_update_area (area);
}
return CMD_SUCCESS;
}
@@ -7055,7 +7055,7 @@ DEFUN (no_ospf_max_metric_router_lsa_admin,
&& !area->t_stub_router)
{
UNSET_FLAG (area->stub_router_state, OSPF_AREA_IS_STUB_ROUTED);
- ospf_router_lsa_timer_add (area);
+ ospf_router_lsa_update_area (area);
}
}
return CMD_SUCCESS;
@@ -7108,7 +7108,7 @@ DEFUN (no_ospf_max_metric_router_lsa_startup,
if (!CHECK_FLAG (area->stub_router_state, OSPF_AREA_ADMIN_STUB_ROUTED))
{
UNSET_FLAG (area->stub_router_state, OSPF_AREA_IS_STUB_ROUTED);
- ospf_router_lsa_timer_add (area);
+ ospf_router_lsa_update_area (area);
}
}
return CMD_SUCCESS;
diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c
index a7553e73..7db81cea 100644
--- a/ospfd/ospfd.c
+++ b/ospfd/ospfd.c
@@ -131,8 +131,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);
/* update ospf_interface's */
for (ALL_LIST_ELEMENTS_RO (om->iflist, node, ifp))
@@ -337,7 +337,7 @@ ospf_deferred_shutdown_check (struct ospf *ospf)
SET_FLAG (area->stub_router_state, OSPF_AREA_ADMIN_STUB_ROUTED);
if (!CHECK_FLAG (area->stub_router_state, OSPF_AREA_IS_STUB_ROUTED))
- ospf_router_lsa_timer_add (area);
+ ospf_router_lsa_update_area (area);
}
timeout = ospf->stub_router_shutdown_time;
}
@@ -473,7 +473,6 @@ ospf_finish_final (struct ospf *ospf)
/* Cancel all timers. */
OSPF_TIMER_OFF (ospf->t_external_lsa);
- OSPF_TIMER_OFF (ospf->t_router_lsa_update);
OSPF_TIMER_OFF (ospf->t_spf_calc);
OSPF_TIMER_OFF (ospf->t_ase_calc);
OSPF_TIMER_OFF (ospf->t_maxage);
@@ -631,7 +630,6 @@ ospf_area_free (struct ospf_area *area)
free (IMPORT_NAME (area));
/* Cancel timer. */
- OSPF_TIMER_OFF (area->t_router_lsa_self);
OSPF_TIMER_OFF (area->t_stub_router);
#ifdef HAVE_OPAQUE_LSA
OSPF_TIMER_OFF (area->t_opaque_lsa_self);
@@ -1041,7 +1039,7 @@ ospf_area_type_set (struct ospf_area *area, int type)
break;
}
- ospf_router_lsa_timer_add (area);
+ ospf_router_lsa_update_area (area);
ospf_schedule_abr_task (area->ospf);
}
@@ -1052,7 +1050,7 @@ ospf_area_shortcut_set (struct ospf *ospf, struct ospf_area *area, int mode)
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);
@@ -1064,7 +1062,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);
diff --git a/ospfd/ospfd.h b/ospfd/ospfd.h
index b24b3ced..b7dc6762 100644
--- a/ospfd/ospfd.h
+++ b/ospfd/ospfd.h
@@ -251,7 +251,6 @@ struct ospf
int redistribute; /* Num of redistributed protocols. */
/* Threads. */
- 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. */
struct thread *t_distribute_update; /* Distirbute list update timer. */
@@ -433,7 +432,6 @@ struct ospf_area
struct vertex *spf;
/* Threads. */
- struct thread *t_router_lsa_self;/* Self-originated router-LSA timer. */
struct thread *t_stub_router; /* Stub-router timer */
#ifdef HAVE_OPAQUE_LSA
struct thread *t_opaque_lsa_self; /* Type-10 Opaque-LSAs origin. */