summaryrefslogtreecommitdiff
path: root/proto/bgp
diff options
context:
space:
mode:
authorMaria Matejka <mq@jmq.cz>2020-02-10 08:41:05 +0100
committerMaria Matejka <mq@ucw.cz>2021-10-13 19:09:04 +0200
commiteb937358c087eaeb6f209660cc7ecfe6d6eff739 (patch)
treeb21a471c3c7247eb226cee5cbc9bf887bae6023a /proto/bgp
parentd5a32563df1653952937117133f09143929ff0c2 (diff)
Preference moved to RTA and set explicitly in protocols
Diffstat (limited to 'proto/bgp')
-rw-r--r--proto/bgp/attrs.c6
-rw-r--r--proto/bgp/packets.c1
2 files changed, 4 insertions, 3 deletions
diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c
index 95d1c337..3bdc7596 100644
--- a/proto/bgp/attrs.c
+++ b/proto/bgp/attrs.c
@@ -2117,7 +2117,7 @@ bgp_rte_mergable(rte *pri, rte *sec)
static inline int
same_group(rte *r, u32 lpref, u32 lasn)
{
- return (r->pref == lpref) && (bgp_get_neighbor(r) == lasn);
+ return (r->attrs->pref == lpref) && (bgp_get_neighbor(r) == lasn);
}
static inline int
@@ -2132,7 +2132,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->pref;
+ u32 lpref = key->attrs->pref;
u32 lasn = bgp_get_neighbor(key);
int old_suppressed = old ? old->u.bgp.suppressed : 0;
@@ -2355,7 +2355,7 @@ bgp_get_route_info(rte *e, byte *buf)
eattr *o = ea_find(e->attrs->eattrs, EA_CODE(PROTOCOL_BGP, BA_ORIGIN));
u32 origas;
- buf += bsprintf(buf, " (%d", e->pref);
+ buf += bsprintf(buf, " (%d", e->attrs->pref);
if (e->u.bgp.suppressed)
buf += bsprintf(buf, "-");
diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c
index 99b5d5b4..8d107795 100644
--- a/proto/bgp/packets.c
+++ b/proto/bgp/packets.c
@@ -2440,6 +2440,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;
c->desc->decode_next_hop(s, nh, nh_len, a);
bgp_finish_attrs(s, a);