]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
MPLS: Fix issue with recursive MPLS routes
authorOndrej Zajicek <santiago@crfreenet.org>
Mon, 16 Oct 2023 13:21:36 +0000 (15:21 +0200)
committerMaria Matejka <mq@ucw.cz>
Tue, 7 Nov 2023 15:06:15 +0000 (16:06 +0100)
Recursive MPLS routes used hostentry from the original route, which
triggered different table than MPLS table, and therefore were not
updated.

nest/mpls.c
nest/route.h
nest/rt-table.c

index cd3a90d97c155748cac7af14e7185dc6e7f2c908..1992234ca9c23d2cded4b21e697003279a54c8ac 100644 (file)
@@ -838,10 +838,13 @@ mpls_announce_fec(struct mpls_fec_map *m, struct mpls_fec *fec, const rta *src)
     const u32 *labels = &src->nh.label[src->nh.labels - src->nh.labels_orig];
     mpls_label_stack ms;
 
-    /* Apply the hostentry with the original labelstack */
+    /* Reconstruct the original labelstack */
     ms.len = src->nh.labels_orig;
     memcpy(ms.stack, labels, src->nh.labels_orig * sizeof(u32));
-    rta_apply_hostentry(a, src->hostentry, &ms);
+
+    /* The same hostentry, but different dependent table */
+    struct hostentry *s = src->hostentry;
+    rta_set_recursive_next_hop(m->channel->table, a, s->owner, s->addr, s->link, &ms);
   }
 
   net_addr_mpls n = NET_ADDR_MPLS(fec->label);
index a9bcd7d3120a734f0a3b4dd2f74ebb0fa74c2295..0e502b99e746e0a4702ba8aad8f431decd7174c5 100644 (file)
@@ -244,7 +244,8 @@ struct hostentry {
   ip_addr addr;                                /* IP address of host, part of key */
   ip_addr link;                                /* (link-local) IP address of host, used as gw
                                           if host is directly attached */
-  struct rtable *tab;                  /* Dependent table, part of key */
+  rtable *tab;                         /* Dependent table, part of key */
+  rtable *owner;                       /* Nexthop owner table */
   struct hostentry *next;              /* Next in hash chain */
   unsigned hash_key;                   /* Hash key */
   unsigned uc;                         /* Use count */
index e1b2867f032ef7e18491e16818264c0f3edb2cd9..31c59ccb3a48ac3db89188101c3ea947d431dc65 100644 (file)
@@ -3659,6 +3659,7 @@ rt_get_hostentry(rtable *tab, ip_addr a, ip_addr ll, rtable *dep)
       return he;
 
   he = hc_new_hostentry(hc, tab->rp, a, link, dep, k);
+  he->owner = tab;
   rt_update_hostentry(tab, he);
   return he;
 }