]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
rt-table.c: Solution for missing igp_metric described in issue #154. rt-table_fix
authorKaterina Kubecova <katerina.kubecova@nic.cz>
Tue, 4 Mar 2025 12:00:43 +0000 (13:00 +0100)
committerKaterina Kubecova <katerina.kubecova@nic.cz>
Tue, 4 Mar 2025 12:00:43 +0000 (13:00 +0100)
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.

nest/rt-table.c

index 07600d9fb65e86026cff90795db3cca7206a487c..8517f4bdedd9455db9d45f30e5069360ce1efe5e 100644 (file)
@@ -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);
 }