diff --git a/sysdep/unix/krt.c b/sysdep/unix/krt.c index 196f1989..bc5b4e98 100644 --- a/sysdep/unix/krt.c +++ b/sysdep/unix/krt.c @@ -390,9 +390,6 @@ krt_got_route(struct krt_proto *p, rte *e, s8 src) #endif /* The rest is for KRT_SRC_BIRD (or KRT_SRC_UNKNOWN) */ - /* Deleting all routes if final flush is requested */ - if (p->sync_state == KPS_FLUSHING) - goto done;//delete; /* We wait for the initial feed to have correct installed state */ if (!p->ready) @@ -463,8 +460,6 @@ krt_init_scan(struct krt_proto *p) log(L_WARN "%s: Can't scan, still pruning", p->p.name); return 0; - case KPS_FLUSHING: - bug("Can't scan, flushing"); } bug("Bad kernel sync state"); @@ -488,8 +483,6 @@ krt_prune(struct krt_proto *p) case KPS_PRUNING: bug("Kernel scan double-prune"); - case KPS_FLUSHING: - bug("Attemted kernel scan prune when flushing"); } } @@ -704,9 +697,6 @@ krt_rt_notify(struct proto *P, struct channel *ch UNUSED, const net_addr *net, krt_replace_rte(p, net, new, old); break; - case KPS_FLUSHING: - /* Drop any incoming route */ - //krt_replace_rte(p, net, NULL, old ?: new); } } @@ -768,11 +758,6 @@ krt_export_fed(struct channel *C) p->sync_state = KPS_IDLE; break; - case KPS_FLUSHING: - //krt_do_scan(p); - //krt_cleanup(p); - //proto_notify_state(&p->p, PS_DOWN); - return; } } @@ -886,7 +871,6 @@ krt_start(struct proto *P) static int krt_shutdown(struct proto *P) { - log("krt shutdown"); struct krt_proto *p = (struct krt_proto *) P; krt_scan_timer_stop(p); @@ -897,40 +881,33 @@ krt_shutdown(struct proto *P) /* FIXME we should flush routes even when persist during reconfiguration */ if (p->initialized && !KRT_CF->persist && (P->down_code != PDC_CMD_GR_DOWN)) { - log("start of if"); struct rt_export_feeder req = (struct rt_export_feeder) { - .name = "shotdown.feeder", + .name = "shutdown.feeder", .trace_routes = P->main_channel->debug, - }; /* init z P->main_channel->table, na export_best */ - rt_feeder_subscribe(&P->main_channel->table->export_all, &req);//...; + }; + rt_feeder_subscribe(&P->main_channel->table->export_best, &req); - RT_FEED_WALK(&req, f) /* look at rt-show.c for example */ + RT_FEED_WALK(&req, f) { for (uint i = 0; i < f->count_routes; i++) { rte *e = &f->block[i]; - /* check bmap_test(P->main_channel->export_rejected_map, e->id) - * if 0, then never exported (can be skipped) - */ - if (bmap_test(&P->main_channel->export_rejected_map, e->id)) - continue; + if (bmap_test(&P->main_channel->export_rejected_map, e->id)) + continue; /* if exported then delete from kernel */ - rte new = rte_init_from(e); - krt_replace_rte(p, e->net, NULL, &new);//old ?: new); + krt_replace_rte(p, e->net, NULL, e); } } - /* put things from krt_export_fed */ krt_do_scan(p); krt_cleanup(p); proto_notify_state(&p->p, PS_DOWN); - log("end of if"); + rt_feeder_unsubscribe(&req); } else krt_cleanup(p); - log("Lets return"); return PS_DOWN; } diff --git a/sysdep/unix/krt.h b/sysdep/unix/krt.h index 381d199c..394e7401 100644 --- a/sysdep/unix/krt.h +++ b/sysdep/unix/krt.h @@ -66,7 +66,6 @@ struct krt_proto { KPS_IDLE, KPS_SCANNING, KPS_PRUNING, - KPS_FLUSHING, } sync_state; /* What is happening with the table sync routine */ };