Merge pull request #9434 from anlancs/fix-zebra-mpls-cmd

zebra: fix wrong check of mpls command
This commit is contained in:
Mark Stapp 2021-08-23 09:02:15 -04:00 committed by GitHub
commit b87c5f4dd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -67,11 +67,6 @@ static int zebra_mpls_transit_lsp(struct vty *vty, int add_cmd,
return CMD_WARNING_CONFIG_FAILED;
}
if (gate_str == NULL) {
vty_out(vty, "%% No Nexthop Information\n");
return CMD_WARNING_CONFIG_FAILED;
}
out_label = MPLS_LABEL_IMPLICIT_NULL; /* as initialization */
label = atoi(inlabel_str);
if (!IS_MPLS_UNRESERVED_LABEL(label)) {
@ -91,18 +86,21 @@ static int zebra_mpls_transit_lsp(struct vty *vty, int add_cmd,
}
in_label = label;
gtype = NEXTHOP_TYPE_BLACKHOLE; /* as initialization */
/* Gateway is a IPv4 or IPv6 nexthop. */
ret = inet_pton(AF_INET6, gate_str, &gate.ipv6);
if (ret == 1)
gtype = NEXTHOP_TYPE_IPV6;
else {
ret = inet_pton(AF_INET, gate_str, &gate.ipv4);
if (gate_str) {
/* Gateway is a IPv4 or IPv6 nexthop. */
ret = inet_pton(AF_INET6, gate_str, &gate.ipv6);
if (ret == 1)
gtype = NEXTHOP_TYPE_IPV4;
gtype = NEXTHOP_TYPE_IPV6;
else {
vty_out(vty, "%% Invalid nexthop\n");
return CMD_WARNING_CONFIG_FAILED;
ret = inet_pton(AF_INET, gate_str, &gate.ipv4);
if (ret == 1)
gtype = NEXTHOP_TYPE_IPV4;
else {
vty_out(vty, "%% Invalid nexthop\n");
return CMD_WARNING_CONFIG_FAILED;
}
}
}