summaryrefslogtreecommitdiff
path: root/pimd/pim_cmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'pimd/pim_cmd.c')
-rw-r--r--pimd/pim_cmd.c349
1 files changed, 144 insertions, 205 deletions
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c
index 430fc738d5..318bd1ba1c 100644
--- a/pimd/pim_cmd.c
+++ b/pimd/pim_cmd.c
@@ -1533,8 +1533,9 @@ DEFUN (pim_interface,
"Select an interface to configure\n"
"Interface's name\n")
{
+ int idx_ifname = 1;
struct interface *ifp;
- const char *ifname = argv[0];
+ const char *ifname = argv[idx_ifname]->arg;
size_t sl;
sl = strlen(ifname);
@@ -2368,13 +2369,14 @@ DEFUN (show_ip_rib,
RIB_STR
"Unicast address\n")
{
+ int idx_ipv4 = 3;
struct in_addr addr;
const char *addr_str;
struct pim_nexthop nexthop;
char nexthop_addr_str[100];
int result;
- addr_str = argv[0];
+ addr_str = argv[idx_ipv4]->arg;
result = inet_pton(AF_INET, addr_str, &addr);
if (result <= 0) {
vty_out(vty, "Bad unicast address %s: errno=%d: %s%s",
@@ -2466,16 +2468,17 @@ DEFUN (ip_pim_rp,
"Rendevous Point\n"
"ip address of RP\n")
{
+ int idx_ipv4 = 3;
int result;
- result = inet_pton(AF_INET, argv[0], &qpim_rp.rpf_addr.s_addr);
+ result = inet_pton(AF_INET, argv[idx_ipv4]->arg, &qpim_rp.rpf_addr.s_addr);
if (result <= 0) {
- vty_out(vty, "%% Bad RP address specified: %s", argv[0]);
+ vty_out(vty, "%% Bad RP address specified: %s", argv[idx_ipv4]->arg);
return CMD_WARNING;
}
if (pim_nexthop_lookup(&qpim_rp.source_nexthop, qpim_rp.rpf_addr, NULL) != 0) {
- vty_out(vty, "%% No Path to RP address specified: %s", argv[0]);
+ vty_out(vty, "%% No Path to RP address specified: %s", argv[idx_ipv4]->arg);
return CMD_WARNING;
}
@@ -2484,7 +2487,7 @@ DEFUN (ip_pim_rp,
DEFUN (no_ip_pim_rp,
no_ip_pim_rp_cmd,
- "no ip pim rp {A.B.C.D}",
+ "no ip pim rp [A.B.C.D]",
NO_STR
IP_STR
"pim multicast routing\n"
@@ -2498,7 +2501,7 @@ DEFUN (no_ip_pim_rp,
DEFUN (ip_multicast_routing,
ip_multicast_routing_cmd,
- PIM_CMD_IP_MULTICAST_ROUTING,
+ "ip multicast-routing",
IP_STR
"Enable IP multicast forwarding\n")
{
@@ -2511,7 +2514,7 @@ DEFUN (ip_multicast_routing,
DEFUN (no_ip_multicast_routing,
no_ip_multicast_routing_cmd,
- PIM_CMD_NO " " PIM_CMD_IP_MULTICAST_ROUTING,
+ "no ip multicast-routing",
NO_STR
IP_STR
"Global IP configuration subcommands\n"
@@ -2531,9 +2534,10 @@ DEFUN (ip_ssmpingd,
CONF_SSMPINGD_STR
"Source address\n")
{
+ int idx_ipv4 = 2;
int result;
struct in_addr source_addr;
- const char *source_str = (argc > 0) ? argv[0] : "0.0.0.0";
+ const char *source_str = (argc > idx_ipv4) ? argv[idx_ipv4]->arg : "0.0.0.0";
result = inet_pton(AF_INET, source_str, &source_addr);
if (result <= 0) {
@@ -2560,9 +2564,10 @@ DEFUN (no_ip_ssmpingd,
CONF_SSMPINGD_STR
"Source address\n")
{
+ int idx_ipv4 = 3;
int result;
struct in_addr source_addr;
- const char *source_str = (argc > 0) ? argv[0] : "0.0.0.0";
+ const char *source_str = (argc > idx_ipv4) ? argv[idx_ipv4]->arg : "0.0.0.0";
result = inet_pton(AF_INET, source_str, &source_addr);
if (result <= 0) {
@@ -2648,6 +2653,8 @@ DEFUN (interface_ip_igmp_join,
"Multicast group address\n"
"Source address\n")
{
+ int idx_ipv4 = 3;
+ int idx_ipv4_2 = 4;
struct interface *ifp;
const char *group_str;
const char *source_str;
@@ -2658,7 +2665,7 @@ DEFUN (interface_ip_igmp_join,
ifp = vty->index;
/* Group address */
- group_str = argv[0];
+ group_str = argv[idx_ipv4]->arg;
result = inet_pton(AF_INET, group_str, &group_addr);
if (result <= 0) {
vty_out(vty, "Bad group address %s: errno=%d: %s%s",
@@ -2667,7 +2674,7 @@ DEFUN (interface_ip_igmp_join,
}
/* Source address */
- source_str = argv[1];
+ source_str = argv[idx_ipv4_2]->arg;
result = inet_pton(AF_INET, source_str, &source_addr);
if (result <= 0) {
vty_out(vty, "Bad source address %s: errno=%d: %s%s",
@@ -2695,6 +2702,8 @@ DEFUN (interface_no_ip_igmp_join,
"Multicast group address\n"
"Source address\n")
{
+ int idx_ipv4 = 4;
+ int idx_ipv4_2 = 5;
struct interface *ifp;
const char *group_str;
const char *source_str;
@@ -2705,7 +2714,7 @@ DEFUN (interface_no_ip_igmp_join,
ifp = vty->index;
/* Group address */
- group_str = argv[0];
+ group_str = argv[idx_ipv4]->arg;
result = inet_pton(AF_INET, group_str, &group_addr);
if (result <= 0) {
vty_out(vty, "Bad group address %s: errno=%d: %s%s",
@@ -2714,7 +2723,7 @@ DEFUN (interface_no_ip_igmp_join,
}
/* Source address */
- source_str = argv[1];
+ source_str = argv[idx_ipv4_2]->arg;
result = inet_pton(AF_INET, source_str, &source_addr);
if (result <= 0) {
vty_out(vty, "Bad source address %s: errno=%d: %s%s",
@@ -2865,7 +2874,7 @@ static void change_query_max_response_time(struct pim_interface *pim_ifp,
DEFUN (interface_ip_igmp_query_interval,
interface_ip_igmp_query_interval_cmd,
- PIM_CMD_IP_IGMP_QUERY_INTERVAL " <1-1800>",
+ "ip igmp query-interval (1-1800)",
IP_STR
IFACE_IGMP_STR
IFACE_IGMP_QUERY_INTERVAL_STR
@@ -2887,7 +2896,7 @@ DEFUN (interface_ip_igmp_query_interval,
return CMD_WARNING;
}
- query_interval = atoi(argv[0]);
+ query_interval = atoi(argv[4]->arg);
query_interval_dsec = 10 * query_interval;
/*
@@ -2924,7 +2933,7 @@ DEFUN (interface_ip_igmp_query_interval,
DEFUN (interface_no_ip_igmp_query_interval,
interface_no_ip_igmp_query_interval_cmd,
- PIM_CMD_NO " " PIM_CMD_IP_IGMP_QUERY_INTERVAL,
+ "no ip igmp query-interval",
NO_STR
IP_STR
IFACE_IGMP_STR
@@ -2960,7 +2969,7 @@ DEFUN (interface_no_ip_igmp_query_interval,
DEFUN (interface_ip_igmp_query_max_response_time,
interface_ip_igmp_query_max_response_time_cmd,
- PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME " <1-25>",
+ "ip igmp query-max-response-time (1-25)",
IP_STR
IFACE_IGMP_STR
IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_STR
@@ -2981,7 +2990,7 @@ DEFUN (interface_ip_igmp_query_max_response_time,
return CMD_WARNING;
}
- query_max_response_time = atoi(argv[0]);
+ query_max_response_time = atoi(argv[4]->arg);
/*
It seems we don't need to check bounds since command.c does it
@@ -3017,7 +3026,7 @@ DEFUN (interface_ip_igmp_query_max_response_time,
DEFUN (interface_no_ip_igmp_query_max_response_time,
interface_no_ip_igmp_query_max_response_time_cmd,
- PIM_CMD_NO " " PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME,
+ "no ip igmp query-max-response-time",
NO_STR
IP_STR
IFACE_IGMP_STR
@@ -3053,7 +3062,7 @@ DEFUN (interface_no_ip_igmp_query_max_response_time,
DEFUN (interface_ip_igmp_query_max_response_time_dsec,
interface_ip_igmp_query_max_response_time_dsec_cmd,
- PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC " <10-250>",
+ "ip igmp query-max-response-time-dsec (10-250)",
IP_STR
IFACE_IGMP_STR
IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC_STR
@@ -3075,7 +3084,7 @@ DEFUN (interface_ip_igmp_query_max_response_time_dsec,
return CMD_WARNING;
}
- query_max_response_time_dsec = atoi(argv[0]);
+ query_max_response_time_dsec = atoi(argv[4]->arg);
/*
It seems we don't need to check bounds since command.c does it
@@ -3113,7 +3122,7 @@ DEFUN (interface_ip_igmp_query_max_response_time_dsec,
DEFUN (interface_no_ip_igmp_query_max_response_time_dsec,
interface_no_ip_igmp_query_max_response_time_dsec_cmd,
- PIM_CMD_NO " " PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC,
+ "no ip igmp query-max-response-time-dsec",
NO_STR
IP_STR
IFACE_IGMP_STR
@@ -3146,12 +3155,13 @@ DEFUN (interface_no_ip_igmp_query_max_response_time_dsec,
DEFUN (interface_ip_pim_drprio,
interface_ip_pim_drprio_cmd,
- "ip pim drpriority <1-4294967295>",
+ "ip pim drpriority (1-4294967295)",
IP_STR
PIM_STR
"Set the Designated Router Election Priority\n"
"Value of the new DR Priority\n")
{
+ int idx_number = 3;
struct interface *ifp;
struct pim_interface *pim_ifp;
uint32_t old_dr_prio;
@@ -3166,7 +3176,7 @@ DEFUN (interface_ip_pim_drprio,
old_dr_prio = pim_ifp->pim_dr_priority;
- pim_ifp->pim_dr_priority = strtol(argv[0], NULL, 10);
+ pim_ifp->pim_dr_priority = strtol(argv[idx_number]->arg, NULL, 10);
if (old_dr_prio != pim_ifp->pim_dr_priority) {
if (pim_if_dr_election(ifp))
@@ -3178,7 +3188,7 @@ DEFUN (interface_ip_pim_drprio,
DEFUN (interface_no_ip_pim_drprio,
interface_no_ip_pim_drprio_cmd,
- "no ip pim drpriority {<1-4294967295>}",
+ "no ip pim drpriority [(1-4294967295)]",
IP_STR
PIM_STR
"Revert the Designated Router Priority to default\n"
@@ -3345,6 +3355,8 @@ DEFUN (interface_ip_mroute,
"Outgoing interface name\n"
"Group address\n")
{
+ int idx_interface = 2;
+ int idx_ipv4 = 3;
struct interface *iif;
struct interface *oif;
const char *oifname;
@@ -3355,7 +3367,7 @@ DEFUN (interface_ip_mroute,
iif = vty->index;
- oifname = argv[0];
+ oifname = argv[idx_interface]->arg;
oif = if_lookup_by_name(oifname);
if (!oif) {
vty_out(vty, "No such interface name %s%s",
@@ -3363,7 +3375,7 @@ DEFUN (interface_ip_mroute,
return CMD_WARNING;
}
- grp_str = argv[1];
+ grp_str = argv[idx_ipv4]->arg;
result = inet_pton(AF_INET, grp_str, &grp_addr);
if (result <= 0) {
vty_out(vty, "Bad group address %s: errno=%d: %s%s",
@@ -3390,6 +3402,9 @@ DEFUN (interface_ip_mroute_source,
"Group address\n"
"Source address\n")
{
+ int idx_interface = 2;
+ int idx_ipv4 = 3;
+ int idx_ipv4_2 = 4;
struct interface *iif;
struct interface *oif;
const char *oifname;
@@ -3401,7 +3416,7 @@ DEFUN (interface_ip_mroute_source,
iif = vty->index;
- oifname = argv[0];
+ oifname = argv[idx_interface]->arg;
oif = if_lookup_by_name(oifname);
if (!oif) {
vty_out(vty, "No such interface name %s%s",
@@ -3409,7 +3424,7 @@ DEFUN (interface_ip_mroute_source,
return CMD_WARNING;
}
- grp_str = argv[1];
+ grp_str = argv[idx_ipv4]->arg;
result = inet_pton(AF_INET, grp_str, &grp_addr);
if (result <= 0) {
vty_out(vty, "Bad group address %s: errno=%d: %s%s",
@@ -3417,7 +3432,7 @@ DEFUN (interface_ip_mroute_source,
return CMD_WARNING;
}
- src_str = argv[2];
+ src_str = argv[idx_ipv4_2]->arg;
result = inet_pton(AF_INET, src_str, &src_addr);
if (result <= 0) {
vty_out(vty, "Bad source address %s: errno=%d: %s%s",
@@ -3442,6 +3457,8 @@ DEFUN (interface_no_ip_mroute,
"Outgoing interface name\n"
"Group Address\n")
{
+ int idx_interface = 3;
+ int idx_ipv4 = 4;
struct interface *iif;
struct interface *oif;
const char *oifname;
@@ -3452,7 +3469,7 @@ DEFUN (interface_no_ip_mroute,
iif = vty->index;
- oifname = argv[0];
+ oifname = argv[idx_interface]->arg;
oif = if_lookup_by_name(oifname);
if (!oif) {
vty_out(vty, "No such interface name %s%s",
@@ -3460,7 +3477,7 @@ DEFUN (interface_no_ip_mroute,
return CMD_WARNING;
}
- grp_str = argv[1];
+ grp_str = argv[idx_ipv4]->arg;
result = inet_pton(AF_INET, grp_str, &grp_addr);
if (result <= 0) {
vty_out(vty, "Bad group address %s: errno=%d: %s%s",
@@ -3488,6 +3505,9 @@ DEFUN (interface_no_ip_mroute_source,
"Group Address\n"
"Source Address\n")
{
+ int idx_interface = 3;
+ int idx_ipv4 = 4;
+ int idx_ipv4_2 = 5;
struct interface *iif;
struct interface *oif;
const char *oifname;
@@ -3499,7 +3519,7 @@ DEFUN (interface_no_ip_mroute_source,
iif = vty->index;
- oifname = argv[0];
+ oifname = argv[idx_interface]->arg;
oif = if_lookup_by_name(oifname);
if (!oif) {
vty_out(vty, "No such interface name %s%s",
@@ -3507,7 +3527,7 @@ DEFUN (interface_no_ip_mroute_source,
return CMD_WARNING;
}
- grp_str = argv[1];
+ grp_str = argv[idx_ipv4]->arg;
result = inet_pton(AF_INET, grp_str, &grp_addr);
if (result <= 0) {
vty_out(vty, "Bad group address %s: errno=%d: %s%s",
@@ -3515,7 +3535,7 @@ DEFUN (interface_no_ip_mroute_source,
return CMD_WARNING;
}
- src_str = argv[2];
+ src_str = argv[idx_ipv4_2]->arg;
result = inet_pton(AF_INET, src_str, &src_addr);
if (result <= 0) {
vty_out(vty, "Bad source address %s: errno=%d: %s%s",
@@ -3533,12 +3553,15 @@ DEFUN (interface_no_ip_mroute_source,
DEFUN (interface_ip_pim_hello,
interface_ip_pim_hello_cmd,
- "ip pim hello <1-180>",
+ "ip pim hello (1-180) [(1-180)]",
IP_STR
PIM_STR
IFACE_PIM_HELLO_STR
- IFACE_PIM_HELLO_TIME_STR)
+ IFACE_PIM_HELLO_TIME_STR
+ IFACE_PIM_HELLO_HOLD_STR)
{
+ int idx_time = 3;
+ int idx_hold = 4;
struct interface *ifp;
struct pim_interface *pim_ifp;
@@ -3550,27 +3573,19 @@ DEFUN (interface_ip_pim_hello,
return CMD_WARNING;
}
- pim_ifp->pim_hello_period = strtol(argv[0], NULL, 10);
+ pim_ifp->pim_hello_period = strtol(argv[idx_time]->arg, NULL, 10);
- if (argc == 2)
- pim_ifp->pim_default_holdtime = strtol(argv[1], NULL, 10);
+ if (argc > idx_hold)
+ pim_ifp->pim_default_holdtime = strtol(argv[idx_hold]->arg, NULL, 10);
return CMD_SUCCESS;
}
-ALIAS (interface_ip_pim_hello,
- interface_ip_pim_hello_hold_cmd,
- "ip pim hello <1-180> <1-180>",
- IP_STR
- PIM_STR
- IFACE_PIM_HELLO_STR
- IFACE_PIM_HELLO_TIME_STR
- IFACE_PIM_HELLO_HOLD_STR)
DEFUN (interface_no_ip_pim_hello,
interface_no_ip_pim_hello_cmd,
- "no ip pim hello {<1-180> <1-180>}",
+ "no ip pim hello [(1-180) (1-180)]",
NO_STR
IP_STR
PIM_STR
@@ -3620,11 +3635,6 @@ DEFUN (no_debug_igmp,
return CMD_SUCCESS;
}
-ALIAS (no_debug_igmp,
- undebug_igmp_cmd,
- "undebug igmp",
- UNDEBUG_STR
- DEBUG_IGMP_STR)
DEFUN (debug_igmp_events,
debug_igmp_events_cmd,
@@ -3649,12 +3659,6 @@ DEFUN (no_debug_igmp_events,
return CMD_SUCCESS;
}
-ALIAS (no_debug_igmp_events,
- undebug_igmp_events_cmd,
- "undebug igmp events",
- UNDEBUG_STR
- DEBUG_IGMP_STR
- DEBUG_IGMP_EVENTS_STR)
DEFUN (debug_igmp_packets,
debug_igmp_packets_cmd,
@@ -3679,12 +3683,6 @@ DEFUN (no_debug_igmp_packets,
return CMD_SUCCESS;
}
-ALIAS (no_debug_igmp_packets,
- undebug_igmp_packets_cmd,
- "undebug igmp packets",
- UNDEBUG_STR
- DEBUG_IGMP_STR
- DEBUG_IGMP_PACKETS_STR)
DEFUN (debug_igmp_trace,
debug_igmp_trace_cmd,
@@ -3709,12 +3707,6 @@ DEFUN (no_debug_igmp_trace,
return CMD_SUCCESS;
}
-ALIAS (no_debug_igmp_trace,
- undebug_igmp_trace_cmd,
- "undebug igmp trace",
- UNDEBUG_STR
- DEBUG_IGMP_STR
- DEBUG_IGMP_TRACE_STR)
DEFUN (debug_mroute,
debug_mroute_cmd,
@@ -3737,11 +3729,6 @@ DEFUN (no_debug_mroute,
return CMD_SUCCESS;
}
-ALIAS (no_debug_mroute,
- undebug_mroute_cmd,
- "undebug mroute",
- UNDEBUG_STR
- DEBUG_MROUTE_STR)
DEFUN (debug_static,
debug_static_cmd,
@@ -3764,11 +3751,6 @@ DEFUN (no_debug_static,
return CMD_SUCCESS;
}
-ALIAS (no_debug_static,
- undebug_static_cmd,
- "undebug static",
- UNDEBUG_STR
- DEBUG_STATIC_STR)
DEFUN (debug_pim,
debug_pim_cmd,
@@ -3799,11 +3781,6 @@ DEFUN (no_debug_pim,
return CMD_SUCCESS;
}
-ALIAS (no_debug_pim,
- undebug_pim_cmd,
- "undebug pim",
- UNDEBUG_STR
- DEBUG_PIM_STR)
DEFUN (debug_pim_events,
debug_pim_events_cmd,
@@ -3828,12 +3805,6 @@ DEFUN (no_debug_pim_events,
return CMD_SUCCESS;
}
-ALIAS (no_debug_pim_events,
- undebug_pim_events_cmd,
- "undebug pim events",
- UNDEBUG_STR
- DEBUG_PIM_STR
- DEBUG_PIM_EVENTS_STR)
DEFUN (debug_pim_packets,
debug_pim_packets_cmd,
@@ -3849,19 +3820,20 @@ DEFUN (debug_pim_packets,
DEFUN (debug_pim_packets_filter,
debug_pim_packets_filter_cmd,
- "debug pim packets (hello|joins)",
+ "debug pim packets <hello|joins>",
DEBUG_STR
DEBUG_PIM_STR
DEBUG_PIM_PACKETS_STR
DEBUG_PIM_HELLO_PACKETS_STR
DEBUG_PIM_J_P_PACKETS_STR)
{
- if (strncmp(argv[0],"h",1) == 0)
+ int idx_hello_join = 3;
+ if (strncmp(argv[idx_hello_join]->arg,"h",1) == 0)
{
PIM_DO_DEBUG_PIM_HELLO;
vty_out (vty, "PIM Hello debugging is on %s", VTY_NEWLINE);
}
- else if (strncmp(argv[0],"j",1) == 0)
+ else if (strncmp(argv[idx_hello_join]->arg,"j",1) == 0)
{
PIM_DO_DEBUG_PIM_J_P;
vty_out (vty, "PIM Join/Prune debugging is on %s", VTY_NEWLINE);
@@ -3886,7 +3858,7 @@ DEFUN (no_debug_pim_packets,
DEFUN (no_debug_pim_packets_filter,
no_debug_pim_packets_filter_cmd,
- "no debug pim packets (hello|joins)",
+ "no debug pim packets <hello|joins>",
NO_STR
DEBUG_STR
DEBUG_PIM_STR
@@ -3894,12 +3866,13 @@ DEFUN (no_debug_pim_packets_filter,
DEBUG_PIM_HELLO_PACKETS_STR
DEBUG_PIM_J_P_PACKETS_STR)
{
- if (strncmp(argv[0],"h",1) == 0)
+ int idx_hello_join = 4;
+ if (strncmp(argv[idx_hello_join]->arg,"h",1) == 0)
{
PIM_DONT_DEBUG_PIM_HELLO;
vty_out (vty, "PIM Hello debugging is off %s", VTY_NEWLINE);
}
- else if (strncmp(argv[0],"j",1) == 0)
+ else if (strncmp(argv[idx_hello_join]->arg,"j",1) == 0)
{
PIM_DONT_DEBUG_PIM_J_P;
vty_out (vty, "PIM Join/Prune debugging is off %s", VTY_NEWLINE);
@@ -3907,12 +3880,6 @@ DEFUN (no_debug_pim_packets_filter,
return CMD_SUCCESS;
}
-ALIAS (no_debug_pim_packets,
- undebug_pim_packets_cmd,
- "undebug pim packets",
- UNDEBUG_STR
- DEBUG_PIM_STR
- DEBUG_PIM_PACKETS_STR)
DEFUN (debug_pim_packetdump_send,
debug_pim_packetdump_send_cmd,
@@ -3939,13 +3906,6 @@ DEFUN (no_debug_pim_packetdump_send,
return CMD_SUCCESS;
}
-ALIAS (no_debug_pim_packetdump_send,
- undebug_pim_packetdump_send_cmd,
- "undebug pim packet-dump send",
- UNDEBUG_STR
- DEBUG_PIM_STR
- DEBUG_PIM_PACKETDUMP_STR
- DEBUG_PIM_PACKETDUMP_SEND_STR)
DEFUN (debug_pim_packetdump_recv,
debug_pim_packetdump_recv_cmd,
@@ -3972,13 +3932,6 @@ DEFUN (no_debug_pim_packetdump_recv,
return CMD_SUCCESS;
}
-ALIAS (no_debug_pim_packetdump_recv,
- undebug_pim_packetdump_recv_cmd,
- "undebug pim packet-dump receive",
- UNDEBUG_STR
- DEBUG_PIM_STR
- DEBUG_PIM_PACKETDUMP_STR
- DEBUG_PIM_PACKETDUMP_RECV_STR)
DEFUN (debug_pim_trace,
debug_pim_trace_cmd,
@@ -4003,12 +3956,6 @@ DEFUN (no_debug_pim_trace,
return CMD_SUCCESS;
}
-ALIAS (no_debug_pim_trace,
- undebug_pim_trace_cmd,
- "undebug pim trace",
- UNDEBUG_STR
- DEBUG_PIM_STR
- DEBUG_PIM_TRACE_STR)
DEFUN (debug_ssmpingd,
debug_ssmpingd_cmd,
@@ -4033,12 +3980,6 @@ DEFUN (no_debug_ssmpingd,
return CMD_SUCCESS;
}
-ALIAS (no_debug_ssmpingd,
- undebug_ssmpingd_cmd,
- "undebug ssmpingd",
- UNDEBUG_STR
- DEBUG_PIM_STR
- DEBUG_SSMPINGD_STR)
DEFUN (debug_pim_zebra,
debug_pim_zebra_cmd,
@@ -4063,12 +4004,6 @@ DEFUN (no_debug_pim_zebra,
return CMD_SUCCESS;
}
-ALIAS (no_debug_pim_zebra,
- undebug_pim_zebra_cmd,
- "undebug pim zebra",
- UNDEBUG_STR
- DEBUG_PIM_STR
- DEBUG_PIM_ZEBRA_STR)
DEFUN (show_debugging_pim,
show_debugging_pim_cmd,
@@ -4107,7 +4042,7 @@ static struct igmp_sock *find_igmp_sock_by_fd(int fd)
DEFUN (test_igmp_receive_report,
test_igmp_receive_report_cmd,
- "test igmp receive report <0-65535> A.B.C.D <1-6> .LINE",
+ "test igmp receive report (0-65535) A.B.C.D (1-6) LINE...",
"Test\n"
"Test IGMP protocol\n"
"Test IGMP message\n"
@@ -4117,6 +4052,10 @@ DEFUN (test_igmp_receive_report,
"Record type\n"
"Sources\n")
{
+ int idx_number = 4;
+ int idx_ipv4 = 5;
+ int idx_number_2 = 6;
+ int idx_line = 7;
char buf[1000];
char *igmp_msg;
struct ip *ip_hdr;
@@ -4138,7 +4077,7 @@ DEFUN (test_igmp_receive_report,
struct in_addr *src_addr;
int argi;
- socket = argv[0];
+ socket = argv[idx_number]->arg;
socket_fd = atoi(socket);
igmp = find_igmp_sock_by_fd(socket_fd);
if (!igmp) {
@@ -4147,7 +4086,7 @@ DEFUN (test_igmp_receive_report,
return CMD_WARNING;
}
- grp_str = argv[1];
+ grp_str = argv[idx_ipv4]->arg;
result = inet_pton(AF_INET, grp_str, &grp_addr);
if (result <= 0) {
vty_out(vty, "Bad group address %s: errno=%d: %s%s",
@@ -4155,7 +4094,7 @@ DEFUN (test_igmp_receive_report,
return CMD_WARNING;
}
- record_type_str = argv[2];
+ record_type_str = argv[idx_number_2]->arg;
record_type = atoi(record_type_str);
/*
@@ -4182,8 +4121,8 @@ DEFUN (test_igmp_receive_report,
/* Scan LINE sources */
sources = (struct in_addr *) (group_record + IGMP_V3_GROUP_RECORD_SOURCE_OFFSET);
src_addr = sources;
- for (argi = 3; argi < argc; ++argi,++src_addr) {
- src_str = argv[argi];
+ for (argi = idx_line; argi < argc; ++argi,++src_addr) {
+ src_str = argv[argi]->arg;
result = inet_pton(AF_INET, src_str, src_addr);
if (result <= 0) {
vty_out(vty, "Bad source address %s: errno=%d: %s%s",
@@ -4220,7 +4159,7 @@ static int hexval(uint8_t ch)
DEFUN (test_pim_receive_dump,
test_pim_receive_dump_cmd,
- "test pim receive dump INTERFACE A.B.C.D .LINE",
+ "test pim receive dump INTERFACE A.B.C.D LINE...",
"Test\n"
"Test PIM protocol\n"
"Test PIM message reception\n"
@@ -4229,6 +4168,9 @@ DEFUN (test_pim_receive_dump,
"Neighbor address\n"
"Packet dump\n")
{
+ int idx_interface = 4;
+ int idx_ipv4 = 5;
+ int idx_line = 6;
uint8_t buf[1000];
uint8_t *pim_msg;
struct ip *ip_hdr;
@@ -4243,7 +4185,7 @@ DEFUN (test_pim_receive_dump,
int result;
/* Find interface */
- ifname = argv[0];
+ ifname = argv[idx_interface]->arg;
ifp = if_lookup_by_name(ifname);
if (!ifp) {
vty_out(vty, "No such interface name %s%s",
@@ -4252,7 +4194,7 @@ DEFUN (test_pim_receive_dump,
}
/* Neighbor address */
- neigh_str = argv[1];
+ neigh_str = argv[idx_ipv4]->arg;
result = inet_pton(AF_INET, neigh_str, &neigh_addr);
if (result <= 0) {
vty_out(vty, "Bad neighbor address %s: errno=%d: %s%s",
@@ -4277,8 +4219,8 @@ DEFUN (test_pim_receive_dump,
pim_msg_size = 0;
/* Scan LINE dump into buffer */
- for (argi = 2; argi < argc; ++argi) {
- const char *str = argv[argi];
+ for (argi = idx_line; argi < argc; ++argi) {
+ const char *str = argv[argi]->arg;
int str_len = strlen(str);
int str_last = str_len - 1;
int i;
@@ -4332,7 +4274,7 @@ DEFUN (test_pim_receive_dump,
DEFUN (test_pim_receive_hello,
test_pim_receive_hello_cmd,
- "test pim receive hello INTERFACE A.B.C.D <0-65535> <0-65535> <0-65535> <0-32767> <0-65535> <0-1>[LINE]",
+ "test pim receive hello INTERFACE A.B.C.D (0-65535) (0-65535) (0-65535) (0-32767) (0-65535) (0-1) [LINE]",
"Test\n"
"Test PIM protocol\n"
"Test PIM message reception\n"
@@ -4347,6 +4289,15 @@ DEFUN (test_pim_receive_hello,
"Neighbor LAN prune delay T-bit\n"
"Neighbor secondary addresses\n")
{
+ int idx_interface = 4;
+ int idx_ipv4 = 5;
+ int idx_number = 6;
+ int idx_number_2 = 7;
+ int idx_number_3 = 8;
+ int idx_number_4 = 9;
+ int idx_number_5 = 10;
+ int idx_number_6 = 11;
+ int idx_line = 12;
uint8_t buf[1000];
uint8_t *pim_msg;
struct ip *ip_hdr;
@@ -4368,7 +4319,7 @@ DEFUN (test_pim_receive_hello,
int result;
/* Find interface */
- ifname = argv[0];
+ ifname = argv[idx_interface]->arg;
ifp = if_lookup_by_name(ifname);
if (!ifp) {
vty_out(vty, "No such interface name %s%s",
@@ -4377,7 +4328,7 @@ DEFUN (test_pim_receive_hello,
}
/* Neighbor address */
- neigh_str = argv[1];
+ neigh_str = argv[idx_ipv4]->arg;
result = inet_pton(AF_INET, neigh_str, &neigh_addr);
if (result <= 0) {
vty_out(vty, "Bad neighbor address %s: errno=%d: %s%s",
@@ -4385,12 +4336,12 @@ DEFUN (test_pim_receive_hello,
return CMD_WARNING;
}
- neigh_holdtime = atoi(argv[2]);
- neigh_dr_priority = atoi(argv[3]);
- neigh_generation_id = atoi(argv[4]);
- neigh_propagation_delay = atoi(argv[5]);
- neigh_override_interval = atoi(argv[6]);
- neigh_can_disable_join_suppression = atoi(argv[7]);
+ neigh_holdtime = atoi(argv[idx_number]->arg);
+ neigh_dr_priority = atoi(argv[idx_number_2]->arg);
+ neigh_generation_id = atoi(argv[idx_number_3]->arg);
+ neigh_propagation_delay = atoi(argv[idx_number_4]->arg);
+ neigh_override_interval = atoi(argv[idx_number_5]->arg);
+ neigh_can_disable_join_suppression = atoi(argv[idx_number_6]->arg);
/*
Tweak IP header
@@ -4408,8 +4359,8 @@ DEFUN (test_pim_receive_hello,
pim_msg = buf + ip_hlen;
/* Scan LINE addresses */
- for (argi = 8; argi < argc; ++argi) {
- const char *sec_str = argv[argi];
+ for (argi = idx_line; argi < argc; ++argi) {
+ const char *sec_str = argv[argi]->arg;
struct in_addr sec_addr;
result = inet_pton(AF_INET, sec_str, &sec_addr);
if (result <= 0) {
@@ -4459,7 +4410,7 @@ DEFUN (test_pim_receive_hello,
DEFUN (test_pim_receive_assert,
test_pim_receive_assert_cmd,
- "test pim receive assert INTERFACE A.B.C.D A.B.C.D A.B.C.D <0-65535> <0-65535> <0-1>",
+ "test pim receive assert INTERFACE A.B.C.D A.B.C.D A.B.C.D (0-65535) (0-65535) (0-1)",
"Test\n"
"Test PIM protocol\n"
"Test PIM message reception\n"
@@ -4472,6 +4423,13 @@ DEFUN (test_pim_receive_assert,
"Assert route metric\n"
"Assert RPT bit flag\n")
{
+ int idx_interface = 4;
+ int idx_ipv4 = 5;
+ int idx_ipv4_2 = 6;
+ int idx_ipv4_3 = 7;
+ int idx_number = 8;
+ int idx_number_2 = 9;
+ int idx_number_3 = 10;
uint8_t buf[1000];
uint8_t *buf_pastend = buf + sizeof(buf);
uint8_t *pim_msg;
@@ -4494,7 +4452,7 @@ DEFUN (test_pim_receive_assert,
int result;
/* Find interface */
- ifname = argv[0];
+ ifname = argv[idx_interface]->arg;
ifp = if_lookup_by_name(ifname);
if (!ifp) {
vty_out(vty, "No such interface name %s%s",
@@ -4503,7 +4461,7 @@ DEFUN (test_pim_receive_assert,
}
/* Neighbor address */
- neigh_str = argv[1];
+ neigh_str = argv[idx_ipv4]->arg;
result = inet_pton(AF_INET, neigh_str, &neigh_addr);
if (result <= 0) {
vty_out(vty, "Bad neighbor address %s: errno=%d: %s%s",
@@ -4512,7 +4470,7 @@ DEFUN (test_pim_receive_assert,
}
/* Group address */
- group_str = argv[2];
+ group_str = argv[idx_ipv4_2]->arg;
result = inet_pton(AF_INET, group_str, &group_addr);
if (result <= 0) {
vty_out(vty, "Bad group address %s: errno=%d: %s%s",
@@ -4521,7 +4479,7 @@ DEFUN (test_pim_receive_assert,
}
/* Source address */
- source_str = argv[3];
+ source_str = argv[idx_ipv4_3]->arg;
result = inet_pton(AF_INET, source_str, &source_addr);
if (result <= 0) {
vty_out(vty, "Bad source address %s: errno=%d: %s%s",
@@ -4529,9 +4487,9 @@ DEFUN (test_pim_receive_assert,
return CMD_WARNING;
}
- assert_metric_preference = atoi(argv[4]);
- assert_route_metric = atoi(argv[5]);
- assert_rpt_bit_flag = atoi(argv[6]);
+ assert_metric_preference = atoi(argv[idx_number]->arg);
+ assert_route_metric = atoi(argv[idx_number_2]->arg);
+ assert_rpt_bit_flag = atoi(argv[idx_number_3]->arg);
remain = buf_pastend - buf;
if (remain < (int) sizeof(struct ip)) {
@@ -4580,7 +4538,7 @@ DEFUN (test_pim_receive_assert,
}
static int recv_joinprune(struct vty *vty,
- const char *argv[],
+ struct cmd_token **argv,
int src_is_join)
{
uint8_t buf[1000];
@@ -4608,7 +4566,7 @@ static int recv_joinprune(struct vty *vty,
uint16_t num_pruned;
/* Find interface */
- ifname = argv[0];
+ ifname = argv[0]->arg;
ifp = if_lookup_by_name(ifname);
if (!ifp) {
vty_out(vty, "No such interface name %s%s",
@@ -4616,10 +4574,10 @@ static int recv_joinprune(struct vty *vty,
return CMD_WARNING;
}
- neigh_holdtime = atoi(argv[1]);
+ neigh_holdtime = atoi(argv[1]->arg);
/* Neighbor destination address */
- neigh_dst_str = argv[2];
+ neigh_dst_str = argv[2]->arg;
result = inet_pton(AF_INET, neigh_dst_str, &neigh_dst_addr);
if (result <= 0) {
vty_out(vty, "Bad neighbor destination address %s: errno=%d: %s%s",
@@ -4628,7 +4586,7 @@ static int recv_joinprune(struct vty *vty,
}
/* Neighbor source address */
- neigh_src_str = argv[3];
+ neigh_src_str = argv[3]->arg;
result = inet_pton(AF_INET, neigh_src_str, &neigh_src_addr);
if (result <= 0) {
vty_out(vty, "Bad neighbor source address %s: errno=%d: %s%s",
@@ -4637,7 +4595,7 @@ static int recv_joinprune(struct vty *vty,
}
/* Multicast group address */
- group_str = argv[4];
+ group_str = argv[4]->arg;
result = inet_pton(AF_INET, group_str, &group_addr);
if (result <= 0) {
vty_out(vty, "Bad group address %s: errno=%d: %s%s",
@@ -4646,7 +4604,7 @@ static int recv_joinprune(struct vty *vty,
}
/* Multicast source address */
- source_str = argv[5];
+ source_str = argv[5]->arg;
result = inet_pton(AF_INET, source_str, &source_addr);
if (result <= 0) {
vty_out(vty, "Bad source address %s: errno=%d: %s%s",
@@ -4767,7 +4725,7 @@ static int recv_joinprune(struct vty *vty,
DEFUN (test_pim_receive_join,
test_pim_receive_join_cmd,
- "test pim receive join INTERFACE <0-65535> A.B.C.D A.B.C.D A.B.C.D A.B.C.D",
+ "test pim receive join INTERFACE (0-65535) A.B.C.D A.B.C.D A.B.C.D A.B.C.D",
"Test\n"
"Test PIM protocol\n"
"Test PIM message reception\n"
@@ -4784,7 +4742,7 @@ DEFUN (test_pim_receive_join,
DEFUN (test_pim_receive_prune,
test_pim_receive_prune_cmd,
- "test pim receive prune INTERFACE <0-65535> A.B.C.D A.B.C.D A.B.C.D A.B.C.D",
+ "test pim receive prune INTERFACE (0-65535) A.B.C.D A.B.C.D A.B.C.D A.B.C.D",
"Test\n"
"Test PIM protocol\n"
"Test PIM message reception\n"
@@ -4801,7 +4759,7 @@ DEFUN (test_pim_receive_prune,
DEFUN (test_pim_receive_upcall,
test_pim_receive_upcall_cmd,
- "test pim receive upcall (nocache|wrongvif|wholepkt) <0-65535> A.B.C.D A.B.C.D",
+ "test pim receive upcall <nocache|wrongvif|wholepkt> (0-65535) A.B.C.D A.B.C.D",
"Test\n"
"Test PIM protocol\n"
"Test PIM message reception\n"
@@ -4813,13 +4771,17 @@ DEFUN (test_pim_receive_upcall,
"Multicast group address\n"
"Multicast source address\n")
{
+ int idx_type = 4;
+ int idx_number = 5;
+ int idx_ipv4 = 6;
+ int idx_ipv4_2 = 7;
struct igmpmsg msg;
const char *upcall_type;
const char *group_str;
const char *source_str;
int result;
- upcall_type = argv[0];
+ upcall_type = argv[idx_type]->arg;
if (upcall_type[0] == 'n')
msg.im_msgtype = IGMPMSG_NOCACHE;
@@ -4833,10 +4795,10 @@ DEFUN (test_pim_receive_upcall,
return CMD_WARNING;
}
- msg.im_vif = atoi(argv[1]);
+ msg.im_vif = atoi(argv[idx_number]->arg);
/* Group address */
- group_str = argv[2];
+ group_str = argv[idx_ipv4]->arg;
result = inet_pton(AF_INET, group_str, &msg.im_dst);
if (result <= 0) {
vty_out(vty, "Bad group address %s: errno=%d: %s%s",
@@ -4845,7 +4807,7 @@ DEFUN (test_pim_receive_upcall,
}
/* Source address */
- source_str = argv[3];
+ source_str = argv[idx_ipv4_2]->arg;
result = inet_pton(AF_INET, source_str, &msg.im_src);
if (result <= 0) {
vty_out(vty, "Bad source address %s: errno=%d: %s%s",
@@ -4901,7 +4863,6 @@ void pim_cmd_init()
install_element (INTERFACE_NODE, &interface_ip_pim_drprio_cmd);
install_element (INTERFACE_NODE, &interface_no_ip_pim_drprio_cmd);
install_element (INTERFACE_NODE, &interface_ip_pim_hello_cmd);
- install_element (INTERFACE_NODE, &interface_ip_pim_hello_hold_cmd);
install_element (INTERFACE_NODE, &interface_no_ip_pim_hello_cmd);
// Static mroutes NEB
@@ -4960,81 +4921,59 @@ void pim_cmd_init()
install_element (ENABLE_NODE, &debug_igmp_cmd);
install_element (ENABLE_NODE, &no_debug_igmp_cmd);
- install_element (ENABLE_NODE, &undebug_igmp_cmd);
install_element (ENABLE_NODE, &debug_igmp_events_cmd);
install_element (ENABLE_NODE, &no_debug_igmp_events_cmd);
- install_element (ENABLE_NODE, &undebug_igmp_events_cmd);
install_element (ENABLE_NODE, &debug_igmp_packets_cmd);
install_element (ENABLE_NODE, &no_debug_igmp_packets_cmd);
- install_element (ENABLE_NODE, &undebug_igmp_packets_cmd);
install_element (ENABLE_NODE, &debug_igmp_trace_cmd);
install_element (ENABLE_NODE, &no_debug_igmp_trace_cmd);
- install_element (ENABLE_NODE, &undebug_igmp_trace_cmd);
install_element (ENABLE_NODE, &debug_mroute_cmd);
install_element (ENABLE_NODE, &no_debug_mroute_cmd);
install_element (ENABLE_NODE, &debug_static_cmd);
install_element (ENABLE_NODE, &no_debug_static_cmd);
install_element (ENABLE_NODE, &debug_pim_cmd);
install_element (ENABLE_NODE, &no_debug_pim_cmd);
- install_element (ENABLE_NODE, &undebug_pim_cmd);
install_element (ENABLE_NODE, &debug_pim_events_cmd);
install_element (ENABLE_NODE, &no_debug_pim_events_cmd);
- install_element (ENABLE_NODE, &undebug_pim_events_cmd);
install_element (ENABLE_NODE, &debug_pim_packets_cmd);
install_element (ENABLE_NODE, &debug_pim_packets_filter_cmd);
install_element (ENABLE_NODE, &no_debug_pim_packets_cmd);
install_element (ENABLE_NODE, &no_debug_pim_packets_filter_cmd);
- install_element (ENABLE_NODE, &undebug_pim_packets_cmd);
install_element (ENABLE_NODE, &debug_pim_packetdump_send_cmd);
install_element (ENABLE_NODE, &no_debug_pim_packetdump_send_cmd);
- install_element (ENABLE_NODE, &undebug_pim_packetdump_send_cmd);
install_element (ENABLE_NODE, &debug_pim_packetdump_recv_cmd);
install_element (ENABLE_NODE, &no_debug_pim_packetdump_recv_cmd);
- install_element (ENABLE_NODE, &undebug_pim_packetdump_recv_cmd);
install_element (ENABLE_NODE, &debug_pim_trace_cmd);
install_element (ENABLE_NODE, &no_debug_pim_trace_cmd);
- install_element (ENABLE_NODE, &undebug_pim_trace_cmd);
install_element (ENABLE_NODE, &debug_ssmpingd_cmd);
install_element (ENABLE_NODE, &no_debug_ssmpingd_cmd);
- install_element (ENABLE_NODE, &undebug_ssmpingd_cmd);
install_element (ENABLE_NODE, &debug_pim_zebra_cmd);
install_element (ENABLE_NODE, &no_debug_pim_zebra_cmd);
- install_element (ENABLE_NODE, &undebug_pim_zebra_cmd);
install_element (CONFIG_NODE, &debug_igmp_cmd);
install_element (CONFIG_NODE, &no_debug_igmp_cmd);
- install_element (CONFIG_NODE, &undebug_igmp_cmd);
install_element (CONFIG_NODE, &debug_igmp_events_cmd);
install_element (CONFIG_NODE, &no_debug_igmp_events_cmd);
- install_element (CONFIG_NODE, &undebug_igmp_events_cmd);
install_element (CONFIG_NODE, &debug_igmp_packets_cmd);
install_element (CONFIG_NODE, &no_debug_igmp_packets_cmd);
- install_element (CONFIG_NODE, &undebug_igmp_packets_cmd);
install_element (CONFIG_NODE, &debug_igmp_trace_cmd);
install_element (CONFIG_NODE, &no_debug_igmp_trace_cmd);
- install_element (CONFIG_NODE, &undebug_igmp_trace_cmd);
install_element (CONFIG_NODE, &debug_mroute_cmd);
install_element (CONFIG_NODE, &no_debug_mroute_cmd);
install_element (CONFIG_NODE, &debug_static_cmd);
install_element (CONFIG_NODE, &no_debug_static_cmd);
install_element (CONFIG_NODE, &debug_pim_cmd);
install_element (CONFIG_NODE, &no_debug_pim_cmd);
- install_element (CONFIG_NODE, &undebug_pim_cmd);
install_element (CONFIG_NODE, &debug_pim_events_cmd);
install_element (CONFIG_NODE, &no_debug_pim_events_cmd);
- install_element (CONFIG_NODE, &undebug_pim_events_cmd);
install_element (CONFIG_NODE, &debug_pim_packets_cmd);
install_element (CONFIG_NODE, &debug_pim_packets_filter_cmd);
install_element (CONFIG_NODE, &no_debug_pim_packets_cmd);
install_element (CONFIG_NODE, &no_debug_pim_packets_filter_cmd);
- install_element (CONFIG_NODE, &undebug_pim_packets_cmd);
install_element (CONFIG_NODE, &debug_pim_trace_cmd);
install_element (CONFIG_NODE, &no_debug_pim_trace_cmd);
- install_element (CONFIG_NODE, &undebug_pim_trace_cmd);
install_element (CONFIG_NODE, &debug_ssmpingd_cmd);
install_element (CONFIG_NODE, &no_debug_ssmpingd_cmd);
- install_element (CONFIG_NODE, &undebug_ssmpingd_cmd);
install_element (CONFIG_NODE, &debug_pim_zebra_cmd);
install_element (CONFIG_NODE, &no_debug_pim_zebra_cmd);
- install_element (CONFIG_NODE, &undebug_pim_zebra_cmd);
}