From 337c04c45e1472d6d9b531a3c55f1f2d30ebf308 Mon Sep 17 00:00:00 2001 From: Maria Matejka Date: Wed, 20 Apr 2022 12:24:26 +0200 Subject: Moved route preference to eattrs --- proto/bgp/attrs.c | 6 +++--- proto/bgp/packets.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'proto/bgp') diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c index 597cf96c..097ba9a2 100644 --- a/proto/bgp/attrs.c +++ b/proto/bgp/attrs.c @@ -2169,7 +2169,7 @@ bgp_rte_mergable(rte *pri, rte *sec) static inline int same_group(rte *r, u32 lpref, u32 lasn) { - return (r->attrs->pref == lpref) && (bgp_get_neighbor(r) == lasn); + return (rt_get_preference(r) == lpref) && (bgp_get_neighbor(r) == lasn); } static inline int @@ -2184,7 +2184,7 @@ bgp_rte_recalculate(rtable *table, net *net, rte *new, rte *old, rte *old_best) { rte *r, *s; rte *key = new ? new : old; - u32 lpref = key->attrs->pref; + u32 lpref = rt_get_preference(key); u32 lasn = bgp_get_neighbor(key); int old_suppressed = old ? !!(old->pflags & BGP_REF_SUPPRESSED) : 0; @@ -2381,7 +2381,7 @@ bgp_get_route_info(rte *e, byte *buf) eattr *o = ea_find(e->attrs->eattrs, BGP_EA_ID(BA_ORIGIN)); u32 origas; - buf += bsprintf(buf, " (%d", e->attrs->pref); + buf += bsprintf(buf, " (%d", rt_get_preference(e)); if (e->pflags & BGP_REF_SUPPRESSED) buf += bsprintf(buf, "-"); diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c index 5c9bb8ba..45a4b1de 100644 --- a/proto/bgp/packets.c +++ b/proto/bgp/packets.c @@ -2478,7 +2478,7 @@ bgp_decode_nlri(struct bgp_parse_state *s, u32 afi, byte *nlri, uint len, ea_lis a->scope = SCOPE_UNIVERSE; a->from = s->proto->remote_ip; a->eattrs = ea; - a->pref = c->c.preference; + ea_set_attr_u32(&a->eattrs, &ea_gen_preference, 0, c->c.preference); c->desc->decode_next_hop(s, nh, nh_len, a); bgp_finish_attrs(s, a); -- cgit v1.2.3