diff options
author | Mark Stapp <mjs@voltanet.io> | 2021-08-09 19:16:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-09 19:16:10 +0200 |
commit | c123e9df54e55c61b1666ec3b55b267c86865d49 (patch) | |
tree | 40b885ba836de3ff162b1ba00faa3e32c644190d /zebra | |
parent | Merge pull request #9273 from dlqs/luadofilefix (diff) | |
parent | zebra: prevent crash when nhlfe is NULL (diff) | |
download | frr-c123e9df54e55c61b1666ec3b55b267c86865d49.tar.xz frr-c123e9df54e55c61b1666ec3b55b267c86865d49.zip |
Merge pull request #9299 from donaldsharp/zebra_should_continue
Zebra should continue
Diffstat (limited to 'zebra')
-rw-r--r-- | zebra/zebra_mpls.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c index 66d2d6b4b..2f83fe4e2 100644 --- a/zebra/zebra_mpls.c +++ b/zebra/zebra_mpls.c @@ -752,7 +752,7 @@ static int nhlfe_nexthop_active(zebra_nhlfe_t *nhlfe) } break; - default: + case NEXTHOP_TYPE_BLACKHOLE: break; } @@ -1183,7 +1183,7 @@ static char *nhlfe2str(const zebra_nhlfe_t *nhlfe, char *buf, int size) break; case NEXTHOP_TYPE_IFINDEX: snprintf(buf, size, "Ifindex: %u", nexthop->ifindex); - default: + case NEXTHOP_TYPE_BLACKHOLE: break; } @@ -1224,7 +1224,7 @@ static int nhlfe_nhop_match(zebra_nhlfe_t *nhlfe, enum nexthop_types_t gtype, case NEXTHOP_TYPE_IFINDEX: cmp = !(nhop->ifindex == ifindex); break; - default: + case NEXTHOP_TYPE_BLACKHOLE: break; } @@ -1294,7 +1294,7 @@ static zebra_nhlfe_t *nhlfe_alloc(zebra_lsp_t *lsp, enum lsp_types_t lsp_type, case NEXTHOP_TYPE_IFINDEX: nexthop->ifindex = ifindex; break; - default: + case NEXTHOP_TYPE_BLACKHOLE: nexthop_free(nexthop); XFREE(MTYPE_NHLFE, nhlfe); return NULL; @@ -1323,6 +1323,9 @@ static zebra_nhlfe_t *nhlfe_add(zebra_lsp_t *lsp, enum lsp_types_t lsp_type, nhlfe = nhlfe_alloc(lsp, lsp_type, gtype, gate, ifindex, num_labels, labels); + if (!nhlfe) + return NULL; + /* Enqueue to LSP: primaries at head of list, backups at tail */ if (is_backup) { SET_FLAG(nhlfe->flags, NHLFE_FLAG_IS_BACKUP); @@ -1527,7 +1530,8 @@ static json_object *nhlfe_json(zebra_nhlfe_t *nhlfe) ifindex2ifname(nexthop->ifindex, nexthop->vrf_id)); break; - default: + case NEXTHOP_TYPE_BLACKHOLE: + case NEXTHOP_TYPE_IFINDEX: break; } @@ -1588,7 +1592,8 @@ static void nhlfe_print(zebra_nhlfe_t *nhlfe, struct vty *vty, ifindex2ifname(nexthop->ifindex, nexthop->vrf_id)); break; - default: + case NEXTHOP_TYPE_BLACKHOLE: + case NEXTHOP_TYPE_IFINDEX: break; } vty_out(vty, "%s", @@ -2830,7 +2835,8 @@ static bool ftn_update_znh(bool add_p, enum lsp_types_t type, break; success = true; break; - default: + case NEXTHOP_TYPE_BLACKHOLE: + case NEXTHOP_TYPE_IFINDEX: break; } @@ -3752,7 +3758,7 @@ void zebra_mpls_print_lsp_table(struct vty *vty, struct zebra_vrf *zvrf, inet_ntop(AF_INET6, &nexthop->gate.ipv6, nh_buf, sizeof(nh_buf)); break; - default: + case NEXTHOP_TYPE_BLACKHOLE: break; } @@ -3795,7 +3801,11 @@ static char *nhlfe_config_str(const zebra_nhlfe_t *nhlfe, char *buf, int size) buf[0] = '\0'; switch (nh->type) { case NEXTHOP_TYPE_IPV4: + case NEXTHOP_TYPE_IPV4_IFINDEX: inet_ntop(AF_INET, &nh->gate.ipv4, buf, size); + if (nh->ifindex) + strlcat(buf, ifindex2ifname(nh->ifindex, VRF_DEFAULT), + size); break; case NEXTHOP_TYPE_IPV6: case NEXTHOP_TYPE_IPV6_IFINDEX: @@ -3805,7 +3815,8 @@ static char *nhlfe_config_str(const zebra_nhlfe_t *nhlfe, char *buf, int size) ifindex2ifname(nh->ifindex, VRF_DEFAULT), size); break; - default: + case NEXTHOP_TYPE_BLACKHOLE: + case NEXTHOP_TYPE_IFINDEX: break; } |