0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-10-18 01:54:08 +00:00

MPLS: Fix issue with recursive MPLS routes

Recursive MPLS routes used hostentry from the original route, which
triggered different table than MPLS table, and therefore were not
updated.
This commit is contained in:
Ondrej Zajicek 2023-10-16 15:21:36 +02:00
parent 0e1fbaa5b2
commit b5e9e5197b
3 changed files with 8 additions and 3 deletions

View File

@ -1059,10 +1059,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]; const u32 *labels = &src->nh.label[src->nh.labels - src->nh.labels_orig];
mpls_label_stack ms; mpls_label_stack ms;
/* Apply the hostentry with the original labelstack */ /* Reconstruct the original labelstack */
ms.len = src->nh.labels_orig; ms.len = src->nh.labels_orig;
memcpy(ms.stack, labels, src->nh.labels_orig * sizeof(u32)); 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); net_addr_mpls n = NET_ADDR_MPLS(fec->label);

View File

@ -244,7 +244,8 @@ struct hostentry {
ip_addr addr; /* IP address of host, part of key */ ip_addr addr; /* IP address of host, part of key */
ip_addr link; /* (link-local) IP address of host, used as gw ip_addr link; /* (link-local) IP address of host, used as gw
if host is directly attached */ 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 */ struct hostentry *next; /* Next in hash chain */
unsigned hash_key; /* Hash key */ unsigned hash_key; /* Hash key */
unsigned uc; /* Use count */ unsigned uc; /* Use count */

View File

@ -3663,6 +3663,7 @@ rt_get_hostentry(rtable *tab, ip_addr a, ip_addr ll, rtable *dep)
return he; return he;
he = hc_new_hostentry(hc, tab->rp, a, link, dep, k); he = hc_new_hostentry(hc, tab->rp, a, link, dep, k);
he->owner = tab;
rt_update_hostentry(tab, he); rt_update_hostentry(tab, he);
return he; return he;
} }