diff options
author | Maria Matejka <mq@ucw.cz> | 2022-07-12 14:46:06 +0200 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2022-07-12 14:46:06 +0200 |
commit | 1df20989c191353d9c6da4d8679f8cb1ead49f7f (patch) | |
tree | a40097fcf4687f1b9d33a3ba794e38898bfbab4f /proto/bgp/attrs.c | |
parent | 44f26c49f966ca842ff9af55468de0b98c44b73e (diff) |
Revert "Special table hooks rectified."
This reverts commit 44f26c49f966ca842ff9af55468de0b98c44b73e.
Diffstat (limited to 'proto/bgp/attrs.c')
-rw-r--r-- | proto/bgp/attrs.c | 50 |
1 files changed, 18 insertions, 32 deletions
diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c index 892b26e3..90490b4f 100644 --- a/proto/bgp/attrs.c +++ b/proto/bgp/attrs.c @@ -2267,44 +2267,30 @@ bgp_rte_recalculate(rtable *table, net *net, rte *new, rte *old, rte *old_best) return !old_suppressed; } -void -bgp_rte_modify_stale(struct rt_export_request *req, const net_addr *n, struct rt_pending_export *rpe UNUSED, rte **feed, uint count) +rte * +bgp_rte_modify_stale(struct rte *r, struct linpool *pool) { - struct bgp_channel *c = SKIP_BACK(struct bgp_channel, stale_feed, req); - - do { - rte *r = feed[--count]; - if (r->sender != c->c.in_req.hook) - continue; - - /* A new route, do not mark as stale */ - if (r->stale_cycle == c->c.in_req.hook->stale_set) - continue; - - eattr *ea = ea_find(r->attrs->eattrs, EA_CODE(PROTOCOL_BGP, BA_COMMUNITY)); - const struct adata *ad = ea ? ea->u.ptr : NULL; - uint flags = ea ? ea->flags : BAF_PARTIAL; + eattr *ea = ea_find(r->attrs->eattrs, EA_CODE(PROTOCOL_BGP, BA_COMMUNITY)); + const struct adata *ad = ea ? ea->u.ptr : NULL; + uint flags = ea ? ea->flags : BAF_PARTIAL; - rte e0 = *r; - e0.flags |= REF_USE_STALE; - - if (ad && int_set_contains(ad, BGP_COMM_NO_LLGR)) - rte_import(&c->c.in_req, n, NULL, r->src); + if (ad && int_set_contains(ad, BGP_COMM_NO_LLGR)) + return NULL; - else if (ad && int_set_contains(ad, BGP_COMM_LLGR_STALE)) - rte_import(&c->c.in_req, n, &e0, r->src); + if (ad && int_set_contains(ad, BGP_COMM_LLGR_STALE)) + return r; - else { - rta *a = e0.attrs = rta_do_cow(r->attrs, bgp_linpool); + rta *a = rta_do_cow(r->attrs, pool); + + _Thread_local static rte e0; + e0 = *r; + e0.attrs = a; - bgp_set_attr_ptr(&(a->eattrs), bgp_linpool, BA_COMMUNITY, flags, - int_set_add(bgp_linpool, ad, BGP_COMM_LLGR_STALE)); - e0.pflags |= BGP_REF_STALE; + bgp_set_attr_ptr(&(a->eattrs), pool, BA_COMMUNITY, flags, + int_set_add(pool, ad, BGP_COMM_LLGR_STALE)); + e0.pflags |= BGP_REF_STALE; - rte_import(&c->c.in_req, n, &e0, r->src); - lp_flush(bgp_linpool); - } - } while (count); + return &e0; } |