ospf6d: scrubbed some argc CHECK MEs

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
This commit is contained in:
Daniel Walton 2016-09-30 05:09:42 +00:00
parent 4e626c014a
commit 14b16482c4
2 changed files with 168 additions and 515 deletions

View File

@ -1055,8 +1055,7 @@ DEFUN (show_ipv6_ospf6_interface_ifname_prefix,
OSPF6_STR OSPF6_STR
INTERFACE_STR INTERFACE_STR
IFNAME_STR IFNAME_STR
"Display connected prefixes to advertise\n" "Display connected prefixes to advertise\n")
)
{ {
/* CHECK ME argc referenced below */ /* CHECK ME argc referenced below */
int idx_ifname = 4; int idx_ifname = 4;
@ -1077,9 +1076,7 @@ DEFUN (show_ipv6_ospf6_interface_ifname_prefix,
return CMD_WARNING; return CMD_WARNING;
} }
argc--; ospf6_route_table_show (vty, 6, argc, argv, oi->route_connected);
argv++;
ospf6_route_table_show (vty, argc, argv, oi->route_connected);
return CMD_SUCCESS; return CMD_SUCCESS;
} }
@ -1132,7 +1129,7 @@ DEFUN (show_ipv6_ospf6_interface_prefix,
if (oi == NULL) if (oi == NULL)
continue; continue;
ospf6_route_table_show (vty, argc, argv, oi->route_connected); ospf6_route_table_show (vty, 5, argc, argv, oi->route_connected);
} }
return CMD_SUCCESS; return CMD_SUCCESS;

View File

@ -126,68 +126,61 @@ config_write_ospf6_debug (struct vty *vty)
"%s AS Scoped Link State Database%s%s" "%s AS Scoped Link State Database%s%s"
static int static int
parse_show_level (int argc, struct cmd_token **argv) parse_show_level (int idx_level, int argc, struct cmd_token **argv)
{ {
int level = 0; int level = OSPF6_LSDB_SHOW_LEVEL_NORMAL;
if (argc)
if (argc > idx_level)
{ {
if (! strncmp (argv[0]->arg, "de", 2)) if (strmatch (argv[idx_level]->text, "detail"))
level = OSPF6_LSDB_SHOW_LEVEL_DETAIL; level = OSPF6_LSDB_SHOW_LEVEL_DETAIL;
else if (! strncmp (argv[0]->arg, "du", 2)) else if (strmatch (argv[idx_level]->text, "dump"))
level = OSPF6_LSDB_SHOW_LEVEL_DUMP; level = OSPF6_LSDB_SHOW_LEVEL_DUMP;
else if (! strncmp (argv[0]->arg, "in", 2)) else if (strmatch (argv[idx_level]->text, "internal"))
level = OSPF6_LSDB_SHOW_LEVEL_INTERNAL; level = OSPF6_LSDB_SHOW_LEVEL_INTERNAL;
} }
else
level = OSPF6_LSDB_SHOW_LEVEL_NORMAL;
return level; return level;
} }
static u_int16_t static u_int16_t
parse_type_spec (int argc, struct cmd_token **argv) parse_type_spec (int idx_lsa, int argc, struct cmd_token **argv)
{ {
u_int16_t type = 0; u_int16_t type = 0;
assert (argc);
if (! strcmp (argv[0]->arg, "router")) if (argc > idx_lsa)
{
if (strmatch (argv[0]->text, "router"))
type = htons (OSPF6_LSTYPE_ROUTER); type = htons (OSPF6_LSTYPE_ROUTER);
else if (! strcmp (argv[0]->arg, "network")) else if (strmatch (argv[0]->text, "network"))
type = htons (OSPF6_LSTYPE_NETWORK); type = htons (OSPF6_LSTYPE_NETWORK);
else if (! strcmp (argv[0]->arg, "as-external")) else if (strmatch (argv[0]->text, "as-external"))
type = htons (OSPF6_LSTYPE_AS_EXTERNAL); type = htons (OSPF6_LSTYPE_AS_EXTERNAL);
else if (! strcmp (argv[0]->arg, "intra-prefix")) else if (strmatch (argv[0]->text, "intra-prefix"))
type = htons (OSPF6_LSTYPE_INTRA_PREFIX); type = htons (OSPF6_LSTYPE_INTRA_PREFIX);
else if (! strcmp (argv[0]->arg, "inter-router")) else if (strmatch (argv[0]->text, "inter-router"))
type = htons (OSPF6_LSTYPE_INTER_ROUTER); type = htons (OSPF6_LSTYPE_INTER_ROUTER);
else if (! strcmp (argv[0]->arg, "inter-prefix")) else if (strmatch (argv[0]->text, "inter-prefix"))
type = htons (OSPF6_LSTYPE_INTER_PREFIX); type = htons (OSPF6_LSTYPE_INTER_PREFIX);
else if (! strcmp (argv[0]->arg, "link")) else if (strmatch (argv[0]->text, "link"))
type = htons (OSPF6_LSTYPE_LINK); type = htons (OSPF6_LSTYPE_LINK);
}
return type; return type;
} }
/*
* CHECK ME - The following ALIASes need to be implemented in this DEFUN
* "show ipv6 ospf6 database (detail|dump|internal)",
* SHOW_STR
* IPV6_STR
* OSPF6_STR
* "Display Link state database\n"
* "Display details of LSAs\n"
* "Dump LSAs\n"
* "Display LSA's internal information\n"
*
*
*/
DEFUN (show_ipv6_ospf6_database, DEFUN (show_ipv6_ospf6_database,
show_ipv6_ospf6_database_cmd, show_ipv6_ospf6_database_cmd,
"show ipv6 ospf6 database", "show ipv6 ospf6 database [detail|dump|internal]",
SHOW_STR SHOW_STR
IPV6_STR IPV6_STR
OSPF6_STR OSPF6_STR
"Display Link state database\n" "Display Link state database\n"
) "Display details of LSAs\n"
"Dump LSAs\n"
"Display LSA's internal information\n")
{ {
/* CHECK ME argc referenced below */ int idx_level = 4;
int level; int level;
struct listnode *i, *j; struct listnode *i, *j;
struct ospf6 *o = ospf6; struct ospf6 *o = ospf6;
@ -196,7 +189,7 @@ DEFUN (show_ipv6_ospf6_database,
OSPF6_CMD_CHECK_RUNNING (); OSPF6_CMD_CHECK_RUNNING ();
level = parse_show_level (argc, argv); level = parse_show_level (idx_level, argc, argv);
for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa)) for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
{ {
@ -221,32 +214,9 @@ DEFUN (show_ipv6_ospf6_database,
return CMD_SUCCESS; return CMD_SUCCESS;
} }
/*
* CHECK ME - The following ALIASes need to be implemented in this DEFUN
* "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) (detail|dump|internal)",
* SHOW_STR
* IPV6_STR
* OSPF6_STR
* "Display Link state database\n"
* "Display Router LSAs\n"
* "Display Network LSAs\n"
* "Display Inter-Area-Prefix LSAs\n"
* "Display Inter-Area-Router LSAs\n"
* "Display As-External LSAs\n"
* "Display Group-Membership LSAs\n"
* "Display Type-7 LSAs\n"
* "Display Link LSAs\n"
* "Display Intra-Area-Prefix LSAs\n"
* "Display details of LSAs\n"
* "Dump LSAs\n"
* "Display LSA's internal information\n"
*
*
*/
DEFUN (show_ipv6_ospf6_database_type, DEFUN (show_ipv6_ospf6_database_type,
show_ipv6_ospf6_database_type_cmd, show_ipv6_ospf6_database_type_cmd,
"show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix>", "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> [<detail|dump|internal>]",
SHOW_STR SHOW_STR
IPV6_STR IPV6_STR
OSPF6_STR OSPF6_STR
@ -260,9 +230,13 @@ DEFUN (show_ipv6_ospf6_database_type,
"Display Type-7 LSAs\n" "Display Type-7 LSAs\n"
"Display Link LSAs\n" "Display Link LSAs\n"
"Display Intra-Area-Prefix LSAs\n" "Display Intra-Area-Prefix LSAs\n"
"Display details of LSAs\n"
"Dump LSAs\n"
"Display LSA's internal information\n"
) )
{ {
/* CHECK ME argc referenced below */ int idx_lsa = 4;
int idx_level = 5;
int level; int level;
struct listnode *i, *j; struct listnode *i, *j;
struct ospf6 *o = ospf6; struct ospf6 *o = ospf6;
@ -272,10 +246,8 @@ DEFUN (show_ipv6_ospf6_database_type,
OSPF6_CMD_CHECK_RUNNING (); OSPF6_CMD_CHECK_RUNNING ();
type = parse_type_spec (argc, argv); type = parse_type_spec (idx_lsa, argc, argv);
argc--; level = parse_show_level (idx_level, argc, argv);
argv++;
level = parse_show_level (argc, argv);
switch (OSPF6_LSA_SCOPE (type)) switch (OSPF6_LSA_SCOPE (type))
{ {
@ -328,8 +300,7 @@ DEFUN (show_ipv6_ospf6_database_type,
* "Display LSA's internal information\n" * "Display LSA's internal information\n"
* *
* *
* "show ipv6 ospf6 database linkstate-id A.B.C.D " * "show ipv6 ospf6 database linkstate-id A.B.C.D (detail|dump|internal)",
* "(detail|dump|internal)",
* SHOW_STR * SHOW_STR
* IPV6_STR * IPV6_STR
* OSPF6_STR * OSPF6_STR
@ -364,6 +335,7 @@ DEFUN (show_ipv6_ospf6_database_id,
{ {
/* CHECK ME argc referenced below */ /* CHECK ME argc referenced below */
int idx_ipv4 = 5; int idx_ipv4 = 5;
int idx_level = 6;
int level; int level;
struct listnode *i, *j; struct listnode *i, *j;
struct ospf6 *o = ospf6; struct ospf6 *o = ospf6;
@ -372,17 +344,8 @@ DEFUN (show_ipv6_ospf6_database_id,
u_int32_t id = 0; u_int32_t id = 0;
OSPF6_CMD_CHECK_RUNNING (); OSPF6_CMD_CHECK_RUNNING ();
inet_pton (AF_INET, argv[idx_ipv4]->arg, &id);
if ((inet_pton (AF_INET, argv[idx_ipv4]->arg, &id)) != 1) level = parse_show_level (idx_level, argc, argv);
{
vty_out (vty, "Link State ID is not parsable: %s%s",
argv[idx_ipv4]->arg, VNL);
return CMD_SUCCESS;
}
argc--;
argv++;
level = parse_show_level (argc, argv);
for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa)) for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
{ {
@ -434,8 +397,7 @@ DEFUN (show_ipv6_ospf6_database_id,
* "Specify Advertising Router as IPv4 address notation\n" * "Specify Advertising Router as IPv4 address notation\n"
* *
* *
* "show ipv6 ospf6 database adv-router A.B.C.D " * "show ipv6 ospf6 database adv-router A.B.C.D (detail|dump|internal)",
* "(detail|dump|internal)",
* SHOW_STR * SHOW_STR
* IPV6_STR * IPV6_STR
* OSPF6_STR * OSPF6_STR
@ -462,6 +424,7 @@ DEFUN (show_ipv6_ospf6_database_router,
{ {
/* CHECK ME argc referenced below */ /* CHECK ME argc referenced below */
int idx_ipv4 = 6; int idx_ipv4 = 6;
int idx_level = 7;
int level; int level;
struct listnode *i, *j; struct listnode *i, *j;
struct ospf6 *o = ospf6; struct ospf6 *o = ospf6;
@ -470,17 +433,8 @@ DEFUN (show_ipv6_ospf6_database_router,
u_int32_t adv_router = 0; u_int32_t adv_router = 0;
OSPF6_CMD_CHECK_RUNNING (); OSPF6_CMD_CHECK_RUNNING ();
inet_pton (AF_INET, argv[idx_ipv4]->arg, &adv_router);
if ((inet_pton (AF_INET, argv[idx_ipv4]->arg, &adv_router)) != 1) level = parse_show_level (idx_level, argc, argv);
{
vty_out (vty, "Advertising Router is not parsable: %s%s",
argv[idx_ipv4]->arg, VNL);
return CMD_SUCCESS;
}
argc--;
argv++;
level = parse_show_level (argc, argv);
for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa)) for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
{ {
@ -531,10 +485,7 @@ DEFUN (show_ipv6_ospf6_database_router,
* "Display LSA's internal information\n" * "Display LSA's internal information\n"
* *
* *
* "show ipv6 ospf6 database " * "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) A.B.C.D (detail|dump|internal)",
* "(router|network|inter-prefix|inter-router|as-external|"
* "group-membership|type-7|link|intra-prefix) A.B.C.D "
* "(detail|dump|internal)",
* SHOW_STR * SHOW_STR
* IPV6_STR * IPV6_STR
* OSPF6_STR * OSPF6_STR
@ -554,9 +505,7 @@ DEFUN (show_ipv6_ospf6_database_router,
* "Display LSA's internal information\n" * "Display LSA's internal information\n"
* *
* *
* "show ipv6 ospf6 database " * "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) linkstate-id A.B.C.D",
* "(router|network|inter-prefix|inter-router|as-external|"
* "group-membership|type-7|link|intra-prefix) linkstate-id A.B.C.D",
* SHOW_STR * SHOW_STR
* IPV6_STR * IPV6_STR
* OSPF6_STR * OSPF6_STR
@ -596,6 +545,8 @@ DEFUN (show_ipv6_ospf6_database_type_id,
{ {
/* CHECK ME argc referenced below */ /* CHECK ME argc referenced below */
int idx_lsa = 4; int idx_lsa = 4;
int idx_ipv4 = 5;
int idx_level = 6;
int level; int level;
struct listnode *i, *j; struct listnode *i, *j;
struct ospf6 *o = ospf6; struct ospf6 *o = ospf6;
@ -606,20 +557,9 @@ DEFUN (show_ipv6_ospf6_database_type_id,
OSPF6_CMD_CHECK_RUNNING (); OSPF6_CMD_CHECK_RUNNING ();
type = parse_type_spec (argc, argv); type = parse_type_spec (idx_lsa, argc, argv);
argc--; inet_pton (AF_INET, argv[idx_ipv4]->arg, &id);
argv++; level = parse_show_level (idx_level, argc, argv);
if ((inet_pton (AF_INET, argv[idx_lsa]->arg, &id)) != 1)
{
vty_out (vty, "Link state ID is not parsable: %s%s",
argv[idx_lsa]->arg, VNL);
return CMD_SUCCESS;
}
argc--;
argv++;
level = parse_show_level (argc, argv);
switch (OSPF6_LSA_SCOPE (type)) switch (OSPF6_LSA_SCOPE (type))
{ {
@ -683,10 +623,7 @@ DEFUN (show_ipv6_ospf6_database_type_id,
* "Display LSA's internal information\n" * "Display LSA's internal information\n"
* *
* *
* "show ipv6 ospf6 database " * "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) adv-router A.B.C.D (detail|dump|internal)",
* "(router|network|inter-prefix|inter-router|as-external|"
* "group-membership|type-7|link|intra-prefix) adv-router A.B.C.D "
* "(detail|dump|internal)",
* SHOW_STR * SHOW_STR
* IPV6_STR * IPV6_STR
* OSPF6_STR * OSPF6_STR
@ -707,9 +644,7 @@ DEFUN (show_ipv6_ospf6_database_type_id,
* "Display LSA's internal information\n" * "Display LSA's internal information\n"
* *
* *
* "show ipv6 ospf6 database " * "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) adv-router A.B.C.D",
* "(router|network|inter-prefix|inter-router|as-external|"
* "group-membership|type-7|link|intra-prefix) adv-router A.B.C.D",
* SHOW_STR * SHOW_STR
* IPV6_STR * IPV6_STR
* OSPF6_STR * OSPF6_STR
@ -750,6 +685,8 @@ DEFUN (show_ipv6_ospf6_database_type_router,
{ {
/* CHECK ME argc referenced below */ /* CHECK ME argc referenced below */
int idx_lsa = 4; int idx_lsa = 4;
int idx_ipv4 = 6;
int idx_level = 7;
int level; int level;
struct listnode *i, *j; struct listnode *i, *j;
struct ospf6 *o = ospf6; struct ospf6 *o = ospf6;
@ -760,20 +697,9 @@ DEFUN (show_ipv6_ospf6_database_type_router,
OSPF6_CMD_CHECK_RUNNING (); OSPF6_CMD_CHECK_RUNNING ();
type = parse_type_spec (argc, argv); type = parse_type_spec (idx_lsa, argc, argv);
argc--; inet_pton (AF_INET, argv[idx_ipv4]->arg, &adv_router);
argv++; level = parse_show_level (idx_level, argc, argv);
if ((inet_pton (AF_INET, argv[idx_lsa]->arg, &adv_router)) != 1)
{
vty_out (vty, "Advertising Router is not parsable: %s%s",
argv[idx_lsa]->arg, VNL);
return CMD_SUCCESS;
}
argc--;
argv++;
level = parse_show_level (argc, argv);
switch (OSPF6_LSA_SCOPE (type)) switch (OSPF6_LSA_SCOPE (type))
{ {
@ -812,27 +738,9 @@ DEFUN (show_ipv6_ospf6_database_type_router,
} }
/*
* CHECK ME - The following ALIASes need to be implemented in this DEFUN
* "show ipv6 ospf6 database * A.B.C.D A.B.C.D (detail|dump|internal)",
* SHOW_STR
* IPV6_STR
* OSPF6_STR
* "Display Link state database\n"
* "Any Link state Type\n"
* "Specify Link state ID as IPv4 address notation\n"
* "Specify Advertising Router as IPv4 address notation\n"
* "Display details of LSAs\n"
* "Dump LSAs\n"
* "Display LSA's internal information\n"
*
*
*/
DEFUN (show_ipv6_ospf6_database_id_router, DEFUN (show_ipv6_ospf6_database_id_router,
show_ipv6_ospf6_database_id_router_cmd, show_ipv6_ospf6_database_id_router_cmd,
"show ipv6 ospf6 database * A.B.C.D A.B.C.D", "show ipv6 ospf6 database * A.B.C.D A.B.C.D [<detail|dump|internal>]",
SHOW_STR SHOW_STR
IPV6_STR IPV6_STR
OSPF6_STR OSPF6_STR
@ -840,10 +748,14 @@ DEFUN (show_ipv6_ospf6_database_id_router,
"Any Link state Type\n" "Any Link state Type\n"
"Specify Link state ID as IPv4 address notation\n" "Specify Link state ID as IPv4 address notation\n"
"Specify Advertising Router as IPv4 address notation\n" "Specify Advertising Router as IPv4 address notation\n"
"Display details of LSAs\n"
"Dump LSAs\n"
"Display LSA's internal information\n"
) )
{ {
/* CHECK ME argc referenced below */ int idx_ls_id = 5;
int idx_ipv4 = 5; int idx_adv_rtr = 6;
int idx_level = 7;
int level; int level;
struct listnode *i, *j; struct listnode *i, *j;
struct ospf6 *o = ospf6; struct ospf6 *o = ospf6;
@ -853,27 +765,9 @@ DEFUN (show_ipv6_ospf6_database_id_router,
u_int32_t adv_router = 0; u_int32_t adv_router = 0;
OSPF6_CMD_CHECK_RUNNING (); OSPF6_CMD_CHECK_RUNNING ();
inet_pton (AF_INET, argv[idx_ls_id]->arg, &id);
if ((inet_pton (AF_INET, argv[idx_ipv4]->arg, &id)) != 1) inet_pton (AF_INET, argv[idx_adv_rtr]->arg, &adv_router);
{ level = parse_show_level (idx_level, argc, argv);
vty_out (vty, "Link state ID is not parsable: %s%s",
argv[idx_ipv4]->arg, VNL);
return CMD_SUCCESS;
}
argc--;
argv++;
if ((inet_pton (AF_INET, argv[idx_ipv4]->arg, &adv_router)) != 1)
{
vty_out (vty, "Advertising Router is not parsable: %s%s",
argv[idx_ipv4]->arg, VNL);
return CMD_SUCCESS;
}
argc--;
argv++;
level = parse_show_level (argc, argv);
for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa)) for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
{ {
@ -899,26 +793,9 @@ DEFUN (show_ipv6_ospf6_database_id_router,
} }
/*
* CHECK ME - The following ALIASes need to be implemented in this DEFUN
* "show ipv6 ospf6 database adv-router A.B.C.D linkstate-id A.B.C.D (detail|dump|internal)",
* SHOW_STR
* IPV6_STR
* OSPF6_STR
* "Display Link state database\n"
* "Search by Advertising Router\n"
* "Specify Advertising Router as IPv4 address notation\n"
* "Search by Link state ID\n"
* "Specify Link state ID as IPv4 address notation\n"
* "Display details of LSAs\n"
* "Dump LSAs\n"
* "Display LSA's internal information\n"
*
*
*/
DEFUN (show_ipv6_ospf6_database_adv_router_linkstate_id, DEFUN (show_ipv6_ospf6_database_adv_router_linkstate_id,
show_ipv6_ospf6_database_adv_router_linkstate_id_cmd, show_ipv6_ospf6_database_adv_router_linkstate_id_cmd,
"show ipv6 ospf6 database adv-router A.B.C.D linkstate-id A.B.C.D", "show ipv6 ospf6 database adv-router A.B.C.D linkstate-id A.B.C.D [<detail|dump|internal>]",
SHOW_STR SHOW_STR
IPV6_STR IPV6_STR
OSPF6_STR OSPF6_STR
@ -927,10 +804,13 @@ DEFUN (show_ipv6_ospf6_database_adv_router_linkstate_id,
"Specify Advertising Router as IPv4 address notation\n" "Specify Advertising Router as IPv4 address notation\n"
"Search by Link state ID\n" "Search by Link state ID\n"
"Specify Link state ID as IPv4 address notation\n" "Specify Link state ID as IPv4 address notation\n"
) "Display details of LSAs\n"
"Dump LSAs\n"
"Display LSA's internal information\n")
{ {
/* CHECK ME argc referenced below */ int idx_adv_rtr = 5;
int idx_ipv4 = 5; int idx_ls_id = 7;
int idx_level = 8;
int level; int level;
struct listnode *i, *j; struct listnode *i, *j;
struct ospf6 *o = ospf6; struct ospf6 *o = ospf6;
@ -940,27 +820,9 @@ DEFUN (show_ipv6_ospf6_database_adv_router_linkstate_id,
u_int32_t adv_router = 0; u_int32_t adv_router = 0;
OSPF6_CMD_CHECK_RUNNING (); OSPF6_CMD_CHECK_RUNNING ();
inet_pton (AF_INET, argv[idx_adv_rtr]->arg, &adv_router);
if ((inet_pton (AF_INET, argv[idx_ipv4]->arg, &adv_router)) != 1) inet_pton (AF_INET, argv[idx_ls_id]->arg, &id);
{ level = parse_show_level (idx_level, argc, argv);
vty_out (vty, "Advertising Router is not parsable: %s%s",
argv[idx_ipv4]->arg, VNL);
return CMD_SUCCESS;
}
argc--;
argv++;
if ((inet_pton (AF_INET, argv[idx_ipv4]->arg, &id)) != 1)
{
vty_out (vty, "Link state ID is not parsable: %s%s",
argv[idx_ipv4]->arg, VNL);
return CMD_SUCCESS;
}
argc--;
argv++;
level = parse_show_level (argc, argv);
for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa)) for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
{ {
@ -985,33 +847,9 @@ DEFUN (show_ipv6_ospf6_database_adv_router_linkstate_id,
return CMD_SUCCESS; return CMD_SUCCESS;
} }
/*
* CHECK ME - The following ALIASes need to be implemented in this DEFUN
* "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) A.B.C.D A.B.C.D (dump|internal)",
* SHOW_STR
* IPV6_STR
* OSPF6_STR
* "Display Link state database\n"
* "Display Router LSAs\n"
* "Display Network LSAs\n"
* "Display Inter-Area-Prefix LSAs\n"
* "Display Inter-Area-Router LSAs\n"
* "Display As-External LSAs\n"
* "Display Group-Membership LSAs\n"
* "Display Type-7 LSAs\n"
* "Display Link LSAs\n"
* "Display Intra-Area-Prefix LSAs\n"
* "Specify Link state ID as IPv4 address notation\n"
* "Specify Advertising Router as IPv4 address notation\n"
* "Dump LSAs\n"
* "Display LSA's internal information\n"
*
*
*/
DEFUN (show_ipv6_ospf6_database_type_id_router, DEFUN (show_ipv6_ospf6_database_type_id_router,
show_ipv6_ospf6_database_type_id_router_cmd, show_ipv6_ospf6_database_type_id_router_cmd,
"show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> A.B.C.D A.B.C.D", "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> A.B.C.D A.B.C.D [<dump|internal>]",
SHOW_STR SHOW_STR
IPV6_STR IPV6_STR
OSPF6_STR OSPF6_STR
@ -1027,10 +865,13 @@ DEFUN (show_ipv6_ospf6_database_type_id_router,
"Display Intra-Area-Prefix LSAs\n" "Display Intra-Area-Prefix LSAs\n"
"Specify Link state ID as IPv4 address notation\n" "Specify Link state ID as IPv4 address notation\n"
"Specify Advertising Router as IPv4 address notation\n" "Specify Advertising Router as IPv4 address notation\n"
) "Dump LSAs\n"
"Display LSA's internal information\n")
{ {
/* CHECK ME argc referenced below */
int idx_lsa = 4; int idx_lsa = 4;
int idx_ls_id = 5;
int idx_adv_rtr = 6;
int idx_level = 7;
int level; int level;
struct listnode *i, *j; struct listnode *i, *j;
struct ospf6 *o = ospf6; struct ospf6 *o = ospf6;
@ -1040,32 +881,13 @@ DEFUN (show_ipv6_ospf6_database_type_id_router,
u_int32_t id = 0; u_int32_t id = 0;
u_int32_t adv_router = 0; u_int32_t adv_router = 0;
// dwalton is this needed?
OSPF6_CMD_CHECK_RUNNING (); OSPF6_CMD_CHECK_RUNNING ();
type = parse_type_spec (argc, argv); type = parse_type_spec (idx_lsa, argc, argv);
argc--; inet_pton (AF_INET, argv[idx_ls_id]->arg, &id);
argv++; inet_pton (AF_INET, argv[idx_adv_rtr]->arg, &adv_router);
level = parse_show_level (idx_level, argc, argv);
if ((inet_pton (AF_INET, argv[idx_lsa]->arg, &id)) != 1)
{
vty_out (vty, "Link state ID is not parsable: %s%s",
argv[idx_lsa]->arg, VNL);
return CMD_SUCCESS;
}
argc--;
argv++;
if ((inet_pton (AF_INET, argv[idx_lsa]->arg, &adv_router)) != 1)
{
vty_out (vty, "Advertising Router is not parsable: %s%s",
argv[idx_lsa]->arg, VNL);
return CMD_SUCCESS;
}
argc--;
argv++;
level = parse_show_level (argc, argv);
switch (OSPF6_LSA_SCOPE (type)) switch (OSPF6_LSA_SCOPE (type))
{ {
@ -1104,34 +926,9 @@ DEFUN (show_ipv6_ospf6_database_type_id_router,
} }
/*
* CHECK ME - The following ALIASes need to be implemented in this DEFUN
* "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) adv-router A.B.C.D linkstate-id A.B.C.D (dump|internal)",
* SHOW_STR
* IPV6_STR
* OSPF6_STR
* "Display Link state database\n"
* "Display Router LSAs\n"
* "Display Network LSAs\n"
* "Display Inter-Area-Prefix LSAs\n"
* "Display Inter-Area-Router LSAs\n"
* "Display As-External LSAs\n"
* "Display Group-Membership LSAs\n"
* "Display Type-7 LSAs\n"
* "Display Link LSAs\n"
* "Display Intra-Area-Prefix LSAs\n"
* "Search by Advertising Router\n"
* "Specify Advertising Router as IPv4 address notation\n"
* "Search by Link state ID\n"
* "Specify Link state ID as IPv4 address notation\n"
* "Dump LSAs\n"
* "Display LSA's internal information\n"
*
*
*/
DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id, DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id,
show_ipv6_ospf6_database_type_adv_router_linkstate_id_cmd, show_ipv6_ospf6_database_type_adv_router_linkstate_id_cmd,
"show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> adv-router A.B.C.D linkstate-id A.B.C.D", "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> adv-router A.B.C.D linkstate-id A.B.C.D [<dump|internal>]",
SHOW_STR SHOW_STR
IPV6_STR IPV6_STR
OSPF6_STR OSPF6_STR
@ -1149,10 +946,13 @@ DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id,
"Specify Advertising Router as IPv4 address notation\n" "Specify Advertising Router as IPv4 address notation\n"
"Search by Link state ID\n" "Search by Link state ID\n"
"Specify Link state ID as IPv4 address notation\n" "Specify Link state ID as IPv4 address notation\n"
) "Dump LSAs\n"
"Display LSA's internal information\n")
{ {
/* CHECK ME argc referenced below */
int idx_lsa = 4; int idx_lsa = 4;
int idx_adv_rtr = 6;
int idx_ls_id = 8;
int idx_level = 9;
int level; int level;
struct listnode *i, *j; struct listnode *i, *j;
struct ospf6 *o = ospf6; struct ospf6 *o = ospf6;
@ -1164,30 +964,10 @@ DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id,
OSPF6_CMD_CHECK_RUNNING (); OSPF6_CMD_CHECK_RUNNING ();
type = parse_type_spec (argc, argv); type = parse_type_spec (idx_lsa, argc, argv);
argc--; inet_pton (AF_INET, argv[idx_adv_rtr]->arg, &adv_router);
argv++; inet_pton (AF_INET, argv[idx_ls_id]->arg, &id);
level = parse_show_level (idx_level, argc, argv);
if ((inet_pton (AF_INET, argv[idx_lsa]->arg, &adv_router)) != 1)
{
vty_out (vty, "Advertising Router is not parsable: %s%s",
argv[idx_lsa]->arg, VNL);
return CMD_SUCCESS;
}
argc--;
argv++;
if ((inet_pton (AF_INET, argv[idx_lsa]->arg, &id)) != 1)
{
vty_out (vty, "Link state ID is not parsable: %s%s",
argv[idx_lsa]->arg, VNL);
return CMD_SUCCESS;
}
argc--;
argv++;
level = parse_show_level (argc, argv);
switch (OSPF6_LSA_SCOPE (type)) switch (OSPF6_LSA_SCOPE (type))
{ {
@ -1225,30 +1005,18 @@ DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id,
return CMD_SUCCESS; return CMD_SUCCESS;
} }
/*
* CHECK ME - The following ALIASes need to be implemented in this DEFUN
* "show ipv6 ospf6 database self-originated (detail|dump|internal)",
* SHOW_STR
* IPV6_STR
* OSPF6_STR
* "Display Self-originated LSAs\n"
* "Display details of LSAs\n"
* "Dump LSAs\n"
* "Display LSA's internal information\n"
*
*
*/
DEFUN (show_ipv6_ospf6_database_self_originated, DEFUN (show_ipv6_ospf6_database_self_originated,
show_ipv6_ospf6_database_self_originated_cmd, show_ipv6_ospf6_database_self_originated_cmd,
"show ipv6 ospf6 database self-originated", "show ipv6 ospf6 database self-originated [<detail|dump|internal>]",
SHOW_STR SHOW_STR
IPV6_STR IPV6_STR
OSPF6_STR OSPF6_STR
"Display Self-originated LSAs\n" "Display Self-originated LSAs\n"
) "Display details of LSAs\n"
"Dump LSAs\n"
"Display LSA's internal information\n")
{ {
/* CHECK ME argc referenced below */ int idx_level = 5;
int level; int level;
struct listnode *i, *j; struct listnode *i, *j;
struct ospf6 *o = ospf6; struct ospf6 *o = ospf6;
@ -1257,9 +1025,7 @@ DEFUN (show_ipv6_ospf6_database_self_originated,
u_int32_t adv_router = 0; u_int32_t adv_router = 0;
OSPF6_CMD_CHECK_RUNNING (); OSPF6_CMD_CHECK_RUNNING ();
level = parse_show_level (idx_level, argc, argv);
level = parse_show_level (argc, argv);
adv_router = o->router_id; adv_router = o->router_id;
for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa)) for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
@ -1286,32 +1052,9 @@ DEFUN (show_ipv6_ospf6_database_self_originated,
} }
/*
* CHECK ME - The following ALIASes need to be implemented in this DEFUN
* "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) self-originated (detail|dump|internal)",
* SHOW_STR
* IPV6_STR
* OSPF6_STR
* "Display Link state database\n"
* "Display Router LSAs\n"
* "Display Network LSAs\n"
* "Display Inter-Area-Prefix LSAs\n"
* "Display Inter-Area-Router LSAs\n"
* "Display As-External LSAs\n"
* "Display Group-Membership LSAs\n"
* "Display Type-7 LSAs\n"
* "Display Link LSAs\n"
* "Display Intra-Area-Prefix LSAs\n"
* "Display Self-originated LSAs\n"
* "Display details of LSAs\n"
* "Dump LSAs\n"
* "Display LSA's internal information\n"
*
*
*/
DEFUN (show_ipv6_ospf6_database_type_self_originated, DEFUN (show_ipv6_ospf6_database_type_self_originated,
show_ipv6_ospf6_database_type_self_originated_cmd, show_ipv6_ospf6_database_type_self_originated_cmd,
"show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> self-originated", "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> self-originated [<detail|dump|internal>]",
SHOW_STR SHOW_STR
IPV6_STR IPV6_STR
OSPF6_STR OSPF6_STR
@ -1326,9 +1069,12 @@ DEFUN (show_ipv6_ospf6_database_type_self_originated,
"Display Link LSAs\n" "Display Link LSAs\n"
"Display Intra-Area-Prefix LSAs\n" "Display Intra-Area-Prefix LSAs\n"
"Display Self-originated LSAs\n" "Display Self-originated LSAs\n"
) "Display details of LSAs\n"
"Dump LSAs\n"
"Display LSA's internal information\n")
{ {
/* CHECK ME argc referenced below */ int idx_lsa = 4;
int idx_level = 6;
int level; int level;
struct listnode *i, *j; struct listnode *i, *j;
struct ospf6 *o = ospf6; struct ospf6 *o = ospf6;
@ -1339,10 +1085,8 @@ DEFUN (show_ipv6_ospf6_database_type_self_originated,
OSPF6_CMD_CHECK_RUNNING (); OSPF6_CMD_CHECK_RUNNING ();
type = parse_type_spec (argc, argv); type = parse_type_spec (idx_lsa, argc, argv);
argc--; level = parse_show_level (idx_level, argc, argv);
argv++;
level = parse_show_level (argc, argv);
adv_router = o->router_id; adv_router = o->router_id;
@ -1382,35 +1126,9 @@ DEFUN (show_ipv6_ospf6_database_type_self_originated,
return CMD_SUCCESS; return CMD_SUCCESS;
} }
/*
* CHECK ME - The following ALIASes need to be implemented in this DEFUN
* "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) self-originated linkstate-id A.B.C.D (detail|dump|internal)",
* SHOW_STR
* IPV6_STR
* OSPF6_STR
* "Display Link state database\n"
* "Display Router LSAs\n"
* "Display Network LSAs\n"
* "Display Inter-Area-Prefix LSAs\n"
* "Display Inter-Area-Router LSAs\n"
* "Display As-External LSAs\n"
* "Display Group-Membership LSAs\n"
* "Display Type-7 LSAs\n"
* "Display Link LSAs\n"
* "Display Intra-Area-Prefix LSAs\n"
* "Display Self-originated LSAs\n"
* "Search by Link state ID\n"
* "Specify Link state ID as IPv4 address notation\n"
* "Display details of LSAs\n"
* "Dump LSAs\n"
* "Display LSA's internal information\n"
*
*
*/
DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id, DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id,
show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd, show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd,
"show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> self-originated linkstate-id A.B.C.D", "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> self-originated linkstate-id A.B.C.D [<detail|dump|internal>]",
SHOW_STR SHOW_STR
IPV6_STR IPV6_STR
OSPF6_STR OSPF6_STR
@ -1427,10 +1145,13 @@ DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id,
"Display Self-originated LSAs\n" "Display Self-originated LSAs\n"
"Search by Link state ID\n" "Search by Link state ID\n"
"Specify Link state ID as IPv4 address notation\n" "Specify Link state ID as IPv4 address notation\n"
) "Display details of LSAs\n"
"Dump LSAs\n"
"Display LSA's internal information\n")
{ {
/* CHECK ME argc referenced below */
int idx_lsa = 4; int idx_lsa = 4;
int idx_ls_id = 7;
int idx_level = 8;
int level; int level;
struct listnode *i, *j; struct listnode *i, *j;
struct ospf6 *o = ospf6; struct ospf6 *o = ospf6;
@ -1442,21 +1163,9 @@ DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id,
OSPF6_CMD_CHECK_RUNNING (); OSPF6_CMD_CHECK_RUNNING ();
type = parse_type_spec (argc, argv); type = parse_type_spec (idx_lsa, argc, argv);
argc--; inet_pton (AF_INET, argv[idx_ls_id]->arg, &id);
argv++; level = parse_show_level (idx_level, argc, argv);
if ((inet_pton (AF_INET, argv[idx_lsa]->arg, &id)) != 1)
{
vty_out (vty, "Link State ID is not parsable: %s%s",
argv[idx_lsa]->arg, VNL);
return CMD_SUCCESS;
}
argc--;
argv++;
level = parse_show_level (argc, argv);
adv_router = o->router_id; adv_router = o->router_id;
switch (OSPF6_LSA_SCOPE (type)) switch (OSPF6_LSA_SCOPE (type))
@ -1495,35 +1204,9 @@ DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id,
return CMD_SUCCESS; return CMD_SUCCESS;
} }
/*
* CHECK ME - The following ALIASes need to be implemented in this DEFUN
* "show ipv6 ospf6 database (router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix) A.B.C.D self-originated (detail|dump|internal)",
* SHOW_STR
* IPV6_STR
* OSPF6_STR
* "Display Link state database\n"
* "Display Router LSAs\n"
* "Display Network LSAs\n"
* "Display Inter-Area-Prefix LSAs\n"
* "Display Inter-Area-Router LSAs\n"
* "Display As-External LSAs\n"
* "Display Group-Membership LSAs\n"
* "Display Type-7 LSAs\n"
* "Display Link LSAs\n"
* "Display Intra-Area-Prefix LSAs\n"
* "Display Self-originated LSAs\n"
* "Search by Link state ID\n"
* "Specify Link state ID as IPv4 address notation\n"
* "Display details of LSAs\n"
* "Dump LSAs\n"
* "Display LSA's internal information\n"
*
*
*/
DEFUN (show_ipv6_ospf6_database_type_id_self_originated, DEFUN (show_ipv6_ospf6_database_type_id_self_originated,
show_ipv6_ospf6_database_type_id_self_originated_cmd, show_ipv6_ospf6_database_type_id_self_originated_cmd,
"show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> A.B.C.D self-originated", "show ipv6 ospf6 database <router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix> A.B.C.D self-originated [<detail|dump|internal>]",
SHOW_STR SHOW_STR
IPV6_STR IPV6_STR
OSPF6_STR OSPF6_STR
@ -1539,10 +1222,13 @@ DEFUN (show_ipv6_ospf6_database_type_id_self_originated,
"Display Intra-Area-Prefix LSAs\n" "Display Intra-Area-Prefix LSAs\n"
"Specify Link state ID as IPv4 address notation\n" "Specify Link state ID as IPv4 address notation\n"
"Display Self-originated LSAs\n" "Display Self-originated LSAs\n"
) "Display details of LSAs\n"
"Dump LSAs\n"
"Display LSA's internal information\n")
{ {
/* CHECK ME argc referenced below */
int idx_lsa = 4; int idx_lsa = 4;
int idx_ls_id = 5;
int idx_level = 7;
int level; int level;
struct listnode *i, *j; struct listnode *i, *j;
struct ospf6 *o = ospf6; struct ospf6 *o = ospf6;
@ -1554,21 +1240,9 @@ DEFUN (show_ipv6_ospf6_database_type_id_self_originated,
OSPF6_CMD_CHECK_RUNNING (); OSPF6_CMD_CHECK_RUNNING ();
type = parse_type_spec (argc, argv); type = parse_type_spec (idx_lsa, argc, argv);
argc--; inet_pton (AF_INET, argv[idx_ls_id]->arg, &id);
argv++; level = parse_show_level (idx_level, argc, argv);
if ((inet_pton (AF_INET, argv[idx_lsa]->arg, &id)) != 1)
{
vty_out (vty, "Link State ID is not parsable: %s%s",
argv[idx_lsa]->arg, VNL);
return CMD_SUCCESS;
}
argc--;
argv++;
level = parse_show_level (argc, argv);
adv_router = o->router_id; adv_router = o->router_id;
switch (OSPF6_LSA_SCOPE (type)) switch (OSPF6_LSA_SCOPE (type))
@ -1607,53 +1281,33 @@ DEFUN (show_ipv6_ospf6_database_type_id_self_originated,
return CMD_SUCCESS; return CMD_SUCCESS;
} }
/*
* CHECK ME - The following ALIASes need to be implemented in this DEFUN
* "show ipv6 ospf6 border-routers (A.B.C.D|detail)",
* SHOW_STR
* IP6_STR
* OSPF6_STR
* "Display routing table for ABR and ASBR\n"
* "Specify Router-ID\n"
* "Display Detail\n"
*
*
*/
DEFUN (show_ipv6_ospf6_border_routers, DEFUN (show_ipv6_ospf6_border_routers,
show_ipv6_ospf6_border_routers_cmd, show_ipv6_ospf6_border_routers_cmd,
"show ipv6 ospf6 border-routers", "show ipv6 ospf6 border-routers [<A.B.C.D|detail>]",
SHOW_STR SHOW_STR
IP6_STR IP6_STR
OSPF6_STR OSPF6_STR
"Display routing table for ABR and ASBR\n" "Display routing table for ABR and ASBR\n"
) )
{ {
/* CHECK ME argc referenced below */ int idx_ipv4 = 4;
u_int32_t adv_router; u_int32_t adv_router;
void (*showfunc) (struct vty *, struct ospf6_route *);
struct ospf6_route *ro; struct ospf6_route *ro;
struct prefix prefix; struct prefix prefix;
OSPF6_CMD_CHECK_RUNNING (); OSPF6_CMD_CHECK_RUNNING ();
if (argc && ! strcmp ("detail", argv[4]->arg)) if (argc == 5)
{ {
showfunc = ospf6_route_show_detail; if (strmatch (argv[idx_ipv4]->text, "detail"))
argc--; {
argv++; for (ro = ospf6_route_head (ospf6->brouter_table); ro;
ro = ospf6_route_next (ro))
ospf6_route_show_detail (vty, ro);
} }
else else
showfunc = ospf6_brouter_show;
if (argc)
{ {
if ((inet_pton (AF_INET, argv[4]->arg, &adv_router)) != 1) inet_pton (AF_INET, argv[idx_ipv4]->arg, &adv_router);
{
vty_out (vty, "Router ID is not parsable: %s%s", argv[4]->arg, VNL);
return CMD_SUCCESS;
}
ospf6_linkstate_prefix (adv_router, 0, &prefix); ospf6_linkstate_prefix (adv_router, 0, &prefix);
ro = ospf6_route_lookup (&prefix, ospf6->brouter_table); ro = ospf6_route_lookup (&prefix, ospf6->brouter_table);
@ -1666,13 +1320,15 @@ DEFUN (show_ipv6_ospf6_border_routers,
ospf6_route_show_detail (vty, ro); ospf6_route_show_detail (vty, ro);
return CMD_SUCCESS; return CMD_SUCCESS;
} }
}
if (showfunc == ospf6_brouter_show) else
{
ospf6_brouter_show_header (vty); ospf6_brouter_show_header (vty);
for (ro = ospf6_route_head (ospf6->brouter_table); ro; for (ro = ospf6_route_head (ospf6->brouter_table); ro;
ro = ospf6_route_next (ro)) ro = ospf6_route_next (ro))
(*showfunc) (vty, ro); ospf6_brouter_show (vty, ro);
}
return CMD_SUCCESS; return CMD_SUCCESS;
} }