ripngd: argv update

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
This commit is contained in:
Daniel Walton 2016-09-22 23:51:23 +00:00
parent 7fcbbdaeb6
commit dd4f9f99ed
8 changed files with 59 additions and 117 deletions

View File

@ -105,26 +105,6 @@ DEFUN (debug_rip_packet_direct,
return CMD_SUCCESS;
}
/* N.B. the "detail" modifier is a no-op. we leave this command
for legacy compatibility. */
DEFUN_DEPRECATED (debug_rip_packet_detail,
debug_rip_packet_detail_cmd,
"debug rip packet (recv|send) detail",
DEBUG_STR
RIP_STR
"RIP packet\n"
"RIP receive packet\n"
"RIP send packet\n"
"Detailed information display\n")
{
rip_debug_packet |= RIP_DEBUG_PACKET;
if (strncmp ("send", argv[0], strlen (argv[0])) == 0)
rip_debug_packet |= RIP_DEBUG_SEND;
if (strncmp ("recv", argv[0], strlen (argv[0])) == 0)
rip_debug_packet |= RIP_DEBUG_RECV;
return CMD_SUCCESS;
}
DEFUN (debug_rip_zebra,
debug_rip_zebra_cmd,
"debug rip zebra",
@ -265,7 +245,6 @@ rip_debug_init (void)
install_element (ENABLE_NODE, &debug_rip_events_cmd);
install_element (ENABLE_NODE, &debug_rip_packet_cmd);
install_element (ENABLE_NODE, &debug_rip_packet_direct_cmd);
install_element (ENABLE_NODE, &debug_rip_packet_detail_cmd);
install_element (ENABLE_NODE, &debug_rip_zebra_cmd);
install_element (ENABLE_NODE, &no_debug_rip_events_cmd);
install_element (ENABLE_NODE, &no_debug_rip_packet_cmd);
@ -275,7 +254,6 @@ rip_debug_init (void)
install_element (CONFIG_NODE, &debug_rip_events_cmd);
install_element (CONFIG_NODE, &debug_rip_packet_cmd);
install_element (CONFIG_NODE, &debug_rip_packet_direct_cmd);
install_element (CONFIG_NODE, &debug_rip_packet_detail_cmd);
install_element (CONFIG_NODE, &debug_rip_zebra_cmd);
install_element (CONFIG_NODE, &no_debug_rip_events_cmd);
install_element (CONFIG_NODE, &no_debug_rip_packet_cmd);

View File

@ -99,30 +99,9 @@ DEFUN (debug_ripng_packet_direct,
"Debug option set for send packet\n")
{
ripng_debug_packet |= RIPNG_DEBUG_PACKET;
if (strncmp ("send", argv[0], strlen (argv[0])) == 0)
if (strncmp ("send", argv[3]->arg, strlen (argv[3]->arg)) == 0)
ripng_debug_packet |= RIPNG_DEBUG_SEND;
if (strncmp ("recv", argv[0], strlen (argv[0])) == 0)
ripng_debug_packet |= RIPNG_DEBUG_RECV;
return CMD_SUCCESS;
}
/* N.B. the "detail" modifier is a no-op. we leave this command
for legacy compatibility. */
DEFUN_DEPRECATED (debug_ripng_packet_detail,
debug_ripng_packet_detail_cmd,
"debug ripng packet (recv|send) detail",
DEBUG_STR
"RIPng configuration\n"
"Debug option set for ripng packet\n"
"Debug option set for receive packet\n"
"Debug option set for send packet\n"
"Debug option set detaied information\n")
{
ripng_debug_packet |= RIPNG_DEBUG_PACKET;
if (strncmp ("send", argv[0], strlen (argv[0])) == 0)
ripng_debug_packet |= RIPNG_DEBUG_SEND;
if (strncmp ("recv", argv[0], strlen (argv[0])) == 0)
if (strncmp ("recv", argv[3]->arg, strlen (argv[3]->arg)) == 0)
ripng_debug_packet |= RIPNG_DEBUG_RECV;
return CMD_SUCCESS;
@ -173,14 +152,14 @@ DEFUN (no_debug_ripng_packet_direct,
"Debug option set for receive packet\n"
"Debug option set for send packet\n")
{
if (strncmp ("send", argv[0], strlen (argv[0])) == 0)
if (strncmp ("send", argv[4]->arg, strlen (argv[4]->arg)) == 0)
{
if (IS_RIPNG_DEBUG_RECV)
ripng_debug_packet &= ~RIPNG_DEBUG_SEND;
else
ripng_debug_packet = 0;
}
else if (strncmp ("recv", argv[0], strlen (argv[0])) == 0)
else if (strncmp ("recv", argv[4]->arg, strlen (argv[4]->arg)) == 0)
{
if (IS_RIPNG_DEBUG_SEND)
ripng_debug_packet &= ~RIPNG_DEBUG_RECV;
@ -270,7 +249,6 @@ ripng_debug_init ()
install_element (ENABLE_NODE, &debug_ripng_events_cmd);
install_element (ENABLE_NODE, &debug_ripng_packet_cmd);
install_element (ENABLE_NODE, &debug_ripng_packet_direct_cmd);
install_element (ENABLE_NODE, &debug_ripng_packet_detail_cmd);
install_element (ENABLE_NODE, &debug_ripng_zebra_cmd);
install_element (ENABLE_NODE, &no_debug_ripng_events_cmd);
install_element (ENABLE_NODE, &no_debug_ripng_packet_cmd);
@ -280,7 +258,6 @@ ripng_debug_init ()
install_element (CONFIG_NODE, &debug_ripng_events_cmd);
install_element (CONFIG_NODE, &debug_ripng_packet_cmd);
install_element (CONFIG_NODE, &debug_ripng_packet_direct_cmd);
install_element (CONFIG_NODE, &debug_ripng_packet_detail_cmd);
install_element (CONFIG_NODE, &debug_ripng_zebra_cmd);
install_element (CONFIG_NODE, &no_debug_ripng_events_cmd);
install_element (CONFIG_NODE, &no_debug_ripng_packet_cmd);

View File

@ -956,17 +956,17 @@ DEFUN (ripng_network,
int ret;
struct prefix p;
ret = str2prefix (argv[0], &p);
ret = str2prefix (argv[1]->arg, &p);
/* Given string is IPv6 network or interface name. */
if (ret)
ret = ripng_enable_network_add (&p);
else
ret = ripng_enable_if_add (argv[0]);
ret = ripng_enable_if_add (argv[1]->arg);
if (ret < 0)
{
vty_out (vty, "There is same network configuration %s%s", argv[0],
vty_out (vty, "There is same network configuration %s%s", argv[1]->arg,
VTY_NEWLINE);
return CMD_WARNING;
}
@ -985,17 +985,17 @@ DEFUN (no_ripng_network,
int ret;
struct prefix p;
ret = str2prefix (argv[0], &p);
ret = str2prefix (argv[2]->arg, &p);
/* Given string is interface name. */
if (ret)
ret = ripng_enable_network_delete (&p);
else
ret = ripng_enable_if_delete (argv[0]);
ret = ripng_enable_if_delete (argv[2]->arg);
if (ret < 0)
{
vty_out (vty, "can't find network %s%s", argv[0],
vty_out (vty, "can't find network %s%s", argv[2]->arg,
VTY_NEWLINE);
return CMD_WARNING;
}
@ -1071,7 +1071,7 @@ DEFUN (ripng_passive_interface,
"Suppress routing updates on an interface\n"
"Interface name\n")
{
return ripng_passive_interface_set (vty, argv[0]);
return ripng_passive_interface_set (vty, argv[1]->arg);
}
DEFUN (no_ripng_passive_interface,
@ -1081,7 +1081,7 @@ DEFUN (no_ripng_passive_interface,
"Suppress routing updates on an interface\n"
"Interface name\n")
{
return ripng_passive_interface_unset (vty, argv[0]);
return ripng_passive_interface_unset (vty, argv[2]->arg);
}
static struct ripng_interface *

View File

@ -297,7 +297,7 @@ DEFUN (ripng_offset_list,
"For outgoing updates\n"
"Metric value\n")
{
return ripng_offset_list_set (vty, argv[0], argv[1], argv[2], NULL);
return ripng_offset_list_set (vty, argv[1]->arg, argv[2]->arg, argv[3]->arg, NULL);
}
DEFUN (ripng_offset_list_ifname,
@ -310,7 +310,7 @@ DEFUN (ripng_offset_list_ifname,
"Metric value\n"
"Interface to match\n")
{
return ripng_offset_list_set (vty, argv[0], argv[1], argv[2], argv[3]);
return ripng_offset_list_set (vty, argv[1]->arg, argv[2]->arg, argv[3]->arg, argv[4]->arg);
}
DEFUN (no_ripng_offset_list,
@ -323,7 +323,7 @@ DEFUN (no_ripng_offset_list,
"For outgoing updates\n"
"Metric value\n")
{
return ripng_offset_list_unset (vty, argv[0], argv[1], argv[2], NULL);
return ripng_offset_list_unset (vty, argv[2]->arg, argv[3]->arg, argv[4]->arg, NULL);
}
DEFUN (no_ripng_offset_list_ifname,
@ -337,7 +337,7 @@ DEFUN (no_ripng_offset_list_ifname,
"Metric value\n"
"Interface to match\n")
{
return ripng_offset_list_unset (vty, argv[0], argv[1], argv[2], argv[3]);
return ripng_offset_list_unset (vty, argv[2]->arg, argv[3]->arg, argv[4]->arg, argv[5]->arg);
}
static int

View File

@ -507,7 +507,7 @@ DEFUN (match_metric,
"Match metric of route\n"
"Metric value\n")
{
return ripng_route_match_add (vty, vty->index, "metric", argv[0]);
return ripng_route_match_add (vty, vty->index, "metric", argv[2]->arg);
}
DEFUN (no_match_metric,
@ -517,10 +517,7 @@ DEFUN (no_match_metric,
MATCH_STR
"Match metric of route\n")
{
if (argc == 0)
return ripng_route_match_delete (vty, vty->index, "metric", NULL);
return ripng_route_match_delete (vty, vty->index, "metric", argv[0]);
return ripng_route_match_delete (vty, vty->index, "metric", argv[3]->arg);
}
ALIAS (no_match_metric,
@ -538,7 +535,7 @@ DEFUN (match_interface,
"Match first hop interface of route\n"
"Interface name\n")
{
return ripng_route_match_add (vty, vty->index, "interface", argv[0]);
return ripng_route_match_add (vty, vty->index, "interface", argv[2]->arg);
}
DEFUN (no_match_interface,
@ -548,10 +545,7 @@ DEFUN (no_match_interface,
MATCH_STR
"Match first hop interface of route\n")
{
if (argc == 0)
return ripng_route_match_delete (vty, vty->index, "interface", NULL);
return ripng_route_match_delete (vty, vty->index, "interface", argv[0]);
return ripng_route_match_delete (vty, vty->index, "interface", argv[3]->arg);
}
ALIAS (no_match_interface,
@ -569,7 +563,7 @@ DEFUN (match_tag,
"Match tag of route\n"
"Metric value\n")
{
return ripng_route_match_add (vty, vty->index, "tag", argv[0]);
return ripng_route_match_add (vty, vty->index, "tag", argv[2]->arg);
}
DEFUN (no_match_tag,
@ -579,10 +573,7 @@ DEFUN (no_match_tag,
MATCH_STR
"Match tag of route\n")
{
if (argc == 0)
return ripng_route_match_delete (vty, vty->index, "tag", NULL);
return ripng_route_match_delete (vty, vty->index, "tag", argv[0]);
return ripng_route_match_delete (vty, vty->index, "tag", argv[3]->arg);
}
ALIAS (no_match_tag,
@ -602,7 +593,7 @@ DEFUN (set_metric,
"Metric value for destination routing protocol\n"
"Metric value\n")
{
return ripng_route_set_add (vty, vty->index, "metric", argv[0]);
return ripng_route_set_add (vty, vty->index, "metric", argv[2]->arg);
}
DEFUN (no_set_metric,
@ -612,10 +603,7 @@ DEFUN (no_set_metric,
SET_STR
"Metric value for destination routing protocol\n")
{
if (argc == 0)
return ripng_route_set_delete (vty, vty->index, "metric", NULL);
return ripng_route_set_delete (vty, vty->index, "metric", argv[0]);
return ripng_route_set_delete (vty, vty->index, "metric", argv[3]->arg);
}
ALIAS (no_set_metric,
@ -638,7 +626,7 @@ DEFUN (set_ipv6_nexthop_local,
union sockunion su;
int ret;
ret = str2sockunion (argv[0], &su);
ret = str2sockunion (argv[4]->arg, &su);
if (ret < 0)
{
vty_out (vty, "%% Malformed next-hop local address%s", VTY_NEWLINE);
@ -651,7 +639,7 @@ DEFUN (set_ipv6_nexthop_local,
return CMD_WARNING;
}
return ripng_route_set_add (vty, vty->index, "ipv6 next-hop local", argv[0]);
return ripng_route_set_add (vty, vty->index, "ipv6 next-hop local", argv[4]->arg);
}
DEFUN (no_set_ipv6_nexthop_local,
@ -663,10 +651,7 @@ DEFUN (no_set_ipv6_nexthop_local,
"IPv6 next-hop address\n"
"IPv6 local address\n")
{
if (argc == 0)
return ripng_route_set_delete (vty, vty->index, "ipv6 next-hop local", NULL);
return ripng_route_set_delete (vty, vty->index, "ipv6 next-hop local", argv[0]);
return ripng_route_set_delete (vty, vty->index, "ipv6 next-hop local", argv[5]->arg);
}
ALIAS (no_set_ipv6_nexthop_local,
@ -686,7 +671,7 @@ DEFUN (set_tag,
"Tag value for routing protocol\n"
"Tag value\n")
{
return ripng_route_set_add (vty, vty->index, "tag", argv[0]);
return ripng_route_set_add (vty, vty->index, "tag", argv[2]->arg);
}
DEFUN (no_set_tag,
@ -696,10 +681,7 @@ DEFUN (no_set_tag,
SET_STR
"Tag value for routing protocol\n")
{
if (argc == 0)
return ripng_route_set_delete (vty, vty->index, "tag", NULL);
return ripng_route_set_delete (vty, vty->index, "tag", argv[0]);
return ripng_route_set_delete (vty, vty->index, "tag", argv[3]->arg);
}
ALIAS (no_set_tag,

View File

@ -333,11 +333,11 @@ DEFUN (ripng_redistribute_type,
{
int type;
type = proto_redistnum(AFI_IP6, argv[0]);
type = proto_redistnum(AFI_IP6, argv[2]->arg);
if (type < 0)
{
vty_out(vty, "Invalid type %s%s", argv[0], VTY_NEWLINE);
vty_out(vty, "Invalid type %s%s", argv[2]->arg, VTY_NEWLINE);
return CMD_WARNING;
}
@ -354,11 +354,11 @@ DEFUN (no_ripng_redistribute_type,
{
int type;
type = proto_redistnum(AFI_IP6, argv[0]);
type = proto_redistnum(AFI_IP6, argv[3]->arg);
if (type < 0)
{
vty_out(vty, "Invalid type %s%s", argv[0], VTY_NEWLINE);
vty_out(vty, "Invalid type %s%s", argv[3]->arg, VTY_NEWLINE);
return CMD_WARNING;
}
@ -379,12 +379,12 @@ DEFUN (ripng_redistribute_type_metric,
int type;
int metric;
metric = atoi (argv[1]);
type = proto_redistnum(AFI_IP6, argv[0]);
metric = atoi (argv[3]->arg);
type = proto_redistnum(AFI_IP6, argv[1]->arg);
if (type < 0)
{
vty_out(vty, "Invalid type %s%s", argv[0], VTY_NEWLINE);
vty_out(vty, "Invalid type %s%s", argv[1]->arg, VTY_NEWLINE);
return CMD_WARNING;
}
@ -413,15 +413,15 @@ DEFUN (ripng_redistribute_type_routemap,
{
int type;
type = proto_redistnum(AFI_IP6, argv[0]);
type = proto_redistnum(AFI_IP6, argv[1]->arg);
if (type < 0)
{
vty_out(vty, "Invalid type %s%s", argv[0], VTY_NEWLINE);
vty_out(vty, "Invalid type %s%s", argv[1]->arg, VTY_NEWLINE);
return CMD_WARNING;
}
ripng_redistribute_routemap_set (type, argv[1]);
ripng_redistribute_routemap_set (type, argv[3]->arg);
zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP6, type, 0,
VRF_DEFAULT);
return CMD_SUCCESS;
@ -449,17 +449,17 @@ DEFUN (ripng_redistribute_type_metric_routemap,
int type;
int metric;
type = proto_redistnum(AFI_IP6, argv[0]);
metric = atoi (argv[1]);
type = proto_redistnum(AFI_IP6, argv[1]->arg);
metric = atoi (argv[3]->arg);
if (type < 0)
{
vty_out(vty, "Invalid type %s%s", argv[0], VTY_NEWLINE);
vty_out(vty, "Invalid type %s%s", argv[1]->arg, VTY_NEWLINE);
return CMD_WARNING;
}
ripng_redistribute_metric_set (type, metric);
ripng_redistribute_routemap_set (type, argv[2]);
ripng_redistribute_routemap_set (type, argv[5]->arg);
zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP6, type, 0, VRF_DEFAULT);
return CMD_SUCCESS;
}

View File

@ -2265,7 +2265,7 @@ DEFUN (ripng_route,
struct prefix_ipv6 p;
struct route_node *rp;
ret = str2prefix_ipv6 (argv[0], (struct prefix_ipv6 *)&p);
ret = str2prefix_ipv6 (argv[1]->arg, (struct prefix_ipv6 *)&p);
if (ret <= 0)
{
vty_out (vty, "Malformed address%s", VTY_NEWLINE);
@ -2298,7 +2298,7 @@ DEFUN (no_ripng_route,
struct prefix_ipv6 p;
struct route_node *rp;
ret = str2prefix_ipv6 (argv[0], (struct prefix_ipv6 *)&p);
ret = str2prefix_ipv6 (argv[2]->arg, (struct prefix_ipv6 *)&p);
if (ret <= 0)
{
vty_out (vty, "Malformed address%s", VTY_NEWLINE);
@ -2332,7 +2332,7 @@ DEFUN (ripng_aggregate_address,
struct prefix p;
struct route_node *node;
ret = str2prefix_ipv6 (argv[0], (struct prefix_ipv6 *)&p);
ret = str2prefix_ipv6 (argv[1]->arg, (struct prefix_ipv6 *)&p);
if (ret <= 0)
{
vty_out (vty, "Malformed address%s", VTY_NEWLINE);
@ -2365,7 +2365,7 @@ DEFUN (no_ripng_aggregate_address,
struct prefix p;
struct route_node *rn;
ret = str2prefix_ipv6 (argv[0], (struct prefix_ipv6 *) &p);
ret = str2prefix_ipv6 (argv[2]->arg, (struct prefix_ipv6 *) &p);
if (ret <= 0)
{
vty_out (vty, "Malformed address%s", VTY_NEWLINE);
@ -2395,7 +2395,7 @@ DEFUN (ripng_default_metric,
{
if (ripng)
{
ripng->default_metric = atoi (argv[0]);
ripng->default_metric = atoi (argv[1]->arg);
}
return CMD_SUCCESS;
}
@ -2537,9 +2537,9 @@ DEFUN (ripng_timers,
unsigned long timeout;
unsigned long garbage;
VTY_GET_INTEGER_RANGE("update timer", update, argv[0], 0, 65535);
VTY_GET_INTEGER_RANGE("timeout timer", timeout, argv[1], 0, 65535);
VTY_GET_INTEGER_RANGE("garbage timer", garbage, argv[2], 0, 65535);
VTY_GET_INTEGER_RANGE("update timer", update, argv[2]->arg, 0, 65535);
VTY_GET_INTEGER_RANGE("timeout timer", timeout, argv[3]->arg, 0, 65535);
VTY_GET_INTEGER_RANGE("garbage timer", garbage, argv[4]->arg, 0, 65535);
/* Set each timer value. */
ripng->update_time = update;
@ -2580,7 +2580,8 @@ ALIAS (no_ripng_timers,
"Routing information timeout timer. Default is 180.\n"
"Garbage collection timer. Default is 120.\n")
DEFUN (show_ipv6_protocols, show_ipv6_protocols_cmd,
DEFUN (show_ipv6_protocols,
show_ipv6_protocols_cmd,
"show ipv6 protocols",
SHOW_STR
IPV6_STR

View File

@ -31,6 +31,8 @@ def token_is_variable(line_number, token):
'.LINE', # where is this defined?
'LINE',
'BANDWIDTH',
'IPV6ADDR',
'IF_OR_ADDR',
'INTERFACE',
'PERCENTAGE',
'IFNAME',
@ -197,6 +199,7 @@ def update_argvs(filename):
line = line.replace('" VRF_ALL_CMD_STR "', 'vrf all')
line = line.replace('" QUAGGA_IP_PROTOCOL_MAP_STR_ZEBRA "', '(kernel|connected|static|rip|ospf|isis|bgp|pim|table|any)')
line = line.replace('" QUAGGA_IP6_PROTOCOL_MAP_STR_ZEBRA "', '(kernel|connected|static|ripng|ospf6|isis|bgp|table|any)')
line = line.replace('" QUAGGA_REDIST_STR_RIPNGD "', '(kernel|connected|static|ospf6|isis|bgp|table)')
# endswith
line = line.replace('" CMD_AS_RANGE,', ' <1-4294967295>",')
@ -206,8 +209,8 @@ def update_argvs(filename):
line = line.replace('" CMD_RANGE_STR(1, MULTIPATH_NUM),', '<1-255>",')
line = line.replace('" CMD_RANGE_STR(1, MAXTTL),', '<1-255>",')
line = line.replace('" BFD_CMD_DETECT_MULT_RANGE BFD_CMD_MIN_RX_RANGE BFD_CMD_MIN_TX_RANGE,', '<2-255> <50-60000> <50-60000>",')
line = line.replace('" OSPF_LSA_TYPES_CMD_STR,', ' asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as",')
line = line.replace('" OSPF_LSA_TYPES_CMD_STR,',
' asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as",')
line = line.replace('" BGP_UPDATE_SOURCE_REQ_STR,', ' (A.B.C.D|X:X::X:X|WORD)",')
line = line.replace('" BGP_UPDATE_SOURCE_OPT_STR,', ' {A.B.C.D|X:X::X:X|WORD}",')
line = line.replace('" QUAGGA_IP_REDIST_STR_BGPD,', ' (kernel|connected|static|rip|ospf|isis|pim|table)",')
@ -219,6 +222,7 @@ def update_argvs(filename):
line = line.replace('" QUAGGA_IP6_REDIST_STR_ZEBRA,', ' (kernel|connected|static|ripng|ospf6|isis|bgp|table)",')
line = line.replace('" QUAGGA_IP_PROTOCOL_MAP_STR_ZEBRA,', ' (kernel|connected|static|rip|ospf|isis|bgp|pim|table|any)",')
line = line.replace('" QUAGGA_IP6_PROTOCOL_MAP_STR_ZEBRA,', ' (kernel|connected|static|ripng|ospf6|isis|bgp|table|any)",')
line = line.replace('" QUAGGA_REDIST_STR_RIPNGD,', ' (kernel|connected|static|ospf6|isis|bgp|table)",')
# startswith
line = line.replace('LISTEN_RANGE_CMD "', '"bgp listen range (A.B.C.D/M|X:X::X:X/M) ')