mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-16 00:25:01 +00:00
zebra: Apply label to all nexthops when needed
The application of a label to a route entry needs to look at all non-recursive nexthops to be attached to instead of just the first one. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
46fe6fd557
commit
8f77d0ee6c
@ -2254,6 +2254,19 @@ void zebra_mpls_print_fec(struct vty *vty, struct zebra_vrf *zvrf,
|
|||||||
fec_print(rn->info, vty);
|
fec_print(rn->info, vty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool mpls_ftn_update_nexthop(int add, struct nexthop *nexthop,
|
||||||
|
enum lsp_types_t type, mpls_label_t label)
|
||||||
|
{
|
||||||
|
if (add && nexthop->nh_label_type == ZEBRA_LSP_NONE)
|
||||||
|
nexthop_add_labels(nexthop, type, 1, &label);
|
||||||
|
else if (!add && nexthop->nh_label_type == type)
|
||||||
|
nexthop_del_labels(nexthop);
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Install/uninstall a FEC-To-NHLFE (FTN) binding.
|
* Install/uninstall a FEC-To-NHLFE (FTN) binding.
|
||||||
*/
|
*/
|
||||||
@ -2266,6 +2279,7 @@ int mpls_ftn_update(int add, struct zebra_vrf *zvrf, enum lsp_types_t type,
|
|||||||
struct route_node *rn;
|
struct route_node *rn;
|
||||||
struct route_entry *re;
|
struct route_entry *re;
|
||||||
struct nexthop *nexthop;
|
struct nexthop *nexthop;
|
||||||
|
bool found;
|
||||||
|
|
||||||
/* Lookup table. */
|
/* Lookup table. */
|
||||||
table = zebra_vrf_table(family2afi(prefix->family), SAFI_UNICAST,
|
table = zebra_vrf_table(family2afi(prefix->family), SAFI_UNICAST,
|
||||||
@ -2285,6 +2299,7 @@ int mpls_ftn_update(int add, struct zebra_vrf *zvrf, enum lsp_types_t type,
|
|||||||
if (re == NULL)
|
if (re == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
found = false;
|
||||||
for (nexthop = re->ng.nexthop; nexthop; nexthop = nexthop->next) {
|
for (nexthop = re->ng.nexthop; nexthop; nexthop = nexthop->next) {
|
||||||
switch (nexthop->type) {
|
switch (nexthop->type) {
|
||||||
case NEXTHOP_TYPE_IPV4:
|
case NEXTHOP_TYPE_IPV4:
|
||||||
@ -2297,7 +2312,11 @@ int mpls_ftn_update(int add, struct zebra_vrf *zvrf, enum lsp_types_t type,
|
|||||||
if (nexthop->type == NEXTHOP_TYPE_IPV4_IFINDEX
|
if (nexthop->type == NEXTHOP_TYPE_IPV4_IFINDEX
|
||||||
&& nexthop->ifindex != ifindex)
|
&& nexthop->ifindex != ifindex)
|
||||||
continue;
|
continue;
|
||||||
goto found;
|
if (!mpls_ftn_update_nexthop(add, nexthop, type,
|
||||||
|
out_label))
|
||||||
|
return 0;
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
case NEXTHOP_TYPE_IPV6:
|
case NEXTHOP_TYPE_IPV6:
|
||||||
case NEXTHOP_TYPE_IPV6_IFINDEX:
|
case NEXTHOP_TYPE_IPV6_IFINDEX:
|
||||||
if (gtype != NEXTHOP_TYPE_IPV6
|
if (gtype != NEXTHOP_TYPE_IPV6
|
||||||
@ -2308,21 +2327,18 @@ int mpls_ftn_update(int add, struct zebra_vrf *zvrf, enum lsp_types_t type,
|
|||||||
if (nexthop->type == NEXTHOP_TYPE_IPV6_IFINDEX
|
if (nexthop->type == NEXTHOP_TYPE_IPV6_IFINDEX
|
||||||
&& nexthop->ifindex != ifindex)
|
&& nexthop->ifindex != ifindex)
|
||||||
continue;
|
continue;
|
||||||
goto found;
|
if (!mpls_ftn_update_nexthop(add, nexthop, type,
|
||||||
|
out_label))
|
||||||
|
return 0;
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* nexthop not found */
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
found:
|
if (!found)
|
||||||
if (add && nexthop->nh_label_type == ZEBRA_LSP_NONE)
|
return -1;
|
||||||
nexthop_add_labels(nexthop, type, 1, &out_label);
|
|
||||||
else if (!add && nexthop->nh_label_type == type)
|
|
||||||
nexthop_del_labels(nexthop);
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
SET_FLAG(re->status, ROUTE_ENTRY_CHANGED);
|
SET_FLAG(re->status, ROUTE_ENTRY_CHANGED);
|
||||||
SET_FLAG(re->status, ROUTE_ENTRY_LABELS_CHANGED);
|
SET_FLAG(re->status, ROUTE_ENTRY_LABELS_CHANGED);
|
||||||
|
Loading…
Reference in New Issue
Block a user