1
0
mirror of https://gitlab.labs.nic.cz/labs/bird.git synced 2024-05-11 16:54:54 +00:00

Now fix linker, hopefully only

This commit is contained in:
Maria Matejka
2024-05-10 16:52:27 +02:00
parent 2969b5036d
commit 5282ddbde3
4 changed files with 65 additions and 63 deletions

View File

@ -676,22 +676,6 @@ static inline void channel_init(struct channel *c) { channel_set_state(c, CS_STA
static inline void channel_open(struct channel *c) { channel_set_state(c, CS_UP); }
static inline void channel_close(struct channel *c) { channel_set_state(c, CS_STOP); }
#if 0
void channel_request_feeding(struct channel *c, struct channel_feeding_request *);
void channel_request_feeding_dynamic(struct channel *c);
static inline int channel_net_is_refeeding(struct channel *c, const net_addr *n)
{
/* Refeeding if matching any request */
for (struct channel_feeding_request *cfr = c->refeeding; cfr; cfr = cfr->next)
if (!cfr->trie || trie_match_net(cfr->trie, n))
return 1;
/* Not matching any request */
return 0;
}
#endif
void channel_request_reload(struct channel *c, struct rt_feeding_request *cir);
void channel_request_full_refeed(struct channel *c);

View File

@ -1109,13 +1109,13 @@ rip_trigger_update(struct rip_proto *p)
*/
static int
rip_reload_routes(struct channel *C, struct channel_import_request *cir)
rip_reload_routes(struct channel *C, struct rt_feeding_request *rfr)
{
struct rip_proto *p = (struct rip_proto *) C->proto;
/* Always reload full */
if (cir)
CALL(cir->done, cir);
if (rfr)
CALL(rfr->done, rfr);
if (p->rt_reload)
return 1;
@ -1169,8 +1169,6 @@ rip_init(struct proto_config *CF)
P->iface_sub.neigh_notify = rip_neigh_notify;
P->reload_routes = rip_reload_routes;
P->sources.class = &rip_rte_owner_class;
P->feed_begin = rip_feed_begin;
P->feed_end = rip_feed_end;
return P;
}

View File

@ -190,13 +190,13 @@ static_mark_all(struct static_proto *p)
}
static void
static_mark_partial(struct static_proto *p, struct channel_import_request *cir)
static_mark_partial(struct static_proto *p, struct rt_feeding_request *rfr)
{
struct static_config *cf = (void *) p->p.cf;
struct static_route *r;
WALK_LIST(r, cf->routes)
if (r->state == SRS_CLEAN && trie_match_net(cir->trie, r->net))
if (r->state == SRS_CLEAN && (!rfr || rt_prefilter_net(&rfr->prefilter, r->net)))
{
r->state = SRS_DIRTY;
BUFFER_PUSH(p->marked) = r;
@ -205,7 +205,7 @@ static_mark_partial(struct static_proto *p, struct channel_import_request *cir)
if (!ev_active(p->event))
ev_schedule(p->event);
cir->done(cir);
rfr->done(rfr);
}
@ -432,14 +432,14 @@ static_bfd_notify(struct bfd_request *req)
}
static int
static_reload_routes(struct channel *C, struct channel_import_request *cir)
static_reload_routes(struct channel *C, struct rt_feeding_request *rfr)
{
struct static_proto *p = (void *) C->proto;
TRACE(D_EVENTS, "Scheduling route reload");
if (cir->trie)
static_mark_partial(p, cir);
if (rfr)
static_mark_partial(p, rfr);
else
static_mark_all(p);

View File

@ -466,6 +466,27 @@ krt_init_scan(struct krt_proto *p)
case KPS_FLUSHING:
bug("Can't scan, flushing");
}
bug("Bad kernel sync state");
}
struct krt_export_refeed_request {
struct rt_feeding_request rfr;
struct krt_proto *p;
};
static void
krt_pruning_fed(struct rt_feeding_request *rfr)
{
SKIP_BACK_DECLARE(struct krt_export_refeed_request, kerr, rfr, rfr);
struct krt_proto *p = kerr->p;
ASSERT_DIE(p->sync_state == KPS_PRUNING);
KRT_TRACE(p, D_EVENTS, "Table %s pruned", p->p.main_channel->table->name);
p->sync_state = KPS_IDLE;
mb_free(kerr);
}
static void
@ -480,7 +501,13 @@ krt_prune(struct krt_proto *p)
p->sync_state = KPS_PRUNING;
KRT_TRACE(p, D_EVENTS, "Pruning table %s", p->p.main_channel->table->name);
rt_refresh_end(&p->p.main_channel->in_req);
channel_request_feeding_dynamic(p->p.main_channel, CFRT_DIRECT);
struct krt_export_refeed_request *kerr = mb_alloc(p->p.pool, sizeof *kerr);
*kerr = (struct krt_export_refeed_request) {
.rfr.done = krt_pruning_fed,
.p = p,
};
rt_export_refeed(&p->p.main_channel->out_req, &kerr->rfr);
return;
case KPS_PRUNING:
@ -716,60 +743,33 @@ krt_if_notify(struct proto *P, uint flags, struct iface *iface UNUSED)
}
static int
krt_reload_routes(struct channel *C, struct channel_import_request *cir)
krt_reload_routes(struct channel *C, struct rt_feeding_request *rfr)
{
struct krt_proto *p = (void *) C->proto;
if (cir->trie)
{
cir->done(cir);
return 0;
}
/* Although we keep learned routes in krt_table, we rather schedule a scan */
if (KRT_CF->learn)
{
p->reload = 1;
krt_scan_timer_kick(p);
}
cir->done(cir);
if (rfr)
CALL(rfr->done, rfr);
return 1;
}
static void krt_cleanup(struct krt_proto *p);
static void
krt_feed_end(struct channel *C)
krt_export_fed(struct channel *C)
{
struct krt_proto *p = (void *) C->proto;
if (C->refeeding && C->refeed_req.hook)
return;
p->ready = 1;
p->initialized = 1;
switch (p->sync_state)
{
case KPS_PRUNING:
KRT_TRACE(p, D_EVENTS, "Table %s pruned", C->table->name);
p->sync_state = KPS_IDLE;
return;
case KPS_IDLE:
case KPS_SCANNING:
krt_scan_timer_kick(p);
return;
case KPS_FLUSHING:
krt_do_scan(p);
krt_cleanup(p);
proto_notify_state(&p->p, PS_DOWN);
return;
}
krt_scan_timer_kick(p);
}
static int
@ -837,7 +837,7 @@ krt_init(struct proto_config *CF)
p->p.rt_notify = krt_rt_notify;
p->p.iface_sub.if_notify = krt_if_notify;
p->p.reload_routes = krt_reload_routes;
p->p.feed_end = krt_feed_end;
p->p.export_fed = krt_export_fed;
p->p.sources.class = &krt_rte_owner_class;
@ -879,6 +879,20 @@ krt_start(struct proto *P)
return PS_UP;
}
static void
krt_flushing_done(struct rt_feeding_request *rfr)
{
SKIP_BACK_DECLARE(struct krt_export_refeed_request, kerr, rfr, rfr);
struct krt_proto *p = kerr->p;
mb_free(kerr);
ASSERT_DIE(p->sync_state == KPS_FLUSHING);
krt_do_scan(p);
krt_cleanup(p);
proto_notify_state(&p->p, PS_DOWN);
}
static int
krt_shutdown(struct proto *P)
{
@ -893,7 +907,13 @@ krt_shutdown(struct proto *P)
if (p->initialized && !KRT_CF->persist && (P->down_code != PDC_CMD_GR_DOWN))
{
p->sync_state = KPS_FLUSHING;
channel_request_feeding_dynamic(p->p.main_channel, CFRT_AUXILIARY);
struct krt_export_refeed_request *kerr = mb_alloc(p->p.pool, sizeof *kerr);
*kerr = (struct krt_export_refeed_request) {
.rfr.done = krt_flushing_done,
.p = p,
};
rt_export_refeed(&p->p.main_channel->out_req, &kerr->rfr);
/* Keeping the protocol UP until the feed-to-flush is done */
return PS_UP;