summaryrefslogtreecommitdiff
path: root/proto/ospf/ospf.c
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2019-07-10 11:27:08 +0200
committerMaria Matejka <mq@ucw.cz>2019-07-10 11:27:08 +0200
commitb2a4feeb4c877ff56d9b2ebd8119225c53ea40db (patch)
treedb22ae94ddf1208824e9ec70176dce63cb073174 /proto/ospf/ospf.c
parenteac9250fd5b10809830361b94438339b3b31b270 (diff)
parent422a9334294dd9a5b13abd8563a3dc7233e64b13 (diff)
Merge branch 'master' into mq-filter-stack
Diffstat (limited to 'proto/ospf/ospf.c')
-rw-r--r--proto/ospf/ospf.c38
1 files changed, 30 insertions, 8 deletions
diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c
index b6d5570c..510058eb 100644
--- a/proto/ospf/ospf.c
+++ b/proto/ospf/ospf.c
@@ -246,18 +246,33 @@ void
ospf_stop_gr_recovery(struct ospf_proto *p)
{
p->gr_recovery = 0;
+ p->gr_cleanup = 1;
p->gr_timeout = 0;
- channel_graceful_restart_unlock(p->p.main_channel);
/* Reorigination of router/network LSAs is already scheduled */
- ospf_mark_lsadb(p);
- /*
- * NOTE: We should move channel_graceful_restart_unlock() to the end of
- * ospf_disp() in order to have local LSA reorigination / LSAdb cleanup /
- * routing table recomputation before official end of GR. It does not matter
- * when we are single-threaded.
- */
+ /* Rest is done in ospf_cleanup_gr_recovery() */
+}
+
+static void
+ospf_cleanup_gr_recovery(struct ospf_proto *p)
+{
+ struct top_hash_entry *en;
+
+ /* Flush dirty LSAa except external ones, these will be handled by feed */
+ WALK_SLIST(en, p->lsal)
+ if (en->gr_dirty)
+ {
+ if ((en->lsa_type == LSA_T_EXT) || (en->lsa_type == LSA_T_NSSA))
+ en->mode = LSA_M_EXPORT;
+ else
+ ospf_flush_lsa(p, en);
+ }
+
+ /* End graceful restart on channel, will also schedule feed */
+ channel_graceful_restart_unlock(p->p.main_channel);
+
+ p->gr_cleanup = 0;
}
static int
@@ -361,6 +376,8 @@ ospf_init(struct proto_config *CF)
P->ifa_notify = cf->ospf2 ? ospf_ifa_notify2 : ospf_ifa_notify3;
P->preexport = ospf_preexport;
P->reload_routes = ospf_reload_routes;
+ P->feed_begin = ospf_feed_begin;
+ P->feed_end = ospf_feed_end;
P->make_tmp_attrs = ospf_make_tmp_attrs;
P->store_tmp_attrs = ospf_store_tmp_attrs;
P->rte_better = ospf_rte_better;
@@ -436,6 +453,7 @@ ospf_disp(timer * timer)
{
struct ospf_proto *p = timer->data;
+ /* Check for end of graceful restart */
if (p->gr_recovery)
ospf_update_gr_recovery(p);
@@ -448,6 +466,10 @@ ospf_disp(timer * timer)
/* Calculate routing table */
if (p->calcrt)
ospf_rt_spf(p);
+
+ /* Cleanup after graceful restart */
+ if (p->gr_cleanup)
+ ospf_cleanup_gr_recovery(p);
}