From: Katerina Kubecova Date: Tue, 4 Mar 2025 12:00:43 +0000 (+0100) Subject: rt-table.c: Solution for missing igp_metric described in issue #154. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fheads%2Frt-table_fix;p=thirdparty%2Fbird.git rt-table.c: Solution for missing igp_metric described in issue #154. The igp_metric was set as an eattr, but not as a hostentry attribut. However, the eattr was ignored and possibly even rewritten to the hostentry (default) value. The hostentry is initialized in ea_set_hostentry. There is an ea_list, but it is not used for setting the igp_metric and it seems like it does not contain the igp_metric at all. That is why I set it in rt_next_hop_resolve_rte. --- diff --git a/nest/rt-table.c b/nest/rt-table.c index 07600d9fb..8517f4bde 100644 --- a/nest/rt-table.c +++ b/nest/rt-table.c @@ -3894,6 +3894,8 @@ ea_set_hostentry(ea_list **to, rtable *dep, rtable *src, ip_addr gw, ip_addr ll, RT_LOCKED(src, tab) h->head.he = rt_get_hostentry(tab, gw, ll, dep); + // It would be nice to set the igp_mertic here, but it looks like we do not have it here or yet + memcpy(h->head.labels, labels, lnum * sizeof(u32)); ea_set_attr_data(to, &ea_gen_hostentry, 0, h->head.ad.data, (byte *) &h->head.labels[lnum] - h->head.ad.data); @@ -4050,9 +4052,16 @@ static inline void rt_next_hop_resolve_rte(rte *r) { eattr *heea = ea_find(r->attrs, &ea_gen_hostentry); + if (!heea) return; + struct hostentry_adata *head = (struct hostentry_adata *) heea->u.ptr; + eattr * igp = ea_find_by_class(r->attrs, &ea_gen_igp_metric); + + if (igp) + head->he->igp_metric = igp->u.data; + rta_apply_hostentry(&r->attrs, (struct hostentry_adata *) heea->u.ptr); }