summaryrefslogtreecommitdiff
path: root/zebra/zebra_vty.c
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/zebra_vty.c')
-rw-r--r--zebra/zebra_vty.c249
1 files changed, 118 insertions, 131 deletions
diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c
index 88778e491b..c861efbddf 100644
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -79,7 +79,7 @@ zebra_static_ipv4 (struct vty *vty, safi_t safi, int add_cmd,
ret = str2prefix (dest_str, &p);
if (ret <= 0)
{
- vty_out (vty, "%% Malformed address%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed address");
return CMD_WARNING;
}
@@ -89,7 +89,7 @@ zebra_static_ipv4 (struct vty *vty, safi_t safi, int add_cmd,
ret = inet_aton (mask_str, &mask);
if (ret == 0)
{
- vty_out (vty, "%% Malformed address%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed address");
return CMD_WARNING;
}
p.prefixlen = ip_masklen (mask);
@@ -106,14 +106,14 @@ zebra_static_ipv4 (struct vty *vty, safi_t safi, int add_cmd,
/* tag */
if (tag_str)
- VTY_GET_INTEGER_RANGE("tag", tag, tag_str, 0, 4294967295);
+ tag = strtoul(tag_str, NULL, 10);
/* VRF id */
zvrf = zebra_vrf_lookup_by_name (vrf_id_str);
if (!zvrf)
{
- vty_out (vty, "%% vrf %s is not defined%s", vrf_id_str, VTY_NEWLINE);
+ vty_outln (vty, "%% vrf %s is not defined", vrf_id_str);
return CMD_WARNING;
}
@@ -122,8 +122,8 @@ zebra_static_ipv4 (struct vty *vty, safi_t safi, int add_cmd,
{
if (!mpls_enabled)
{
- vty_out (vty, "%% MPLS not turned on in kernel, ignoring command%s",
- VTY_NEWLINE);
+ vty_outln (vty,
+ "%% MPLS not turned on in kernel, ignoring command");
return CMD_WARNING;
}
int rc = mpls_str2label (label_str, &snh_label.num_labels,
@@ -132,16 +132,15 @@ zebra_static_ipv4 (struct vty *vty, safi_t safi, int add_cmd,
{
switch (rc) {
case -1:
- vty_out (vty, "%% Malformed label(s)%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed label(s)");
break;
case -2:
- vty_out (vty, "%% Cannot use reserved label(s) (%d-%d)%s",
- MPLS_MIN_RESERVED_LABEL, MPLS_MAX_RESERVED_LABEL,
- VTY_NEWLINE);
+ vty_outln (vty, "%% Cannot use reserved label(s) (%d-%d)",
+ MPLS_MIN_RESERVED_LABEL,MPLS_MAX_RESERVED_LABEL);
break;
case -3:
- vty_out (vty, "%% Too many labels. Enter %d or fewer%s",
- MPLS_MAX_LABELS, VTY_NEWLINE);
+ vty_outln (vty, "%% Too many labels. Enter %d or fewer",
+ MPLS_MAX_LABELS);
break;
}
return CMD_WARNING;
@@ -153,7 +152,7 @@ zebra_static_ipv4 (struct vty *vty, safi_t safi, int add_cmd,
{
if (flag_str)
{
- vty_out (vty, "%% can not have flag %s with Null0%s", flag_str, VTY_NEWLINE);
+ vty_outln (vty, "%% can not have flag %s with Null0", flag_str);
return CMD_WARNING;
}
if (add_cmd)
@@ -177,7 +176,7 @@ zebra_static_ipv4 (struct vty *vty, safi_t safi, int add_cmd,
SET_FLAG (flag, ZEBRA_FLAG_BLACKHOLE);
break;
default:
- vty_out (vty, "%% Malformed flag %s %s", flag_str, VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed flag %s ", flag_str);
return CMD_WARNING;
}
}
@@ -202,7 +201,7 @@ zebra_static_ipv4 (struct vty *vty, safi_t safi, int add_cmd,
struct interface *ifp = if_lookup_by_name (gate_str, zvrf_id (zvrf));
if (!ifp)
{
- vty_out (vty, "%% Unknown interface: %s%s", gate_str, VTY_NEWLINE);
+ vty_outln (vty, "%% Unknown interface: %s", gate_str);
ifindex = IFINDEX_DELETED;
}
else
@@ -287,7 +286,7 @@ DEFUN (ip_multicast_mode,
multicast_mode_ipv4_set (MCAST_MIX_PFXLEN);
else
{
- vty_out (vty, "Invalid mode specified%s", VTY_NEWLINE);
+ vty_outln (vty, "Invalid mode specified");
return CMD_WARNING;
}
@@ -341,7 +340,7 @@ DEFUN (show_ip_rpf_addr,
ret = inet_aton (argv[idx_ipv4]->arg, &addr);
if (ret == 0)
{
- vty_out (vty, "%% Malformed address%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed address");
return CMD_WARNING;
}
@@ -350,7 +349,7 @@ DEFUN (show_ip_rpf_addr,
if (re)
vty_show_ip_route_detail (vty, rn, 1);
else
- vty_out (vty, "%% No match for RPF lookup%s", VTY_NEWLINE);
+ vty_outln (vty, "%% No match for RPF lookup");
return CMD_SUCCESS;
}
@@ -666,7 +665,7 @@ vty_show_ip_route_detail (struct vty *vty, struct route_node *rn, int mcast)
vty_out (vty, "Routing entry for %s%s%s",
srcdest_rnode2str(rn, buf, sizeof(buf)), mcast_info,
- VTY_NEWLINE);
+ VTYNL);
vty_out (vty, " Known via \"%s", zebra_route_string (re->type));
if (re->instance)
vty_out (vty, "[%d]", re->instance);
@@ -689,7 +688,7 @@ vty_show_ip_route_detail (struct vty *vty, struct route_node *rn, int mcast)
vty_out (vty, ", blackhole");
if (CHECK_FLAG (re->flags, ZEBRA_FLAG_REJECT))
vty_out (vty, ", reject");
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
if (re->type == ZEBRA_ROUTE_RIP
|| re->type == ZEBRA_ROUTE_OSPF
@@ -717,7 +716,7 @@ vty_show_ip_route_detail (struct vty *vty, struct route_node *rn, int mcast)
vty_out (vty, "%02dw%dd%02dh",
tm->tm_yday/7,
tm->tm_yday - ((tm->tm_yday/7) * 7), tm->tm_hour);
- vty_out (vty, " ago%s", VTY_NEWLINE);
+ vty_out (vty, " ago%s", VTYNL);
}
for (ALL_NEXTHOPS_RO(re->nexthop, nexthop, tnexthop, recursing))
@@ -796,9 +795,9 @@ vty_show_ip_route_detail (struct vty *vty, struct route_node *rn, int mcast)
nexthop->nh_label->label, buf, sizeof buf, 1));
}
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
}
@@ -1086,7 +1085,7 @@ vty_show_ip_route (struct vty *vty, struct route_node *rn, struct route_entry *r
tm->tm_yday/7,
tm->tm_yday - ((tm->tm_yday/7) * 7), tm->tm_hour);
}
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTYNL);
}
}
@@ -1115,18 +1114,18 @@ do_show_ip_route (struct vty *vty, const char *vrf_name, afi_t afi, safi_t safi,
if (!(zvrf = zebra_vrf_lookup_by_name (vrf_name)))
{
if (use_json)
- vty_out (vty, "{}%s", VTY_NEWLINE);
+ vty_outln (vty, "{}");
else
- vty_out (vty, "vrf %s not defined%s", vrf_name, VTY_NEWLINE);
+ vty_outln (vty, "vrf %s not defined", vrf_name);
return CMD_SUCCESS;
}
if (zvrf_id (zvrf) == VRF_UNKNOWN)
{
if (use_json)
- vty_out (vty, "{}%s", VTY_NEWLINE);
+ vty_outln (vty, "{}");
else
- vty_out (vty, "vrf %s inactive%s", vrf_name, VTY_NEWLINE);
+ vty_outln (vty, "vrf %s inactive", vrf_name);
return CMD_SUCCESS;
}
@@ -1134,7 +1133,7 @@ do_show_ip_route (struct vty *vty, const char *vrf_name, afi_t afi, safi_t safi,
if (! table)
{
if (use_json)
- vty_out (vty, "{}%s", VTY_NEWLINE);
+ vty_outln (vty, "{}");
return CMD_SUCCESS;
}
@@ -1191,7 +1190,8 @@ do_show_ip_route (struct vty *vty, const char *vrf_name, afi_t afi, safi_t safi,
vty_out (vty, SHOW_ROUTE_V6_HEADER);
if (zvrf_id (zvrf) != VRF_DEFAULT)
- vty_out (vty, "%sVRF %s:%s", VTY_NEWLINE, zvrf_name (zvrf), VTY_NEWLINE);
+ vty_outln (vty, "%sVRF %s:", VTYNL,
+ zvrf_name(zvrf));
first = 0;
}
@@ -1210,7 +1210,8 @@ do_show_ip_route (struct vty *vty, const char *vrf_name, afi_t afi, safi_t safi,
if (use_json)
{
- vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE);
+ vty_outln (vty, "%s",
+ json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
}
@@ -1250,7 +1251,7 @@ DEFUN (show_ip_nht_vrf_all,
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
if ((zvrf = vrf->info) != NULL)
{
- vty_out (vty, "%sVRF %s:%s", VTY_NEWLINE, zvrf_name (zvrf), VTY_NEWLINE);
+ vty_outln (vty, "%sVRF %s:", VTYNL, zvrf_name(zvrf));
zebra_print_rnh_table(zvrf_id (zvrf), AF_INET, vty, RNH_NEXTHOP_TYPE);
}
@@ -1290,7 +1291,7 @@ DEFUN (show_ipv6_nht_vrf_all,
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
if ((zvrf = vrf->info) != NULL)
{
- vty_out (vty, "%sVRF %s:%s", VTY_NEWLINE, zvrf_name (zvrf), VTY_NEWLINE);
+ vty_outln (vty, "%sVRF %s:", VTYNL, zvrf_name(zvrf));
zebra_print_rnh_table(zvrf_id (zvrf), AF_INET6, vty, RNH_NEXTHOP_TYPE);
}
@@ -1402,7 +1403,7 @@ DEFUN (show_ip_route,
}
if (argv_find (argv, argc, "tag", &idx))
- VTY_GET_INTEGER_RANGE("tag", tag, argv[idx+1]->arg, 0, 4294967295);
+ tag = strtoul(argv[idx + 1]->arg, NULL, 10);
else if (argv_find (argv, argc, "A.B.C.D/M", &idx))
{
@@ -1443,11 +1444,11 @@ DEFUN (show_ip_route,
type = proto_redistnum (AFI_IP, argv[idx]->text);
if (argv_find (argv, argc, "(1-65535)", &idx))
- VTY_GET_INTEGER ("Instance", ospf_instance_id, argv[idx]->arg);
+ ospf_instance_id = strtoul(argv[idx]->arg, NULL, 10);
if (type < 0)
{
- vty_out (vty, "Unknown route type%s", VTY_NEWLINE);
+ vty_outln (vty, "Unknown route type");
return CMD_WARNING;
}
}
@@ -1500,7 +1501,7 @@ DEFUN (show_ip_route_addr,
if (ret <= 0)
{
- vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed IPv4 address");
return CMD_WARNING;
}
@@ -1511,7 +1512,7 @@ DEFUN (show_ip_route_addr,
rn = route_node_match (table, (struct prefix *) &p);
if (! rn)
{
- vty_out (vty, "%% Network not in table%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Network not in table");
return CMD_WARNING;
}
@@ -1549,7 +1550,7 @@ DEFUN (show_ip_route_prefix,
if (ret <= 0)
{
- vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed IPv4 address");
return CMD_WARNING;
}
@@ -1560,7 +1561,7 @@ DEFUN (show_ip_route_prefix,
rn = route_node_match (table, (struct prefix *) &p);
if (! rn || rn->p.prefixlen != p.prefixlen)
{
- vty_out (vty, "%% Network not in table%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Network not in table");
return CMD_WARNING;
}
@@ -1609,10 +1610,9 @@ vty_show_ip_route_summary (struct vty *vty, struct route_table *table)
}
}
- vty_out (vty, "%-20s %-20s %s (vrf %s)%s",
+ vty_outln (vty, "%-20s %-20s %s (vrf %s)",
"Route Source", "Routes", "FIB",
- zvrf_name (((rib_table_info_t *)table->info)->zvrf),
- VTY_NEWLINE);
+ zvrf_name(((rib_table_info_t *)table->info)->zvrf));
for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
{
@@ -1621,23 +1621,21 @@ vty_show_ip_route_summary (struct vty *vty, struct route_table *table)
{
if (i == ZEBRA_ROUTE_BGP)
{
- vty_out (vty, "%-20s %-20d %-20d %s", "ebgp",
- rib_cnt[ZEBRA_ROUTE_BGP], fib_cnt[ZEBRA_ROUTE_BGP],
- VTY_NEWLINE);
- vty_out (vty, "%-20s %-20d %-20d %s", "ibgp",
- rib_cnt[ZEBRA_ROUTE_IBGP], fib_cnt[ZEBRA_ROUTE_IBGP],
- VTY_NEWLINE);
+ vty_outln (vty, "%-20s %-20d %-20d ", "ebgp",
+ rib_cnt[ZEBRA_ROUTE_BGP],fib_cnt[ZEBRA_ROUTE_BGP]);
+ vty_outln (vty, "%-20s %-20d %-20d ", "ibgp",
+ rib_cnt[ZEBRA_ROUTE_IBGP],fib_cnt[ZEBRA_ROUTE_IBGP]);
}
else
- vty_out (vty, "%-20s %-20d %-20d %s", zebra_route_string(i),
- rib_cnt[i], fib_cnt[i], VTY_NEWLINE);
+ vty_outln (vty, "%-20s %-20d %-20d ", zebra_route_string(i),
+ rib_cnt[i], fib_cnt[i]);
}
}
- vty_out (vty, "------%s", VTY_NEWLINE);
- vty_out (vty, "%-20s %-20d %-20d %s", "Totals", rib_cnt[ZEBRA_ROUTE_TOTAL],
- fib_cnt[ZEBRA_ROUTE_TOTAL], VTY_NEWLINE);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_outln (vty, "------");
+ vty_outln (vty, "%-20s %-20d %-20d ", "Totals", rib_cnt[ZEBRA_ROUTE_TOTAL],
+ fib_cnt[ZEBRA_ROUTE_TOTAL]);
+ vty_out (vty, VTYNL);
}
/*
@@ -1690,10 +1688,9 @@ vty_show_ip_route_summary_prefix (struct vty *vty, struct route_table *table)
}
}
- vty_out (vty, "%-20s %-20s %s (vrf %s)%s",
+ vty_outln (vty, "%-20s %-20s %s (vrf %s)",
"Route Source", "Prefix Routes", "FIB",
- zvrf_name (((rib_table_info_t *)table->info)->zvrf),
- VTY_NEWLINE);
+ zvrf_name(((rib_table_info_t *)table->info)->zvrf));
for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
{
@@ -1701,24 +1698,22 @@ vty_show_ip_route_summary_prefix (struct vty *vty, struct route_table *table)
{
if (i == ZEBRA_ROUTE_BGP)
{
- vty_out (vty, "%-20s %-20d %-20d %s", "ebgp",
+ vty_outln (vty, "%-20s %-20d %-20d ", "ebgp",
rib_cnt[ZEBRA_ROUTE_BGP] - rib_cnt[ZEBRA_ROUTE_IBGP],
- fib_cnt[ZEBRA_ROUTE_BGP] - fib_cnt[ZEBRA_ROUTE_IBGP],
- VTY_NEWLINE);
- vty_out (vty, "%-20s %-20d %-20d %s", "ibgp",
- rib_cnt[ZEBRA_ROUTE_IBGP], fib_cnt[ZEBRA_ROUTE_IBGP],
- VTY_NEWLINE);
+ fib_cnt[ZEBRA_ROUTE_BGP] - fib_cnt[ZEBRA_ROUTE_IBGP]);
+ vty_outln (vty, "%-20s %-20d %-20d ", "ibgp",
+ rib_cnt[ZEBRA_ROUTE_IBGP],fib_cnt[ZEBRA_ROUTE_IBGP]);
}
else
- vty_out (vty, "%-20s %-20d %-20d %s", zebra_route_string(i),
- rib_cnt[i], fib_cnt[i], VTY_NEWLINE);
+ vty_outln (vty, "%-20s %-20d %-20d ", zebra_route_string(i),
+ rib_cnt[i], fib_cnt[i]);
}
}
- vty_out (vty, "------%s", VTY_NEWLINE);
- vty_out (vty, "%-20s %-20d %-20d %s", "Totals", rib_cnt[ZEBRA_ROUTE_TOTAL],
- fib_cnt[ZEBRA_ROUTE_TOTAL], VTY_NEWLINE);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_outln (vty, "------");
+ vty_outln (vty, "%-20s %-20d %-20d ", "Totals", rib_cnt[ZEBRA_ROUTE_TOTAL],
+ fib_cnt[ZEBRA_ROUTE_TOTAL]);
+ vty_out (vty, VTYNL);
}
/* Show route summary. */
@@ -1793,7 +1788,7 @@ DEFUN (show_ip_route_vrf_all_addr,
ret = str2prefix_ipv4 (argv[idx_ipv4]->arg, &p);
if (ret <= 0)
{
- vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed IPv4 address");
return CMD_WARNING;
}
@@ -1835,7 +1830,7 @@ DEFUN (show_ip_route_vrf_all_prefix,
ret = str2prefix_ipv4 (argv[idx_ipv4_prefixlen]->arg, &p);
if (ret <= 0)
{
- vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed IPv4 address");
return CMD_WARNING;
}
@@ -1971,7 +1966,7 @@ static_config (struct vty *vty, afi_t afi, safi_t safi, const char *cmd)
mpls_label2str (si->snh_label.num_labels,
si->snh_label.label, buf, sizeof buf, 0));
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
write = 1;
}
@@ -2005,7 +2000,7 @@ static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str,
ret = str2prefix (dest_str, &p);
if (ret <= 0)
{
- vty_out (vty, "%% Malformed address%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed address");
return CMD_WARNING;
}
@@ -2014,7 +2009,7 @@ static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str,
ret = str2prefix (src_str, &src);
if (ret <= 0 || src.family != AF_INET6)
{
- vty_out (vty, "%% Malformed source address%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed source address");
return CMD_WARNING;
}
src_p = (struct prefix_ipv6*)&src;
@@ -2031,7 +2026,7 @@ static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str,
/* tag */
if (tag_str)
- VTY_GET_INTEGER_RANGE("tag", tag, tag_str, 0, 4294967295);
+ tag = strtoul(tag_str, NULL, 10);
/* When gateway is valid IPv6 addrees, then gate is treated as
nexthop address other case gate is treated as interface name. */
@@ -2042,7 +2037,7 @@ static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str,
if (!zvrf)
{
- vty_out (vty, "%% vrf %s is not defined%s", vrf_id_str, VTY_NEWLINE);
+ vty_outln (vty, "%% vrf %s is not defined", vrf_id_str);
return CMD_WARNING;
}
@@ -2052,8 +2047,8 @@ static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str,
{
if (!mpls_enabled)
{
- vty_out (vty, "%% MPLS not turned on in kernel, ignoring command%s",
- VTY_NEWLINE);
+ vty_outln (vty,
+ "%% MPLS not turned on in kernel, ignoring command");
return CMD_WARNING;
}
int rc = mpls_str2label (label_str, &snh_label.num_labels,
@@ -2062,16 +2057,15 @@ static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str,
{
switch (rc) {
case -1:
- vty_out (vty, "%% Malformed label(s)%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed label(s)");
break;
case -2:
- vty_out (vty, "%% Cannot use reserved label(s) (%d-%d)%s",
- MPLS_MIN_RESERVED_LABEL, MPLS_MAX_RESERVED_LABEL,
- VTY_NEWLINE);
+ vty_outln (vty, "%% Cannot use reserved label(s) (%d-%d)",
+ MPLS_MIN_RESERVED_LABEL,MPLS_MAX_RESERVED_LABEL);
break;
case -3:
- vty_out (vty, "%% Too many labels. Enter %d or fewer%s",
- MPLS_MAX_LABELS, VTY_NEWLINE);
+ vty_outln (vty, "%% Too many labels. Enter %d or fewer",
+ MPLS_MAX_LABELS);
break;
}
return CMD_WARNING;
@@ -2083,14 +2077,14 @@ static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str,
{
if (flag_str)
{
- vty_out (vty, "%% can not have flag %s with Null0%s", flag_str, VTY_NEWLINE);
+ vty_outln (vty, "%% can not have flag %s with Null0", flag_str);
return CMD_WARNING;
}
if (add_cmd)
- static_add_route (AFI_IP6, SAFI_UNICAST, type, &p, NULL, NULL, ifindex, ifname,
+ static_add_route (AFI_IP6, SAFI_UNICAST, type, &p, src_p, NULL, ifindex, ifname,
ZEBRA_FLAG_BLACKHOLE, tag, distance, zvrf, &snh_label);
else
- static_delete_route (AFI_IP6, SAFI_UNICAST, type, &p, NULL, NULL, ifindex, tag,
+ static_delete_route (AFI_IP6, SAFI_UNICAST, type, &p, src_p, NULL, ifindex, tag,
distance, zvrf, &snh_label);
return CMD_SUCCESS;
}
@@ -2107,7 +2101,7 @@ static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str,
SET_FLAG (flag, ZEBRA_FLAG_BLACKHOLE);
break;
default:
- vty_out (vty, "%% Malformed flag %s %s", flag_str, VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed flag %s ", flag_str);
return CMD_WARNING;
}
}
@@ -2118,7 +2112,7 @@ static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str,
address. */
if (ret != 1)
{
- vty_out (vty, "%% Malformed address%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed address");
return CMD_WARNING;
}
type = STATIC_IPV6_GATEWAY_IFINDEX;
@@ -2126,7 +2120,7 @@ static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str,
ifp = if_lookup_by_name (ifname, zvrf_id (zvrf));
if (!ifp)
{
- vty_out (vty, "%% Malformed Interface name %s%s", ifname, VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed Interface name %s", ifname);
return CMD_WARNING;
}
ifindex = ifp->ifindex;
@@ -2144,7 +2138,7 @@ static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str,
ifp = if_lookup_by_name (gate_str, zvrf_id (zvrf));
if (!ifp)
{
- vty_out (vty, "%% Malformed Interface name %s%s", gate_str, VTY_NEWLINE);
+ vty_outln (vty, "%% Malformed Interface name %s", gate_str);
ifindex = IFINDEX_DELETED;
}
else
@@ -2185,7 +2179,7 @@ DEFUN (ipv6_route,
int idx_curr;
char *src, *tag, *distance, *vrf;
- if (!strcmp(argv[3]->text, "from"))
+ if (strmatch(argv[3]->text, "from"))
{
src = argv[4]->arg;
idx_ipv6_ifname = 5;
@@ -2221,7 +2215,6 @@ DEFUN (ipv6_route_flags,
"IPv6 gateway interface name\n"
"Emit an ICMP unreachable when matched\n"
"Silently discard pkts when matched\n"
- "Silently discard pkts when matched\n"
"Set tag for this route\n"
"Tag value\n"
"Distance value for this prefix\n"
@@ -2234,7 +2227,7 @@ DEFUN (ipv6_route_flags,
int idx_curr;
char *src, *tag, *distance, *vrf;
- if (!strcmp(argv[3]->text, "from"))
+ if (strmatch(argv[3]->text, "from"))
{
src = argv[4]->arg;
idx_ipv6_ifname = 5;
@@ -2283,7 +2276,7 @@ DEFUN (ipv6_route_ifname,
int idx_curr = 5;
char *src, *tag, *distance, *vrf;
- if (!strcmp(argv[3]->text, "from"))
+ if (strmatch(argv[3]->text, "from"))
{
src = argv[4]->arg;
idx_ipv6 = 5;
@@ -2335,7 +2328,7 @@ DEFUN (ipv6_route_ifname_flags,
int idx_curr;
char *src, *tag, *distance, *vrf;
- if (!strcmp(argv[3]->text, "from"))
+ if (strmatch(argv[3]->text, "from"))
{
src = argv[4]->arg;
idx_ipv6 = 5;
@@ -2387,7 +2380,7 @@ DEFUN (no_ipv6_route,
int idx_curr;
char *src, *tag, *distance, *vrf;
- if (!strcmp(argv[4]->text, "from"))
+ if (strmatch(argv[4]->text, "from"))
{
src = argv[5]->arg;
idx_ipv6_ifname = 6;
@@ -2436,7 +2429,7 @@ DEFUN (no_ipv6_route_flags,
int idx_curr;
char *src, *tag, *distance, *vrf;
- if (!strcmp(argv[4]->text, "from"))
+ if (strmatch(argv[4]->text, "from"))
{
src = argv[5]->arg;
idx_ipv6_ifname = 6;
@@ -2486,7 +2479,7 @@ DEFUN (no_ipv6_route_ifname,
int idx_curr;
char *src, *tag, *distance, *vrf;
- if (!strcmp(argv[4]->text, "from"))
+ if (strmatch(argv[4]->text, "from"))
{
src = argv[5]->arg;
idx_ipv6 = 6;
@@ -2539,7 +2532,7 @@ DEFUN (no_ipv6_route_ifname_flags,
int idx_curr;
char *src, *tag, *distance, *vrf;
- if (!strcmp(argv[4]->text, "from"))
+ if (strmatch(argv[4]->text, "from"))
{
src = argv[5]->arg;
idx_ipv6 = 6;
@@ -2607,7 +2600,7 @@ DEFUN (show_ipv6_route,
}
if (argv_find (argv, argc, "tag", &idx))
- VTY_GET_INTEGER_RANGE("tag", tag, argv[idx+1]->arg, 0, 4294967295);
+ tag = strtoul(argv[idx + 1]->arg, NULL, 10);
else if (argv_find (argv, argc, "X:X::X:X/M", &idx))
{
@@ -2642,7 +2635,7 @@ DEFUN (show_ipv6_route,
if (type < 0)
{
- vty_out (vty, "Unknown route type%s", VTY_NEWLINE);
+ vty_outln (vty, "Unknown route type");
return CMD_WARNING;
}
}
@@ -2695,7 +2688,7 @@ DEFUN (show_ipv6_route_addr,
if (ret <= 0)
{
- vty_out (vty, "Malformed IPv6 address%s", VTY_NEWLINE);
+ vty_outln (vty, "Malformed IPv6 address");
return CMD_WARNING;
}
@@ -2706,7 +2699,7 @@ DEFUN (show_ipv6_route_addr,
rn = route_node_match (table, (struct prefix *) &p);
if (! rn)
{
- vty_out (vty, "%% Network not in table%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Network not in table");
return CMD_WARNING;
}
@@ -2742,7 +2735,7 @@ DEFUN (show_ipv6_route_prefix,
if (ret <= 0)
{
- vty_out (vty, "Malformed IPv6 prefix%s", VTY_NEWLINE);
+ vty_outln (vty, "Malformed IPv6 prefix");
return CMD_WARNING;
}
@@ -2753,7 +2746,7 @@ DEFUN (show_ipv6_route_prefix,
rn = route_node_match (table, (struct prefix *) &p);
if (! rn || rn->p.prefixlen != p.prefixlen)
{
- vty_out (vty, "%% Network not in table%s", VTY_NEWLINE);
+ vty_outln (vty, "%% Network not in table");
return CMD_WARNING;
}
@@ -2877,7 +2870,7 @@ DEFUN (show_ipv6_route_vrf_all_addr,
ret = str2prefix_ipv6 (argv[idx_ipv6]->arg, &p);
if (ret <= 0)
{
- vty_out (vty, "Malformed IPv6 address%s", VTY_NEWLINE);
+ vty_outln (vty, "Malformed IPv6 address");
return CMD_WARNING;
}
@@ -2919,7 +2912,7 @@ DEFUN (show_ipv6_route_vrf_all_prefix,
ret = str2prefix_ipv6 (argv[idx_ipv6_prefixlen]->arg, &p);
if (ret <= 0)
{
- vty_out (vty, "Malformed IPv6 prefix%s", VTY_NEWLINE);
+ vty_outln (vty, "Malformed IPv6 prefix");
return CMD_WARNING;
}
@@ -3064,7 +3057,7 @@ DEFUN (show_vrf,
vty_out (vty, "inactive");
else
vty_out (vty, "id %u table %u", zvrf_id (zvrf), zvrf->table_id);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, VTYNL);
}
@@ -3098,26 +3091,26 @@ DEFUN (ip_zebra_import_table_distance,
{
u_int32_t table_id = 0;
- VTY_GET_INTEGER("table", table_id, argv[2]->arg);
+ table_id = strtoul(argv[2]->arg, NULL, 10);
int distance = ZEBRA_TABLE_DISTANCE_DEFAULT;
char *rmap = strmatch (argv[argc - 2]->text, "route-map") ?
XSTRDUP(MTYPE_ROUTE_MAP_NAME, argv[argc - 1]->arg) : NULL;
int ret;
if (argc == 7 || (argc == 5 && !rmap))
- VTY_GET_INTEGER_RANGE("distance", distance, argv[4]->arg, 1, 255);
+ distance = strtoul(argv[4]->arg, NULL, 10);
if (!is_zebra_valid_kernel_table(table_id))
{
- vty_out(vty, "Invalid routing table ID, %d. Must be in range 1-252%s",
- table_id, VTY_NEWLINE);
+ vty_outln (vty, "Invalid routing table ID, %d. Must be in range 1-252",
+ table_id);
return CMD_WARNING;
}
if (is_zebra_main_routing_table(table_id))
{
- vty_out(vty, "Invalid routing table ID, %d. Must be non-default table%s",
- table_id, VTY_NEWLINE);
+ vty_outln (vty, "Invalid routing table ID, %d. Must be non-default table",
+ table_id);
return CMD_WARNING;
}
@@ -3141,19 +3134,18 @@ DEFUN (no_ip_zebra_import_table,
"route-map name\n")
{
u_int32_t table_id = 0;
- VTY_GET_INTEGER("table", table_id, argv[3]->arg);
+ table_id = strtoul(argv[3]->arg, NULL, 10);
if (!is_zebra_valid_kernel_table(table_id))
{
- vty_out(vty, "Invalid routing table ID. Must be in range 1-252%s",
- VTY_NEWLINE);
+ vty_outln (vty,"Invalid routing table ID. Must be in range 1-252");
return CMD_WARNING;
}
if (is_zebra_main_routing_table(table_id))
{
- vty_out(vty, "Invalid routing table ID, %d. Must be non-default table%s",
- table_id, VTY_NEWLINE);
+ vty_outln (vty, "Invalid routing table ID, %d. Must be non-default table",
+ table_id);
return CMD_WARNING;
}
@@ -3167,24 +3159,19 @@ static int
config_write_protocol (struct vty *vty)
{
if (allow_delete)
- vty_out(vty, "allow-external-route-update%s", VTY_NEWLINE);
+ vty_outln (vty, "allow-external-route-update");
if (zebra_rnh_ip_default_route)
- vty_out(vty, "ip nht resolve-via-default%s", VTY_NEWLINE);
+ vty_outln (vty, "ip nht resolve-via-default");
if (zebra_rnh_ipv6_default_route)
- vty_out(vty, "ipv6 nht resolve-via-default%s", VTY_NEWLINE);
+ vty_outln (vty, "ipv6 nht resolve-via-default");
enum multicast_mode ipv4_multicast_mode = multicast_mode_ipv4_get ();
if (ipv4_multicast_mode != MCAST_NO_CONFIG)
- vty_out (vty, "ip multicast rpf-lookup-mode %s%s",
- ipv4_multicast_mode == MCAST_URIB_ONLY ? "urib-only" :
- ipv4_multicast_mode == MCAST_MRIB_ONLY ? "mrib-only" :
- ipv4_multicast_mode == MCAST_MIX_MRIB_FIRST ? "mrib-then-urib" :
- ipv4_multicast_mode == MCAST_MIX_DISTANCE ? "lower-distance" :
- "longer-prefix",
- VTY_NEWLINE);
+ vty_outln (vty, "ip multicast rpf-lookup-mode %s",
+ ipv4_multicast_mode == MCAST_URIB_ONLY ? "urib-only" : ipv4_multicast_mode == MCAST_MRIB_ONLY ? "mrib-only" : ipv4_multicast_mode == MCAST_MIX_MRIB_FIRST ? "mrib-then-urib" : ipv4_multicast_mode == MCAST_MIX_DISTANCE ? "lower-distance" : "longer-prefix");
zebra_routemap_config_write_protocol(vty);