From: Maria Matejka Date: Mon, 30 May 2022 15:11:30 +0000 (+0200) Subject: Merge commit 'd8661a4397e4576ac404661b192dd99d928e7890' into haugesund X-Git-Tag: v3.0-alpha1~171^2~55 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=674587d9c84ed70151abc56003c371668079ae31;p=thirdparty%2Fbird.git Merge commit 'd8661a4397e4576ac404661b192dd99d928e7890' into haugesund --- 674587d9c84ed70151abc56003c371668079ae31 diff --cc lib/route.h index 7bc67847b,3b3686964..8253ab8e2 --- a/lib/route.h +++ b/lib/route.h @@@ -324,6 -319,6 +321,6 @@@ void rta_dump(rta *) void rta_dump_all(void); void rta_show(struct cli *, rta *); --u32 rt_get_igp_metric(rte *rt); ++u32 rt_get_igp_metric(const rte *rt); #endif diff --cc nest/protocol.h index 1d7dea4bf,8f0cc4b4e..aeb60ac65 --- a/nest/protocol.h +++ b/nest/protocol.h @@@ -189,10 -214,10 +189,10 @@@ struct proto int (*rte_recalculate)(struct rtable *, struct network *, struct rte *, struct rte *, struct rte *); int (*rte_better)(struct rte *, struct rte *); int (*rte_mergable)(struct rte *, struct rte *); - struct rte * (*rte_modify)(struct rte *, struct linpool *); + struct rte *(*rte_modify)(struct rte *, struct linpool *); void (*rte_insert)(struct network *, struct rte *); void (*rte_remove)(struct network *, struct rte *); -- u32 (*rte_igp_metric)(struct rte *); ++ u32 (*rte_igp_metric)(const struct rte *); /* Hic sunt protocol-specific data */ }; diff --cc nest/rt-table.c index 849f6766f,01194e021..d89c087df --- a/nest/rt-table.c +++ b/nest/rt-table.c @@@ -3534,7 -3458,7 +3536,7 @@@ if_local_addr(ip_addr a, struct iface * } u32 --rt_get_igp_metric(rte *rt) ++rt_get_igp_metric(const rte *rt) { eattr *ea = ea_find(rt->attrs->eattrs, "igp_metric"); diff --cc proto/babel/babel.c index f19a2e0f5,97dca4ace..eaebdb831 --- a/proto/babel/babel.c +++ b/proto/babel/babel.c @@@ -2344,7 -2341,7 +2344,7 @@@ babel_rte_better(struct rte *new, struc } static u32 --babel_rte_igp_metric(struct rte *rt) ++babel_rte_igp_metric(const rte *rt) { return ea_get_int(rt->attrs->eattrs, &ea_babel_metric, BABEL_INFINITY); } diff --cc proto/bgp/attrs.c index a713b7a2a,597cf96cb..73939bf0e --- a/proto/bgp/attrs.c +++ b/proto/bgp/attrs.c @@@ -372,20 -372,20 +372,22 @@@ bgp_aigp_set_metric(struct linpool *poo } int - bgp_total_aigp_metric_(struct rta *a, u64 *metric, const struct adata **ad) -bgp_total_aigp_metric_(rte *e, u64 *metric, const struct adata **ad) ++bgp_total_aigp_metric_(const rte *e, u64 *metric, const struct adata **ad) { - eattr *a = ea_find(e->attrs->eattrs, BGP_EA_ID(BA_AIGP)); - if (!a) ++ rta *a = e->attrs; ++ + 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; u64 aigp = get_u64(b + 3); - u64 step = a->igp_metric; + u64 step = rt_get_igp_metric(e); - if (!rte_resolvable(e) || (step >= IGP_METRIC_UNKNOWN)) + if (!rta_resolvable(a) || (step >= IGP_METRIC_UNKNOWN)) step = BGP_AIGP_MAX; if (!step) @@@ -411,9 -411,9 +413,9 @@@ bgp_init_aigp_metric(rte *e, u64 *metri } u32 --bgp_rte_igp_metric(struct rte *rt) ++bgp_rte_igp_metric(const rte *rt) { - u64 metric = bgp_total_aigp_metric(rt->attrs); + u64 metric = bgp_total_aigp_metric(rt); return (u32) MIN(metric, (u64) IGP_METRIC_UNKNOWN); } @@@ -2399,14 -2394,14 +2401,14 @@@ bgp_get_route_info(rte *e, byte *buf { buf += bsprintf(buf, "/%lu", metric); } - else if (e->attrs->igp_metric) + else if (metric = rt_get_igp_metric(e)) { - if (!rte_resolvable(e)) + if (!rta_resolvable(e->attrs)) buf += bsprintf(buf, "/-"); - else if (e->attrs->igp_metric >= IGP_METRIC_UNKNOWN) + else if (metric >= IGP_METRIC_UNKNOWN) buf += bsprintf(buf, "/?"); else - buf += bsprintf(buf, "/%d", e->attrs->igp_metric); + buf += bsprintf(buf, "/%d", metric); } buf += bsprintf(buf, ") ["); diff --cc proto/bgp/bgp.h index 554681b4b,e04e3bd07..d0c2daf2c --- a/proto/bgp/bgp.h +++ b/proto/bgp/bgp.h @@@ -566,22 -566,22 +566,22 @@@ int bgp_rte_better(struct rte *, struc 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); ++u32 bgp_rte_igp_metric(const rte *); +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 *); +void bgp_get_route_info(struct rte *, byte *); - int bgp_total_aigp_metric_(rta *a, u64 *metric, const struct adata **ad); ++int bgp_total_aigp_metric_(const rte *e, u64 *metric, const struct adata **ad); #define BGP_AIGP_METRIC 1 #define BGP_AIGP_MAX U64(0xffffffffffffffff) static inline u64 - bgp_total_aigp_metric(rta *a) -bgp_total_aigp_metric(rte *r) ++bgp_total_aigp_metric(const rte *e) { u64 metric = BGP_AIGP_MAX; const struct adata *ad; - bgp_total_aigp_metric_(a, &metric, &ad); - bgp_total_aigp_metric_(r, &metric, &ad); ++ bgp_total_aigp_metric_(e, &metric, &ad); return metric; } diff --cc proto/ospf/ospf.c index e4522d41d,66d0eba67..bb0d6aaca --- a/proto/ospf/ospf.c +++ b/proto/ospf/ospf.c @@@ -108,10 -108,10 +108,10 @@@ #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); ++static u32 ospf_rte_igp_metric(const rte *rt); static void ospf_disp(timer *timer); @@@ -411,7 -411,7 +411,7 @@@ ospf_rte_better(struct rte *new, struc } static u32 --ospf_rte_igp_metric(struct rte *rt) ++ospf_rte_igp_metric(const rte *rt) { if (rt->attrs->source == RTS_OSPF_EXT2) return IGP_METRIC_UNKNOWN; diff --cc proto/rip/rip.c index 03e0f4fb8,52a3bd2c9..739fe96cb --- a/proto/rip/rip.c +++ b/proto/rip/rip.c @@@ -1103,7 -1104,7 +1103,7 @@@ rip_rte_better(struct rte *new, struct } static u32 --rip_rte_igp_metric(struct rte *rt) ++rip_rte_igp_metric(const rte *rt) { return ea_get_int(rt->attrs->eattrs, &ea_rip_metric, IGP_METRIC_UNKNOWN); }