summaryrefslogtreecommitdiff
path: root/proto
diff options
context:
space:
mode:
Diffstat (limited to 'proto')
-rw-r--r--proto/bgp/attrs.c16
-rw-r--r--proto/bgp/packets.c2
2 files changed, 9 insertions, 9 deletions
diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c
index 72a4f68a..597cf96c 100644
--- a/proto/bgp/attrs.c
+++ b/proto/bgp/attrs.c
@@ -383,7 +383,7 @@ bgp_total_aigp_metric_(rte *e, u64 *metric, const struct adata **ad)
return 0;
u64 aigp = get_u64(b + 3);
- u64 step = e->attrs->igp_metric;
+ u64 step = rt_get_igp_metric(e);
if (!rte_resolvable(e) || (step >= IGP_METRIC_UNKNOWN))
step = BGP_AIGP_MAX;
@@ -2046,8 +2046,8 @@ bgp_rte_better(rte *new, rte *old)
return 1;
/* RFC 4271 9.1.2.2. e) Compare IGP metrics */
- n = new_bgp->cf->igp_metric ? new->attrs->igp_metric : 0;
- o = old_bgp->cf->igp_metric ? old->attrs->igp_metric : 0;
+ n = new_bgp->cf->igp_metric ? rt_get_igp_metric(new) : 0;
+ o = old_bgp->cf->igp_metric ? rt_get_igp_metric(old) : 0;
if (n < o)
return 1;
if (n > o)
@@ -2155,8 +2155,8 @@ bgp_rte_mergable(rte *pri, rte *sec)
return 0;
/* RFC 4271 9.1.2.2. e) Compare IGP metrics */
- p = pri_bgp->cf->igp_metric ? pri->attrs->igp_metric : 0;
- s = sec_bgp->cf->igp_metric ? sec->attrs->igp_metric : 0;
+ p = pri_bgp->cf->igp_metric ? rt_get_igp_metric(pri) : 0;
+ s = sec_bgp->cf->igp_metric ? rt_get_igp_metric(sec) : 0;
if (p != s)
return 0;
@@ -2394,14 +2394,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))
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 --git a/proto/bgp/packets.c b/proto/bgp/packets.c
index a18ff373..5c9bb8ba 100644
--- a/proto/bgp/packets.c
+++ b/proto/bgp/packets.c
@@ -969,7 +969,7 @@ bgp_apply_next_hop(struct bgp_parse_state *s, rta *a, ip_addr gw, ip_addr ll)
a->dest = RTD_UNICAST;
a->nh.gw = nbr->addr;
a->nh.iface = nbr->iface;
- a->igp_metric = c->cf->cost;
+ ea_set_attr_u32(&a->eattrs, &ea_gen_igp_metric, 0, c->cf->cost);
}
else /* GW_RECURSIVE */
{