+// SPDX-License-Identifier: GPL-2.0-or-later
/* Zebra MPLS VTY functions
* Copyright (C) 2002 Kunihiro Ishiguro
- *
- * This file is part of GNU Zebra.
- *
- * GNU Zebra is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * GNU Zebra is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <zebra.h>
return CMD_WARNING_CONFIG_FAILED;
}
- zvrf = vrf_info_lookup(VRF_DEFAULT);
+ zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT);
if (!zvrf) {
vty_out(vty, "%% Default VRF does not exist\n");
return CMD_WARNING_CONFIG_FAILED;
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)) {
}
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;
+ }
}
}
uint32_t label;
int ret;
- zvrf = vrf_info_lookup(VRF_DEFAULT);
+ zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT);
if (!zvrf) {
vty_out(vty, "%% Default VRF does not exist\n");
return CMD_WARNING_CONFIG_FAILED;
}
- memset(&p, 0, sizeof(struct prefix));
+ memset(&p, 0, sizeof(p));
ret = str2prefix(prefix, &p);
if (ret <= 0) {
vty_out(vty, "%% Malformed address\n");
int write = 0;
struct zebra_vrf *zvrf;
- zvrf = vrf_info_lookup(VRF_DEFAULT);
+ zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT);
if (!zvrf)
return 0;
struct prefix p;
int ret;
- zvrf = vrf_info_lookup(VRF_DEFAULT);
+ zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT);
if (!zvrf)
return 0;
struct zebra_vrf *zvrf;
bool uj = use_json(argc, argv);
- zvrf = vrf_info_lookup(VRF_DEFAULT);
+ zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT);
zebra_mpls_print_lsp_table(vty, zvrf, uj);
return CMD_SUCCESS;
}
struct zebra_vrf *zvrf;
bool uj = use_json(argc, argv);
- zvrf = vrf_info_lookup(VRF_DEFAULT);
+ zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT);
label = atoi(argv[3]->arg);
zebra_mpls_print_lsp(vty, zvrf, label, uj);
return CMD_SUCCESS;