Skip to content

Commit

Permalink
ospf6d: scrubbed some argc CHECK MEs
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
  • Loading branch information
Daniel Walton committed Sep 30, 2016
1 parent 14b1648 commit 093d7a3
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 348 deletions.
41 changes: 9 additions & 32 deletions ospf6d/ospf6_area.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,44 +433,21 @@ ospf6_area_show (struct vty *vty, struct ospf6_area *oa)
oa = ospf6_area_get (area_id, ospf6); \
}

/*
* CHECK ME - The following ALIASes need to be implemented in this DEFUN
* "area (A.B.C.D|<0-4294967295>) range X:X::X:X/M advertise cost <0-16777215>",
* "OSPF area parameters\n"
* OSPF6_AREA_ID_STR
* "Summarize routes matching address/mask (border routers only)\n"
* "Area range prefix\n"
* "User specified metric for this range\n"
* "Advertised metric for this range\n"
*
* "area A.B.C.D range X:X::X:X/M (advertise|not-advertise)",
* "OSPF area parameters\n"
* OSPF6_AREA_ID_STR
* "Configured address range\n"
* "Specify IPv6 prefix\n"
*
*
* "area (A.B.C.D|<0-4294967295>) range X:X::X:X/M cost <0-16777215>",
* "OSPF area parameters\n"
* OSPF6_AREA_ID_STR
* "Summarize routes matching address/mask (border routers only)\n"
* "Area range prefix\n"
* "User specified metric for this range\n"
* "Advertised metric for this range\n"
*
*/
DEFUN (area_range,
area_range_cmd,
"area A.B.C.D range X:X::X:X/M",
"area <A.B.C.D|(0-4294967295) range X:X::X:X/M [<advertise|not-advertise|cost (0-16777215)>]",
"OSPF area parameters\n"
OSPF6_AREA_ID_STR
"Configured address range\n"
"Specify IPv6 prefix\n"
)
"Advertise\n"
"Do not advertise\n"
"User specified metric for this range\n"
"Advertised metric for this range\n")
{
/* CHECK ME argc referenced below */
int idx_ipv4 = 1;
int idx_ipv6_prefixlen = 3;
int idx_type = 4;
int ret;
struct ospf6_area *oa;
struct prefix prefix;
Expand Down Expand Up @@ -498,13 +475,13 @@ DEFUN (area_range,
(u_int32_t) htonl(ospf6_new_range_ls_id (oa->range_table));
}

if (argc > 2)
if (argc > idx_type)
{
if (strcmp (argv[4]->arg, "not-advertise") == 0)
if (strmatch (argv[idx_type]->text, "not-advertise"))
{
SET_FLAG (range->flag, OSPF6_ROUTE_DO_NOT_ADVERTISE);
}
else if (strcmp (argv[4]->arg, "advertise") == 0)
else if (strmatch (argv[idx_type]->text, "advertise"))
{
UNSET_FLAG (range->flag, OSPF6_ROUTE_DO_NOT_ADVERTISE);
}
Expand Down
81 changes: 15 additions & 66 deletions ospf6d/ospf6_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -1019,46 +1019,22 @@ DEFUN (show_ipv6_ospf6_interface,
return CMD_SUCCESS;
}


/*
* CHECK ME - The following ALIASes need to be implemented in this DEFUN
* "show ipv6 ospf6 interface IFNAME prefix (X:X::X:X|X:X::X:X/M|detail)",
* SHOW_STR
* IP6_STR
* OSPF6_STR
* INTERFACE_STR
* IFNAME_STR
* "Display connected prefixes to advertise\n"
* OSPF6_ROUTE_ADDRESS_STR
* OSPF6_ROUTE_PREFIX_STR
* "Display details of the prefixes\n"
*
*
* "show ipv6 ospf6 interface IFNAME prefix X:X::X:X/M (match|detail)",
* SHOW_STR
* IP6_STR
* OSPF6_STR
* INTERFACE_STR
* IFNAME_STR
* "Display connected prefixes to advertise\n"
* OSPF6_ROUTE_PREFIX_STR
* OSPF6_ROUTE_MATCH_STR
* "Display details of the prefixes\n"
*
*
*/
DEFUN (show_ipv6_ospf6_interface_ifname_prefix,
show_ipv6_ospf6_interface_ifname_prefix_cmd,
"show ipv6 ospf6 interface IFNAME prefix",
"show ipv6 ospf6 interface IFNAME prefix [<X:X::X:X|X:X::X:X/M>] [<match|detail>]",
SHOW_STR
IP6_STR
OSPF6_STR
INTERFACE_STR
IFNAME_STR
"Display connected prefixes to advertise\n")
"Display connected prefixes to advertise\n"
OSPF6_ROUTE_ADDRESS_STR
OSPF6_ROUTE_PREFIX_STR
OSPF6_ROUTE_MATCH_STR
"Display details of the prefixes\n")
{
/* CHECK ME argc referenced below */
int idx_ifname = 4;
int idx_prefix = 6;
struct interface *ifp;
struct ospf6_interface *oi;

Expand All @@ -1076,49 +1052,25 @@ DEFUN (show_ipv6_ospf6_interface_ifname_prefix,
return CMD_WARNING;
}

ospf6_route_table_show (vty, 6, argc, argv, oi->route_connected);
ospf6_route_table_show (vty, idx_prefix, argc, argv, oi->route_connected);

return CMD_SUCCESS;
}



/*
* CHECK ME - The following ALIASes need to be implemented in this DEFUN
* "show ipv6 ospf6 interface prefix X:X::X:X/M (match|detail)",
* SHOW_STR
* IP6_STR
* OSPF6_STR
* INTERFACE_STR
* "Display connected prefixes to advertise\n"
* OSPF6_ROUTE_PREFIX_STR
* OSPF6_ROUTE_MATCH_STR
* "Display details of the prefixes\n"
*
*
* "show ipv6 ospf6 interface prefix (X:X::X:X|X:X::X:X/M|detail)",
* SHOW_STR
* IP6_STR
* OSPF6_STR
* INTERFACE_STR
* "Display connected prefixes to advertise\n"
* OSPF6_ROUTE_ADDRESS_STR
* OSPF6_ROUTE_PREFIX_STR
* "Display details of the prefixes\n"
*
*
*/
DEFUN (show_ipv6_ospf6_interface_prefix,
show_ipv6_ospf6_interface_prefix_cmd,
"show ipv6 ospf6 interface prefix",
"show ipv6 ospf6 interface prefix [<X:X::X:X|X:X::X:X/M>] [<match|detail>]",
SHOW_STR
IP6_STR
OSPF6_STR
INTERFACE_STR
"Display connected prefixes to advertise\n"
)
OSPF6_ROUTE_ADDRESS_STR
OSPF6_ROUTE_PREFIX_STR
OSPF6_ROUTE_MATCH_STR
"Display details of the prefixes\n")
{
/* CHECK ME argc referenced below */
int idx_prefix = 5;
struct listnode *i;
struct ospf6_interface *oi;
struct interface *ifp;
Expand All @@ -1129,15 +1081,12 @@ DEFUN (show_ipv6_ospf6_interface_prefix,
if (oi == NULL)
continue;

ospf6_route_table_show (vty, 5, argc, argv, oi->route_connected);
ospf6_route_table_show (vty, idx_prefix, argc, argv, oi->route_connected);
}

return CMD_SUCCESS;
}




/* interface variable set command */
DEFUN (ipv6_ospf6_ifmtu,
ipv6_ospf6_ifmtu_cmd,
Expand Down
5 changes: 3 additions & 2 deletions ospf6d/ospf6_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -1473,7 +1473,8 @@ ospf6_linkstate_show_table (struct vty *vty, int detail,
}

int
ospf6_linkstate_table_show (struct vty *vty, int argc, struct cmd_token **argv,
ospf6_linkstate_table_show (struct vty *vty, int idx_ipv4, int argc,
struct cmd_token **argv,
struct ospf6_route_table *table)
{
int detail = 0;
Expand All @@ -1486,7 +1487,7 @@ ospf6_linkstate_table_show (struct vty *vty, int argc, struct cmd_token **argv,
memset (&id, 0, sizeof (struct prefix));
memset (&prefix, 0, sizeof (struct prefix));

for (i = 0; i < argc; i++)
for (i = idx_ipv4; i < argc; i++)
{
if (! strcmp (argv[i]->arg, "detail"))
{
Expand Down
Loading

0 comments on commit 093d7a3

Please sign in to comment.