From d7fa34c1bc00b5704fefd0dc1cafc1bd314a3ea9 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Tue, 8 Nov 2016 01:46:04 +0000 Subject: [PATCH] all: Fix underfull doc strings, part 2 Add missing docstrings and separating \n. Also eat some low-hanging refactoring fruit. Signed-off-by: Quentin Young --- bgpd/bgp_bfd.c | 3 +- bgpd/bgp_routemap.c | 14 +++++++-- bgpd/bgp_vty.c | 66 +++++++++++++++++++++++++----------------- isisd/isisd.c | 1 + ospf6d/ospf6_area.c | 6 ++-- pimd/pim_cmd.c | 1 + zebra/irdp_interface.c | 2 ++ zebra/zebra_vty.c | 7 +++-- 8 files changed, 66 insertions(+), 34 deletions(-) diff --git a/bgpd/bgp_bfd.c b/bgpd/bgp_bfd.c index 684694d0bc..670d959fe5 100644 --- a/bgpd/bgp_bfd.c +++ b/bgpd/bgp_bfd.c @@ -619,7 +619,8 @@ DEFUN_HIDDEN (neighbor_bfd_type, NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Enables BFD support\n" - "Session type\n") + "Multihop session\n" + "Single hop session\n") { int idx_peer = 1; int idx_hop = 3; diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index 1ddae3cd88..0701415146 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -3490,7 +3490,8 @@ DEFUN (no_set_community, "no set community AA:NN...", NO_STR SET_STR - "BGP community attribute\n") + "BGP community attribute\n" + COMMUNITY_VAL_STR) { return generic_set_delete (vty, vty->index, "community", NULL); } @@ -3525,7 +3526,11 @@ DEFUN (no_set_community_delete, "no set comm-list [<(1-99)|(100-500)|WORD> delete]", NO_STR SET_STR - "set BGP community list (for deletion)\n") + "set BGP community list (for deletion)\n" + "Community-list number (standard)\n" + "Community-list number (expanded)\n" + "Community-list name\n" + "Delete matching communities\n") { return generic_set_delete (vty, vty->index, "comm-list", NULL); } @@ -3619,7 +3624,10 @@ DEFUN (no_set_origin, "no set origin []", NO_STR SET_STR - "BGP origin code\n") + "BGP origin code\n" + "remote EGP\n" + "local IGP\n" + "unknown heritage\n") { return generic_set_delete (vty, vty->index, "origin", NULL); } diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index f222161952..f9d845dcd1 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -1307,6 +1307,7 @@ DEFUN (bgp_wpkt_quanta, DEFUN (no_bgp_wpkt_quanta, no_bgp_wpkt_quanta_cmd, "no write-quanta (1-10000)", + NO_STR "How many packets to write to peer socket per run\n" "Number of packets\n") { @@ -2380,26 +2381,29 @@ DEFUN (bgp_listen_range, bgp_listen_range_cmd, "bgp listen range peer-group WORD", "BGP specific commands\n" - "Configure BGP Dynamic Neighbors\n" - "add a listening range for Dynamic Neighbors\n" + "Configure BGP dynamic neighbors listen range\n" + "Configure BGP dynamic neighbors listen range\n" NEIGHBOR_ADDR_STR "Member of the peer-group\n" "Peer-group name\n") { - int idx_ipv4_ipv6_prefixlen = 3; - int idx_word = 5; struct bgp *bgp; struct prefix range; struct peer_group *group, *existing_group; afi_t afi; int ret; + int idx = 0; - bgp = vty->index; + argv_find (argv, argc, "A.B.C.D/M", &idx); + argv_find (argv, argc, "X:X::X:X/M", &idx); + char *prefix = argv[idx]->arg; + argv_find (argv, argc, "WORD", &idx); + char *peergroup = argv[idx]->arg; - //VTY_GET_IPV4_PREFIX ("listen range", range, argv[idx_ipv4_ipv6_prefixlen]->arg); + bgp = vty->index; /* Convert IP prefix string to struct prefix. */ - ret = str2prefix (argv[idx_ipv4_ipv6_prefixlen]->arg, &range); + ret = str2prefix (prefix, &range); if (! ret) { vty_out (vty, "%% Malformed listen range%s", VTY_NEWLINE); @@ -2408,14 +2412,12 @@ DEFUN (bgp_listen_range, afi = family2afi(range.family); -#ifdef HAVE_IPV6 if (afi == AFI_IP6 && IN6_IS_ADDR_LINKLOCAL (&range.u.prefix6)) { vty_out (vty, "%% Malformed listen range (link-local address)%s", VTY_NEWLINE); return CMD_WARNING; } -#endif /* HAVE_IPV6 */ apply_mask (&range); @@ -2423,7 +2425,7 @@ DEFUN (bgp_listen_range, existing_group = listen_range_exists (bgp, &range, 1); if (existing_group) { - if (strcmp (existing_group->name, argv[idx_word]->arg) == 0) + if (strcmp (existing_group->name, peergroup) == 0) return CMD_SUCCESS; else { @@ -2441,7 +2443,7 @@ DEFUN (bgp_listen_range, return CMD_WARNING; } - group = peer_group_lookup (bgp, argv[idx_word]->arg); + group = peer_group_lookup (bgp, peergroup); if (! group) { vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); @@ -2454,26 +2456,34 @@ DEFUN (bgp_listen_range, DEFUN (no_bgp_listen_range, no_bgp_listen_range_cmd, - "no bgp listen range A.B.C.D/M peer-group WORD", + "no bgp listen range peer-group WORD", + NO_STR "BGP specific commands\n" - "Configure BGP defaults\n" - "delete a listening range for Dynamic Neighbors\n" - "Remove Dynamic Neighbors listening range\n") + "Unconfigure BGP dynamic neighbors listen range\n" + "Unconfigure BGP dynamic neighbors listen range\n" + NEIGHBOR_ADDR_STR + "Member of the peer-group\n" + "Peer-group name\n") { - int idx_ipv4_prefixlen = 4; - int idx_word = 6; struct bgp *bgp; struct prefix range; struct peer_group *group; afi_t afi; int ret; + int idx = 0; + + argv_find (argv, argc, "A.B.C.D/M", &idx); + argv_find (argv, argc, "X:X::X:X/M", &idx); + char *prefix = argv[idx]->arg; + argv_find (argv, argc, "WORD", &idx); + char *peergroup = argv[idx]->arg; bgp = vty->index; // VTY_GET_IPV4_PREFIX ("listen range", range, argv[idx_ipv4_prefixlen]->arg); /* Convert IP prefix string to struct prefix. */ - ret = str2prefix (argv[idx_ipv4_prefixlen]->arg, &range); + ret = str2prefix (prefix, &range); if (! ret) { vty_out (vty, "%% Malformed listen range%s", VTY_NEWLINE); @@ -2482,19 +2492,16 @@ DEFUN (no_bgp_listen_range, afi = family2afi(range.family); -#ifdef HAVE_IPV6 if (afi == AFI_IP6 && IN6_IS_ADDR_LINKLOCAL (&range.u.prefix6)) { vty_out (vty, "%% Malformed listen range (link-local address)%s", VTY_NEWLINE); return CMD_WARNING; } -#endif /* HAVE_IPV6 */ apply_mask (&range); - - group = peer_group_lookup (bgp, argv[idx_word]->arg); + group = peer_group_lookup (bgp, peergroup); if (! group) { vty_out (vty, "%% Peer-group does not exist%s", VTY_NEWLINE); @@ -2643,7 +2650,9 @@ DEFUN (neighbor_remote_as, NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Specify a BGP neighbor\n" - AS_STR) + AS_STR + "External BGP peer\n" + "Internal BGP peer\n") { int idx_peer = 1; int idx_remote_as = 3; @@ -2800,7 +2809,9 @@ DEFUN (neighbor_interface_config_remote_as, NEIGHBOR_STR "Interface name or neighbor tag\n" "Enable BGP on interface\n" - AS_STR) + AS_STR + "External BGP peer\n" + "Internal BGP peer\n") { int idx_word = 1; int idx_remote_as = 4; @@ -2814,7 +2825,9 @@ DEFUN (neighbor_interface_v6only_config_remote_as, NEIGHBOR_STR "Interface name or neighbor tag\n" "Enable BGP on interface\n" - AS_STR) + AS_STR + "External BGP peer\n" + "Internal BGP peer\n") { int idx_word = 1; int idx_remote_as = 5; @@ -5409,7 +5422,8 @@ DEFUN (neighbor_ttl_security, NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "BGP ttl-security parameters\n" - "Specify the maximum number of hops to the BGP peer\n") + "Specify the maximum number of hops to the BGP peer\n" + "Number of hops to BGP peer\n") { int idx_peer = 1; int idx_number = 4; diff --git a/isisd/isisd.c b/isisd/isisd.c index ff3d9c791b..c3bc33eb22 100644 --- a/isisd/isisd.c +++ b/isisd/isisd.c @@ -1906,6 +1906,7 @@ DEFUN (log_adj_changes, DEFUN (no_log_adj_changes, no_log_adj_changes_cmd, "no log-adjacency-changes", + NO_STR "Stop logging changes in adjacency state\n") { VTY_DECLVAR_CONTEXT (isis_area, area); diff --git a/ospf6d/ospf6_area.c b/ospf6d/ospf6_area.c index de395e8b57..9ba7287656 100644 --- a/ospf6d/ospf6_area.c +++ b/ospf6d/ospf6_area.c @@ -898,9 +898,11 @@ DEFUN (show_ipv6_ospf6_simulate_spf_tree_root, SHOW_STR IP6_STR OSPF6_STR - "Shortest Path First caculation\n" + "Shortest Path First calculation\n" "Show SPF tree\n" - "Specify root's router-id to calculate another router's SPF tree\n") + "Specify root's router-id to calculate another router's SPF tree\n" + "OSPF6 area parameters\n" + OSPF6_AREA_ID_STR) { int idx_ipv4 = 5; int idx_ipv4_2 = 7; diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index 318bd1ba1c..afc42a9561 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -3189,6 +3189,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_STR IP_STR PIM_STR "Revert the Designated Router Priority to default\n" diff --git a/zebra/irdp_interface.c b/zebra/irdp_interface.c index 3e244f5af3..fde759df98 100644 --- a/zebra/irdp_interface.c +++ b/zebra/irdp_interface.c @@ -415,6 +415,7 @@ DEFUN (ip_irdp_shutdown, ip_irdp_shutdown_cmd, "ip irdp shutdown", IP_STR + "ICMP Router discovery on this interface\n" "ICMP Router discovery shutdown on this interface\n") { VTY_DECLVAR_CONTEXT (interface, ifp); @@ -428,6 +429,7 @@ DEFUN (no_ip_irdp_shutdown, "no ip irdp shutdown", NO_STR IP_STR + "ICMP Router discovery on this interface\n" "ICMP Router discovery no shutdown on this interface\n") { VTY_DECLVAR_CONTEXT (interface, ifp); diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 667dfd031a..05356b3d0a 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -230,6 +230,7 @@ DEFUN (ip_mroute_dist, DEFUN (no_ip_mroute_dist, no_ip_mroute_dist_cmd, "no ip mroute A.B.C.D/M [(1-255)]", + NO_STR IP_STR "Configure static unicast route into MRIB for multicast RPF lookup\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -1195,7 +1196,8 @@ DEFUN (show_ip_route, "show ip route [json]", SHOW_STR IP_STR - "IP routing table\n") + "IP routing table\n" + "JavaScript Object Notation\n") { return do_show_ip_route (vty, VRF_DEFAULT_NAME, SAFI_UNICAST, use_json(argc, argv)); } @@ -1290,7 +1292,8 @@ DEFUN (show_ip_route_vrf, SHOW_STR IP_STR "IP routing table\n" - VRF_CMD_HELP_STR) + VRF_CMD_HELP_STR + "JavaScript Object Notation\n") { int idx_vrf = 4; u_char uj = use_json(argc, argv); -- 2.39.5