diff options
Diffstat (limited to 'isisd/isis_zebra.c')
| -rw-r--r-- | isisd/isis_zebra.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/isisd/isis_zebra.c b/isisd/isis_zebra.c index b9958a6696..1b4b0c8f2f 100644 --- a/isisd/isis_zebra.c +++ b/isisd/isis_zebra.c @@ -207,35 +207,30 @@ static int isis_zebra_add_nexthops(struct isis *isis, struct list *nexthops, api_nh->ifindex = nexthop->ifindex; /* Add MPLS label(s). */ - switch (type) { - case ISIS_NEXTHOP_MAIN: - if (nexthop->sr.present) { - api_nh->label_num = 1; - api_nh->labels[0] = nexthop->sr.label; - } else if (mpls_lsp) + if (nexthop->label_stack) { + api_nh->label_num = nexthop->label_stack->num_labels; + memcpy(api_nh->labels, nexthop->label_stack->label, + sizeof(mpls_label_t) * api_nh->label_num); + } else if (nexthop->sr.present) { + api_nh->label_num = 1; + api_nh->labels[0] = nexthop->sr.label; + } else if (mpls_lsp) { + switch (type) { + case ISIS_NEXTHOP_MAIN: /* * Do not use non-SR enabled nexthops to prevent * broken LSPs from being formed. */ continue; - break; - case ISIS_NEXTHOP_BACKUP: - if (nexthop->label_stack) { - api_nh->label_num = - nexthop->label_stack->num_labels; - memcpy(api_nh->labels, - nexthop->label_stack->label, - sizeof(mpls_label_t) - * api_nh->label_num); - } else if (mpls_lsp) { + case ISIS_NEXTHOP_BACKUP: /* * This is necessary because zebra requires * the nexthops of MPLS LSPs to be labeled. */ api_nh->label_num = 1; api_nh->labels[0] = MPLS_LABEL_IMPLICIT_NULL; + break; } - break; } /* Backup nexthop handling. */ @@ -263,9 +258,15 @@ void isis_zebra_route_add_route(struct isis *isis, struct prefix *prefix, struct zapi_route api; int count = 0; - if (zclient->sock < 0 || list_isempty(route_info->nexthops)) + if (zclient->sock < 0) return; + /* Uninstall the route if it doesn't have any valid nexthop. */ + if (list_isempty(route_info->nexthops)) { + isis_zebra_route_del_route(isis, prefix, src_p, route_info); + return; + } + memset(&api, 0, sizeof(api)); api.vrf_id = isis->vrf_id; api.type = PROTO_TYPE; |
