From: Maria Matejka Date: Mon, 30 May 2022 14:59:24 +0000 (+0200) Subject: Merge commit '17f91f9e6e70f7e3f29502e854823c0d48571eaa' into haugesund X-Git-Tag: v3.0-alpha1~171^2~56 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5051e3c4afe04aeb59abeaa3370c9e660dfa37f1;p=thirdparty%2Fbird.git Merge commit '17f91f9e6e70f7e3f29502e854823c0d48571eaa' into haugesund --- 5051e3c4afe04aeb59abeaa3370c9e660dfa37f1 diff --cc nest/protocol.h index b6aa64697,8f0cc4b4e..1d7dea4bf --- a/nest/protocol.h +++ b/nest/protocol.h @@@ -77,9 -58,10 +59,9 @@@ struct protocol void (*dump)(struct proto *); /* Debugging dump */ int (*start)(struct proto *); /* Start the instance */ int (*shutdown)(struct proto *); /* Stop the instance */ - void (*cleanup)(struct proto *); /* Called after shutdown when protocol became hungry/down */ void (*get_status)(struct proto *, byte *buf); /* Get instance status (for `show protocols' command) */ void (*get_route_info)(struct rte *, byte *buf); /* Get route information (for `show route' command) */ - int (*get_attr)(const struct eattr *, byte *buf, int buflen); /* ASCIIfy dynamic attribute (returns GA_*) */ + // int (*get_attr)(const struct eattr *, byte *buf, int buflen); /* ASCIIfy dynamic attribute (returns GA_*) */ void (*show_proto_info)(struct proto *); /* Show protocol info (for `show protocols all' command) */ void (*copy_config)(struct proto_config *, struct proto_config *); /* Copy config from given protocol instance */ }; diff --cc proto/bgp/attrs.c index e6f11a88a,72a4f68ad..a713b7a2a --- a/proto/bgp/attrs.c +++ b/proto/bgp/attrs.c @@@ -357,13 -372,13 +372,13 @@@ bgp_aigp_set_metric(struct linpool *poo } int -bgp_total_aigp_metric_(rte *e, u64 *metric, const struct adata **ad) +bgp_total_aigp_metric_(struct rta *a, u64 *metric, const struct adata **ad) { - eattr *ea = ea_find(a->eattrs, EA_CODE(PROTOCOL_BGP, BA_AIGP)); - eattr *a = ea_find(e->attrs->eattrs, BGP_EA_ID(BA_AIGP)); - if (!a) ++ eattr *ea = ea_find(a->eattrs, BGP_EA_ID(BA_AIGP)); + if (!ea) return 0; - const byte *b = bgp_aigp_get_tlv(a->u.ptr, BGP_AIGP_METRIC); + const byte *b = bgp_aigp_get_tlv(ea->u.ptr, BGP_AIGP_METRIC); if (!b) return 0; @@@ -1702,11 -1729,11 +1730,11 @@@ bgp_preexport(struct channel *c, rte *e } /* Handle well-known communities, RFC 1997 */ - struct eattr *c; + struct eattr *com; if (p->cf->interpret_communities && - (com = ea_find(e->attrs->eattrs, EA_CODE(PROTOCOL_BGP, BA_COMMUNITY)))) - (c = ea_find(e->attrs->eattrs, BGP_EA_ID(BA_COMMUNITY)))) ++ (com = ea_find(e->attrs->eattrs, BGP_EA_ID(BA_COMMUNITY)))) { - const struct adata *d = c->u.ptr; + const struct adata *d = com->u.ptr; /* Do not export anywhere */ if (int_set_contains(d, BGP_COMM_NO_ADVERTISE)) @@@ -2278,12 -2306,12 +2306,12 @@@ bgp_rte_recalculate(rtable *table, net return !old_suppressed; } -struct rte * +rte * bgp_rte_modify_stale(struct rte *r, struct linpool *pool) { - eattr *ea = ea_find(r->attrs->eattrs, EA_CODE(PROTOCOL_BGP, BA_COMMUNITY)); - eattr *a = ea_find(r->attrs->eattrs, BGP_EA_ID(BA_COMMUNITY)); - const struct adata *ad = a ? a->u.ptr : NULL; - uint flags = a ? a->flags : BAF_PARTIAL; ++ eattr *ea = ea_find(r->attrs->eattrs, BGP_EA_ID(BA_COMMUNITY)); + const struct adata *ad = ea ? ea->u.ptr : NULL; + uint flags = ea ? ea->flags : BAF_PARTIAL; if (ad && int_set_contains(ad, BGP_COMM_NO_LLGR)) return NULL; diff --cc proto/bgp/bgp.h index cf6e2b6f2,e04e3bd07..554681b4b --- a/proto/bgp/bgp.h +++ b/proto/bgp/bgp.h @@@ -571,11 -567,10 +567,10 @@@ int bgp_rte_mergable(rte *pri, rte *sec int bgp_rte_recalculate(rtable *table, net *net, rte *new, rte *old, rte *old_best); struct rte *bgp_rte_modify_stale(struct rte *r, struct linpool *pool); u32 bgp_rte_igp_metric(struct rte *); -void bgp_rt_notify(struct proto *P, struct channel *C, net *n, rte *new, rte *old); -int bgp_preexport(struct proto *, struct rte *); -void bgp_get_route_info(struct rte *, byte *buf); -int bgp_total_aigp_metric_(rte *e, u64 *metric, const struct adata **ad); +void bgp_rt_notify(struct proto *P, struct channel *C, const net_addr *n, rte *new, const rte *old); +int bgp_preexport(struct channel *, struct rte *); - int bgp_get_attr(const struct eattr *e, byte *buf, int buflen); +void bgp_get_route_info(struct rte *, byte *); +int bgp_total_aigp_metric_(rta *a, u64 *metric, const struct adata **ad); #define BGP_AIGP_METRIC 1 #define BGP_AIGP_MAX U64(0xffffffffffffffff) diff --cc proto/ospf/ospf.c index ab77de020,66d0eba67..e4522d41d --- a/proto/ospf/ospf.c +++ b/proto/ospf/ospf.c @@@ -106,8 -106,9 +106,9 @@@ #include #include "ospf.h" + #include "lib/macro.h" -static int ospf_preexport(struct proto *P, rte *new); +static int ospf_preexport(struct channel *C, rte *new); static void ospf_reload_routes(struct channel *C); static int ospf_rte_better(struct rte *new, struct rte *old); static u32 ospf_rte_igp_metric(struct rte *rt); diff --cc sysdep/linux/netlink.c index 7702c8155,23d41b56c..f7c5943b9 --- a/sysdep/linux/netlink.c +++ b/sysdep/linux/netlink.c @@@ -1577,31 -1674,23 +1673,25 @@@ nl_mergable_route(struct nl_parse_stat static void nl_announce_route(struct nl_parse_state *s) { - rte *e = rte_get_temp(s->attrs, s->proto->p.main_source); - e->net = s->net; + rte e0 = { + .attrs = s->attrs, + .net = s->net, + }; - EA_LOCAL_LIST(2) ea0 = { + EA_LOCAL_LIST(2) ea = { - .l = { .count = 2, .next = e->attrs->eattrs }, + .l = { .count = 2, .next = e0.attrs->eattrs }, - .a[0] = (eattr) { - .id = EA_KRT_SOURCE, - .type = T_INT, - .u.data = s->krt_proto, - }, - .a[1] = (eattr) { - .id = EA_KRT_METRIC, - .type = T_INT, - .u.data = s->krt_metric, + .a = { + EA_LITERAL_EMBEDDED(&ea_krt_source, 0, s->krt_proto), + EA_LITERAL_EMBEDDED(&ea_krt_metric, 0, s->krt_metric), }, }; - e0.attrs->eattrs = &ea0.l; - e->attrs->eattrs = &ea.l; ++ e0.attrs->eattrs = &ea.l; if (s->scan) - krt_got_route(s->proto, e, s->krt_src); + krt_got_route(s->proto, &e0, s->krt_src); else - krt_got_route_async(s->proto, e, s->new, s->krt_src); + krt_got_route_async(s->proto, &e0, s->new, s->krt_src); s->net = NULL; s->attrs = NULL;