From: Maria Matejka Date: Mon, 30 May 2022 13:27:46 +0000 (+0200) Subject: Merge commit 'ebd807c0b8eb0b7a3dc3371cd4c87ae886c00885' into haugesund X-Git-Tag: v3.0-alpha1~171^2~73 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d024f471ea5239a8cb6ce2ccd83b686a1d438aa5;p=thirdparty%2Fbird.git Merge commit 'ebd807c0b8eb0b7a3dc3371cd4c87ae886c00885' into haugesund --- d024f471ea5239a8cb6ce2ccd83b686a1d438aa5 diff --cc nest/route.h index ab8ee258a,595acabd9..1aba218b1 --- a/nest/route.h +++ b/nest/route.h @@@ -480,25 -314,30 +480,25 @@@ static inline net *net_get(rtable *tab net *net_get(rtable *tab, const net_addr *addr); net *net_route(rtable *tab, const net_addr *n); int net_roa_check(rtable *tab, const net_addr *n, u32 asn); -rte *rte_find(net *net, struct rte_src *src); -rte *rte_get_temp(struct rta *, struct rte_src *src); -void rte_update2(struct channel *c, const net_addr *n, rte *new, struct rte_src *src); -/* rte_update() moved to protocol.h to avoid dependency conflicts */ -int rt_examine(rtable *t, net_addr *a, struct proto *p, const struct filter *filter); -rte *rt_export_merged(struct channel *c, net *net, rte **rt_free, linpool *pool, int silent); -void rt_refresh_begin(rtable *t, struct channel *c); -void rt_refresh_end(rtable *t, struct channel *c); -void rt_modify_stale(rtable *t, struct channel *c); +int rt_examine(rtable *t, net_addr *a, struct channel *c, const struct filter *filter); +rte *rt_export_merged(struct channel *c, rte ** feed, uint count, linpool *pool, int silent); +void rt_refresh_begin(rtable *t, struct rt_import_request *); +void rt_refresh_end(rtable *t, struct rt_import_request *); +void rt_modify_stale(rtable *t, struct rt_import_request *); void rt_schedule_prune(rtable *t); -void rte_dump(rte *); -void rte_free(rte *); -rte *rte_do_cow(rte *); -static inline rte * rte_cow(rte *r) { return (r->flags & REF_COW) ? rte_do_cow(r) : r; } -rte *rte_cow_rta(rte *r, linpool *lp); +void rte_dump(struct rte_storage *); - void rte_free(struct rte_storage *, rtable *); ++void rte_free(struct rte_storage *); +struct rte_storage *rte_store(const rte *, net *net, rtable *); void rt_dump(rtable *); void rt_dump_all(void); -int rt_feed_channel(struct channel *c); -void rt_feed_channel_abort(struct channel *c); -int rte_update_in(struct channel *c, const net_addr *n, rte *new, struct rte_src *src); +void rt_dump_hooks(rtable *); +void rt_dump_hooks_all(void); int rt_reload_channel(struct channel *c); void rt_reload_channel_abort(struct channel *c); +void rt_refeed_channel(struct channel *c); void rt_prune_sync(rtable *t, int all); -int rte_update_out(struct channel *c, const net_addr *n, rte *new, rte *old, rte **old_exported, int refeed); +int rte_update_in(struct channel *c, const net_addr *n, rte *new, struct rte_src *src); +int rte_update_out(struct channel *c, const net_addr *n, rte *new, const rte *old, struct rte_storage **old_exported); struct rtable_config *rt_new_table(struct symbol *s, uint addr_type); static inline int rt_is_ip(rtable *tab) diff --cc nest/rt-table.c index 48a75acac,1885e602b..b1ea1d989 --- a/nest/rt-table.c +++ b/nest/rt-table.c @@@ -615,13 -625,21 +615,13 @@@ rte_store(const rte *r, net *net, rtabl * * rte_free() deletes the given &rte from the routing table it's linked to. */ -void -rte_free(rte *e) -{ - rt_unlock_source(e->src); - if (rta_is_cached(e->attrs)) - rta_free(e->attrs); - sl_free(e); -} -static inline void -rte_free_quick(rte *e) +void - rte_free(struct rte_storage *e, rtable *tab) ++rte_free(struct rte_storage *e) { - rt_unlock_source(e->src); - rta_free(e->attrs); + rt_unlock_source(e->rte.src); + rta_free(e->rte.attrs); - sl_free(tab->rte_slab, e); + sl_free(e); } static int /* Actually better or at least as good as */ @@@ -842,17 -827,17 +842,17 @@@ do_rt_notify(struct channel *c, const n if (p->debug & D_ROUTES) { if (new && old) - rte_trace_out(D_ROUTES, c, new, "replaced"); + channel_rte_trace_out(D_ROUTES, c, new, "replaced"); else if (new) - rte_trace_out(D_ROUTES, c, new, "added"); + channel_rte_trace_out(D_ROUTES, c, new, "added"); else if (old) - rte_trace_out(D_ROUTES, c, old, "removed"); + channel_rte_trace_out(D_ROUTES, c, old, "removed"); } - p->rt_notify(p, c, net, new, old); + p->rt_notify(p, c, net, new, old_exported ? &old_exported->rte : old); if (c->out_table && old_exported) - rte_free(old_exported, c->out_table); - rte_free_quick(old_exported); ++ rte_free(old_exported); } static void @@@ -1466,10 -1486,10 +1466,10 @@@ rte_recalculate(struct rt_import_hook * if (old) { - if (!new) + if (!new_stored) hmap_clear(&table->id_map, old->id); - rte_free(old_stored, table); - rte_free_quick(old); ++ rte_free(old_stored); } } @@@ -2846,17 -2726,15 +2846,17 @@@ rt_next_hop_update_net(rtable *tab, ne n->routes = new; } - /* Announce the new best route */ - if (new != old_best) - rte_trace_in(D_ROUTES, new->sender, new, "updated [best]"); - - /* Propagate changes */ - rte_announce_i(tab, RA_UNDEF, n, NULL, NULL, n->routes, old_best); + /* Announce the changes */ + for (int i=0; irte.sender->req, &updates[i].new->rte, best_indicator[nb][ob]); + rte_announce_i(tab, n, updates[i].new, updates[i].old, new, old_best); + } - if (free_old_best) - rte_free_quick(old_best); + for (int i=0; ireload_next_rte) - c->reload_next_rte = old->next; + if (*pos == c->reload_next_rte) + c->reload_next_rte = (*pos)->next; /* Remove the old rte */ - *pos = old->next; - rte_free_quick(old); + struct rte_storage *del = *pos; + *pos = (*pos)->next; - rte_free(del, tab); ++ rte_free(del); tab->rt_count--; + } + else if (new) + { + if (CHANNEL_LIMIT_PUSH(c, RX)) + { + /* Required by rte_trace_in() */ + new->net = n; - break; + channel_rte_trace_in(D_FILTERS, c, new, "ignored [limit]"); + goto drop_update; + } } + else + goto drop_withdraw; if (!new) { @@@ -3265,10 -3192,10 +3265,10 @@@ again while (e = *ee) { - if (all || (e->flags & (REF_STALE | REF_DISCARD))) + if (all || (e->rte.flags & (REF_STALE | REF_DISCARD))) { *ee = e->next; - rte_free(e, t); - rte_free_quick(e); ++ rte_free(e); t->rt_count--; } else diff --cc sysdep/unix/krt.c index 40a584429,7d7ec7e6e..f80c4c457 --- a/sysdep/unix/krt.c +++ b/sysdep/unix/krt.c @@@ -327,11 -326,11 +327,11 @@@ krt_learn_scan(struct krt_proto *p, rt break; if (m) { - if (krt_uptodate(m, e)) + if (krt_uptodate(&m->rte, e)) { krt_trace_in_rl(&rl_alien, p, e, "[alien] seen"); - rte_free(ee, p->krt_table); - rte_free(e); - m->pflags |= KRT_REF_SEEN; ++ rte_free(ee); + m->rte.pflags |= KRT_REF_SEEN; } else { @@@ -378,13 -376,13 +378,13 @@@ again ee = &n->routes; while (e = *ee) { - if (e->pflags & KRT_REF_BEST) + if (e->rte.pflags & KRT_REF_BEST) old_best = e; - if (!(e->pflags & KRT_REF_SEEN)) + if (!(e->rte.pflags & KRT_REF_SEEN)) { *ee = e->next; - rte_free(e, p->krt_table); + rte_free(e); continue; } @@@ -445,10 -444,10 +445,10 @@@ krt_learn_async(struct krt_proto *p, rt { if (g) { - if (krt_uptodate(g, e)) + if (krt_uptodate(&g->rte, e)) { krt_trace_in(p, e, "[alien async] same"); - rte_free(ee, p->krt_table); - rte_free(e); ++ rte_free(ee); return; } krt_trace_in(p, e, "[alien async] updated"); @@@ -464,15 -463,15 +464,15 @@@ else if (!g) { krt_trace_in(p, e, "[alien async] delete failed"); - rte_free(ee, p->krt_table); - rte_free(e); ++ rte_free(ee); return; } else { krt_trace_in(p, e, "[alien async] removed"); *gg = g->next; - rte_free(ee, p->krt_table); - rte_free(g, p->krt_table); - rte_free(e); ++ rte_free(ee); + rte_free(g); } best = n->routes; bestp = &n->routes;