diff options
| -rw-r--r-- | bgpd/bgp_aspath.c | 2 | ||||
| -rw-r--r-- | bgpd/bgp_bfd.c | 3 | ||||
| -rw-r--r-- | bgpd/bgp_dump.c | 4 | ||||
| -rw-r--r-- | bgpd/bgp_ecommunity.c | 2 | ||||
| -rw-r--r-- | bgpd/bgp_encap.c | 48 | ||||
| -rw-r--r-- | bgpd/bgp_mplsvpn.c | 42 | ||||
| -rw-r--r-- | bgpd/bgp_nexthop.c | 3 | ||||
| -rw-r--r-- | bgpd/bgp_route.c | 94 | ||||
| -rw-r--r-- | bgpd/bgp_routemap.c | 6 | ||||
| -rw-r--r-- | bgpd/bgp_updgrp_adv.c | 2 | ||||
| -rw-r--r-- | bgpd/bgp_vty.c | 168 | ||||
| -rw-r--r-- | isisd/isis_vty.c | 100 | ||||
| -rw-r--r-- | isisd/isisd.c | 59 | ||||
| -rw-r--r-- | lib/.gitignore | 1 | ||||
| -rw-r--r-- | lib/command_match.c | 233 | ||||
| -rw-r--r-- | lib/routemap.c | 1 | ||||
| -rw-r--r-- | ospf6d/ospf6_area.c | 11 | ||||
| -rw-r--r-- | ospf6d/ospf6_lsa.c | 14 | ||||
| -rw-r--r-- | ospf6d/ospf6_top.c | 3 | ||||
| -rw-r--r-- | ospf6d/ospf6d.c | 8 | ||||
| -rw-r--r-- | ospfd/ospf_te.c | 3 | ||||
| -rw-r--r-- | ospfd/ospf_vty.c | 108 | ||||
| -rw-r--r-- | ripngd/ripngd.c | 1 | ||||
| -rw-r--r-- | tests/test-cli.c | 2 | ||||
| -rw-r--r-- | tests/testcli.in | 5 | ||||
| -rw-r--r-- | tests/testcli.refout | 23 | ||||
| -rwxr-xr-x | tools/cmd_check.py | 102 | ||||
| -rw-r--r-- | zebra/irdp_interface.c | 32 | ||||
| -rw-r--r-- | zebra/rtadv.c | 1 | ||||
| -rw-r--r-- | zebra/zebra_mpls_vty.c | 4 | ||||
| -rw-r--r-- | zebra/zebra_routemap.c | 16 | ||||
| -rw-r--r-- | zebra/zebra_vty.c | 10 |
32 files changed, 601 insertions, 510 deletions
diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c index bdafe5a0cb..2e78c9a3bf 100644 --- a/bgpd/bgp_aspath.c +++ b/bgpd/bgp_aspath.c @@ -2181,7 +2181,7 @@ aspath_show_all_iterator (struct hash_backet *backet, struct vty *vty) } /* Print all aspath and hash information. This function is used from - `show ip bgp paths' command. */ + `show [ip] bgp paths' command. */ void aspath_print_all_vty (struct vty *vty) { diff --git a/bgpd/bgp_bfd.c b/bgpd/bgp_bfd.c index 670d959fe5..f2393dedd9 100644 --- a/bgpd/bgp_bfd.c +++ b/bgpd/bgp_bfd.c @@ -680,7 +680,8 @@ DEFUN_HIDDEN (no_neighbor_bfd_type, NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Disables BFD support\n" - "Session type\n") + "Multihop session\n" + "Singlehop session\n") { int idx_peer = 2; struct peer *peer; diff --git a/bgpd/bgp_dump.c b/bgpd/bgp_dump.c index 511eb34028..add653193c 100644 --- a/bgpd/bgp_dump.c +++ b/bgpd/bgp_dump.c @@ -792,7 +792,9 @@ DEFUN (no_dump_bgp_all, "Stop dump process all-et\n" "Stop dump process updates\n" "Stop dump process updates-et\n" - "Stop dump process route-mrt\n") + "Stop dump process route-mrt\n" + "Output filename\n" + "Interval of output\n") { int idx_dump_routes = 3; int bgp_dump_type = 0; diff --git a/bgpd/bgp_ecommunity.c b/bgpd/bgp_ecommunity.c index 6c72aa36d9..9138c72802 100644 --- a/bgpd/bgp_ecommunity.c +++ b/bgpd/bgp_ecommunity.c @@ -584,7 +584,7 @@ ecommunity_str2com (const char *str, int type, int keyword_included) extcommunity-list "rt 100:1 rt 100:2 soo 100:3" - "show ip bgp" and extcommunity-list regular expression matching + "show [ip] bgp" and extcommunity-list regular expression matching "RT:100:1 RT:100:2 SoO:100:3" For each formath please use below definition for format: diff --git a/bgpd/bgp_encap.c b/bgpd/bgp_encap.c index dd35bb2c3c..4ea2f9cde7 100644 --- a/bgpd/bgp_encap.c +++ b/bgpd/bgp_encap.c @@ -475,8 +475,9 @@ bgp_show_encap ( DEFUN (show_bgp_ipv4_encap, show_bgp_ipv4_encap_cmd, - "show bgp ipv4 encap", + "show [ip] bgp ipv4 encap", SHOW_STR + IP_STR BGP_STR "Address Family\n" "Display ENCAP NLRI specific information\n") @@ -486,8 +487,9 @@ DEFUN (show_bgp_ipv4_encap, #ifdef HAVE_IPV6 DEFUN (show_bgp_ipv6_encap, show_bgp_ipv6_encap_cmd, - "show bgp ipv6 encap", + "show [ip] bgp ipv6 encap", SHOW_STR + IP_STR BGP_STR "Address Family\n" "Display ENCAP NLRI specific information\n") @@ -498,8 +500,9 @@ DEFUN (show_bgp_ipv6_encap, DEFUN (show_bgp_ipv4_encap_rd, show_bgp_ipv4_encap_rd_cmd, - "show bgp ipv4 encap rd ASN:nn_or_IP-address:nn", + "show [ip] bgp ipv4 encap rd ASN:nn_or_IP-address:nn", SHOW_STR + IP_STR BGP_STR "Address Family\n" "Display ENCAP NLRI specific information\n" @@ -521,8 +524,9 @@ DEFUN (show_bgp_ipv4_encap_rd, #ifdef HAVE_IPV6 DEFUN (show_bgp_ipv6_encap_rd, show_bgp_ipv6_encap_rd_cmd, - "show bgp ipv6 encap rd ASN:nn_or_IP-address:nn", + "show [ip] bgp ipv6 encap rd ASN:nn_or_IP-address:nn", SHOW_STR + IP_STR BGP_STR "Address Family\n" "Display ENCAP NLRI specific information\n" @@ -546,8 +550,9 @@ DEFUN (show_bgp_ipv6_encap_rd, DEFUN (show_bgp_ipv4_encap_tags, show_bgp_ipv4_encap_tags_cmd, - "show bgp ipv4 encap tags", + "show [ip] bgp ipv4 encap tags", SHOW_STR + IP_STR BGP_STR "Address Family\n" "Display ENCAP NLRI specific information\n" @@ -558,8 +563,9 @@ DEFUN (show_bgp_ipv4_encap_tags, #ifdef HAVE_IPV6 DEFUN (show_bgp_ipv6_encap_tags, show_bgp_ipv6_encap_tags_cmd, - "show bgp ipv6 encap tags", + "show [ip] bgp ipv6 encap tags", SHOW_STR + IP_STR BGP_STR "Address Family\n" "Display ENCAP NLRI specific information\n" @@ -571,8 +577,9 @@ DEFUN (show_bgp_ipv6_encap_tags, DEFUN (show_bgp_ipv4_encap_rd_tags, show_bgp_ipv4_encap_rd_tags_cmd, - "show bgp ipv4 encap rd ASN:nn_or_IP-address:nn tags", + "show [ip] bgp ipv4 encap rd ASN:nn_or_IP-address:nn tags", SHOW_STR + IP_STR BGP_STR "Address Family\n" "Display ENCAP NLRI specific information\n" @@ -595,8 +602,9 @@ DEFUN (show_bgp_ipv4_encap_rd_tags, #ifdef HAVE_IPV6 DEFUN (show_bgp_ipv6_encap_rd_tags, show_bgp_ipv6_encap_rd_tags_cmd, - "show bgp ipv6 encap rd ASN:nn_or_IP-address:nn tags", + "show [ip] bgp ipv6 encap rd ASN:nn_or_IP-address:nn tags", SHOW_STR + IP_STR BGP_STR "Address Family\n" "Display ENCAP NLRI specific information\n" @@ -620,8 +628,9 @@ DEFUN (show_bgp_ipv6_encap_rd_tags, DEFUN (show_bgp_ipv4_encap_neighbor_routes, show_bgp_ipv4_encap_neighbor_routes_cmd, - "show bgp ipv4 encap neighbors A.B.C.D routes", + "show [ip] bgp ipv4 encap neighbors A.B.C.D routes", SHOW_STR + IP_STR BGP_STR "Address Family\n" "Display ENCAP NLRI specific information\n" @@ -651,8 +660,9 @@ DEFUN (show_bgp_ipv4_encap_neighbor_routes, #ifdef HAVE_IPV6 DEFUN (show_bgp_ipv6_encap_neighbor_routes, show_bgp_ipv6_encap_neighbor_routes_cmd, - "show bgp ipv6 encap neighbors A.B.C.D routes", + "show [ip] bgp ipv6 encap neighbors A.B.C.D routes", SHOW_STR + IP_STR BGP_STR "Address Family\n" "Display ENCAP NLRI specific information\n" @@ -683,8 +693,9 @@ DEFUN (show_bgp_ipv6_encap_neighbor_routes, DEFUN (show_bgp_ipv4_encap_rd_neighbor_routes, show_bgp_ipv4_encap_rd_neighbor_routes_cmd, - "show bgp ipv4 encap rd ASN:nn_or_IP-address:nn neighbors <A.B.C.D|X:X::X:X> routes", + "show [ip] bgp ipv4 encap rd ASN:nn_or_IP-address:nn neighbors <A.B.C.D|X:X::X:X> routes", SHOW_STR + IP_STR BGP_STR "Address Family\n" "Display ENCAP NLRI specific information\n" @@ -727,8 +738,9 @@ DEFUN (show_bgp_ipv4_encap_rd_neighbor_routes, #ifdef HAVE_IPV6 DEFUN (show_bgp_ipv6_encap_rd_neighbor_routes, show_bgp_ipv6_encap_rd_neighbor_routes_cmd, - "show bgp ipv6 encap rd ASN:nn_or_IP-address:nn neighbors <A.B.C.D|X:X::X:X> routes", + "show [ip] bgp ipv6 encap rd ASN:nn_or_IP-address:nn neighbors <A.B.C.D|X:X::X:X> routes", SHOW_STR + IP_STR BGP_STR "Address Family\n" "Display ENCAP NLRI specific information\n" @@ -772,8 +784,9 @@ DEFUN (show_bgp_ipv6_encap_rd_neighbor_routes, DEFUN (show_bgp_ipv4_encap_neighbor_advertised_routes, show_bgp_ipv4_encap_neighbor_advertised_routes_cmd, - "show bgp ipv4 encap neighbors A.B.C.D advertised-routes", + "show [ip] bgp ipv4 encap neighbors A.B.C.D advertised-routes", SHOW_STR + IP_STR BGP_STR "Address Family\n" "Display ENCAP NLRI specific information\n" @@ -804,8 +817,9 @@ DEFUN (show_bgp_ipv4_encap_neighbor_advertised_routes, #ifdef HAVE_IPV6 DEFUN (show_bgp_ipv6_encap_neighbor_advertised_routes, show_bgp_ipv6_encap_neighbor_advertised_routes_cmd, - "show bgp ipv6 encap neighbors A.B.C.D advertised-routes", + "show [ip] bgp ipv6 encap neighbors A.B.C.D advertised-routes", SHOW_STR + IP_STR BGP_STR "Address Family\n" "Display ENCAP NLRI specific information\n" @@ -837,8 +851,9 @@ DEFUN (show_bgp_ipv6_encap_neighbor_advertised_routes, DEFUN (show_bgp_ipv4_encap_rd_neighbor_advertised_routes, show_bgp_ipv4_encap_rd_neighbor_advertised_routes_cmd, - "show bgp ipv4 encap rd ASN:nn_or_IP-address:nn neighbors <A.B.C.D|X:X::X:X> advertised-routes", + "show [ip] bgp ipv4 encap rd ASN:nn_or_IP-address:nn neighbors <A.B.C.D|X:X::X:X> advertised-routes", SHOW_STR + IP_STR BGP_STR "Address Family\n" "Display ENCAP NLRI specific information\n" @@ -881,8 +896,9 @@ DEFUN (show_bgp_ipv4_encap_rd_neighbor_advertised_routes, #ifdef HAVE_IPV6 DEFUN (show_bgp_ipv6_encap_rd_neighbor_advertised_routes, show_bgp_ipv6_encap_rd_neighbor_advertised_routes_cmd, - "show bgp ipv6 encap rd ASN:nn_or_IP-address:nn neighbors <A.B.C.D|X:X::X:X> advertised-routes", + "show [ip] bgp ipv6 encap rd ASN:nn_or_IP-address:nn neighbors <A.B.C.D|X:X::X:X> advertised-routes", SHOW_STR + IP_STR BGP_STR "Address Family\n" "Display ENCAP NLRI specific information\n" diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 312a9f3727..c64c69dfca 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -897,30 +897,35 @@ bgp_show_mpls_vpn (struct vty *vty, afi_t afi, struct prefix_rd *prd, DEFUN (show_bgp_ivp4_vpn, show_bgp_ipv4_vpn_cmd, - "show bgp ipv4 vpn [json]", + "show [ip] bgp ipv4 vpn [json]", SHOW_STR + IP_STR BGP_STR "Address Family\n" - "Display VPN NLRI specific information\n") + "Display VPN NLRI specific information\n" + JSON_STR) { return bgp_show_mpls_vpn (vty, AFI_IP, NULL, bgp_show_type_normal, NULL, 0, use_json (argc, argv)); } DEFUN (show_bgp_ipv6_vpn, show_bgp_ipv6_vpn_cmd, - "show bgp ipv6 vpn [json]", + "show [ip] bgp ipv6 vpn [json]", SHOW_STR + IP_STR BGP_STR "Address Family\n" - "Display VPN NLRI specific information\n") + "Display VPN NLRI specific information\n" + JSON_STR) { return bgp_show_mpls_vpn (vty, AFI_IP6, NULL, bgp_show_type_normal, NULL, 0, use_json (argc, argv)); } DEFUN (show_bgp_ipv4_vpn_rd, show_bgp_ipv4_vpn_rd_cmd, - "show bgp ipv4 vpn rd ASN:nn_or_IP-address:nn [json]", + "show [ip] bgp ipv4 vpn rd ASN:nn_or_IP-address:nn [json]", SHOW_STR + IP_STR BGP_STR "Address Family\n" "Display VPN NLRI specific information\n" @@ -943,8 +948,9 @@ DEFUN (show_bgp_ipv4_vpn_rd, DEFUN (show_bgp_ipv6_vpn_rd, show_bgp_ipv6_vpn_rd_cmd, - "show bgp ipv6 vpn rd ASN:nn_or_IP-address:nn [json]", + "show [ip] bgp ipv6 vpn rd ASN:nn_or_IP-address:nn [json]", SHOW_STR + IP_STR BGP_STR "Address Family\n" "Display VPN NLRI specific information\n" @@ -968,7 +974,7 @@ DEFUN (show_bgp_ipv6_vpn_rd, DEFUN (show_ip_bgp_vpnv4_all, show_ip_bgp_vpnv4_all_cmd, - "show ip bgp vpnv4 all", + "show [ip] bgp vpnv4 all", SHOW_STR IP_STR BGP_STR @@ -980,7 +986,7 @@ DEFUN (show_ip_bgp_vpnv4_all, DEFUN (show_ip_bgp_vpnv4_rd, show_ip_bgp_vpnv4_rd_cmd, - "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn", + "show [ip] bgp vpnv4 rd ASN:nn_or_IP-address:nn", SHOW_STR IP_STR BGP_STR @@ -1003,7 +1009,7 @@ DEFUN (show_ip_bgp_vpnv4_rd, DEFUN (show_ip_bgp_vpnv4_all_tags, show_ip_bgp_vpnv4_all_tags_cmd, - "show ip bgp vpnv4 all tags", + "show [ip] bgp vpnv4 all tags", SHOW_STR IP_STR BGP_STR @@ -1016,7 +1022,7 @@ DEFUN (show_ip_bgp_vpnv4_all_tags, DEFUN (show_ip_bgp_vpnv4_rd_tags, show_ip_bgp_vpnv4_rd_tags_cmd, - "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn tags", + "show [ip] bgp vpnv4 rd ASN:nn_or_IP-address:nn tags", SHOW_STR IP_STR BGP_STR @@ -1040,7 +1046,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_tags, DEFUN (show_ip_bgp_vpnv4_all_neighbor_routes, show_ip_bgp_vpnv4_all_neighbor_routes_cmd, - "show ip bgp vpnv4 all neighbors A.B.C.D routes [json]", + "show [ip] bgp vpnv4 all neighbors A.B.C.D routes [json]", SHOW_STR IP_STR BGP_STR @@ -1049,7 +1055,7 @@ DEFUN (show_ip_bgp_vpnv4_all_neighbor_routes, "Detailed information on TCP and BGP neighbor connections\n" "Neighbor to display information about\n" "Display routes learned from neighbor\n" - "JavaScript Object Notation\n") + JSON_STR) { int idx_ipv4 = 6; union sockunion su; @@ -1094,7 +1100,7 @@ DEFUN (show_ip_bgp_vpnv4_all_neighbor_routes, DEFUN (show_ip_bgp_vpnv4_rd_neighbor_routes, show_ip_bgp_vpnv4_rd_neighbor_routes_cmd, - "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D routes [json]", + "show [ip] bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D routes [json]", SHOW_STR IP_STR BGP_STR @@ -1104,7 +1110,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_routes, "Detailed information on TCP and BGP neighbor connections\n" "Neighbor to display information about\n" "Display routes learned from neighbor\n" - "JavaScript Object Notation\n") + JSON_STR) { int idx_ext_community = 5; int idx_ipv4 = 7; @@ -1167,7 +1173,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_routes, DEFUN (show_ip_bgp_vpnv4_all_neighbor_advertised_routes, show_ip_bgp_vpnv4_all_neighbor_advertised_routes_cmd, - "show ip bgp vpnv4 all neighbors A.B.C.D advertised-routes [json]", + "show [ip] bgp vpnv4 all neighbors A.B.C.D advertised-routes [json]", SHOW_STR IP_STR BGP_STR @@ -1176,7 +1182,7 @@ DEFUN (show_ip_bgp_vpnv4_all_neighbor_advertised_routes, "Detailed information on TCP and BGP neighbor connections\n" "Neighbor to display information about\n" "Display the routes advertised to a BGP neighbor\n" - "JavaScript Object Notation\n") + JSON_STR) { int idx_ipv4 = 6; int ret; @@ -1220,7 +1226,7 @@ DEFUN (show_ip_bgp_vpnv4_all_neighbor_advertised_routes, DEFUN (show_ip_bgp_vpnv4_rd_neighbor_advertised_routes, show_ip_bgp_vpnv4_rd_neighbor_advertised_routes_cmd, - "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D advertised-routes [json]", + "show [ip] bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D advertised-routes [json]", SHOW_STR IP_STR BGP_STR @@ -1230,7 +1236,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_advertised_routes, "Detailed information on TCP and BGP neighbor connections\n" "Neighbor to display information about\n" "Display the routes advertised to a BGP neighbor\n" - "JavaScript Object Notation\n") + JSON_STR) { int idx_ext_community = 5; int idx_ipv4 = 7; diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c index a77e92c17a..0a72d09228 100644 --- a/bgpd/bgp_nexthop.c +++ b/bgpd/bgp_nexthop.c @@ -505,7 +505,8 @@ DEFUN (show_ip_bgp_nexthop, IP_STR BGP_STR BGP_INSTANCE_HELP_STR - "BGP nexthop table\n") + "BGP nexthop table\n" + "Show detailed information\n") { int idx = 0; char *vrf = argv_find (argv, argc, "VRFNAME", &idx) ? argv[idx]->arg : NULL; diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index ade05a2c06..e53d4493eb 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -4492,6 +4492,7 @@ DEFUN (bgp_table_map, DEFUN (no_bgp_table_map, no_bgp_table_map_cmd, "no table-map WORD", + NO_STR "BGP table to RIB route download filter\n" "Name of the route map\n") { @@ -7897,7 +7898,7 @@ DEFUN (show_ip_bgp_ipv4, "Display route and more specific routes\n" "IPv6 prefix\n" "Display route and more specific routes\n" - "JavaScript Object Notation\n") + JSON_STR) { char *vrf = NULL; afi_t afi = AFI_IP6; @@ -8014,7 +8015,7 @@ DEFUN (show_ip_bgp_route, "IPv6 prefix\n" "Display only the bestpath\n" "Display only multipaths\n" - "JavaScript Object Notation\n") + JSON_STR) { int prefix_check = 0; @@ -8145,7 +8146,7 @@ DEFUN (show_ip_bgp_instance_all, "Address Family modifier\n" "Address Family\n" "Address Family modifier\n" - "JavaScript Object Notation\n") + JSON_STR) { afi_t afi = AFI_IP; safi_t safi = SAFI_UNICAST; @@ -8249,7 +8250,7 @@ bgp_show_filter_list (struct vty *vty, const char *name, DEFUN (show_ip_bgp_dampening_info, show_ip_bgp_dampening_params_cmd, - "show ip bgp dampening parameters", + "show [ip] bgp dampening parameters", SHOW_STR IP_STR BGP_STR @@ -8262,7 +8263,7 @@ DEFUN (show_ip_bgp_dampening_info, DEFUN (show_ip_bgp_ipv4_dampening_parameters, show_ip_bgp_ipv4_dampening_parameters_cmd, - "show ip bgp ipv4 <unicast|multicast> dampening parameters", + "show [ip] bgp ipv4 <unicast|multicast> dampening parameters", SHOW_STR IP_STR BGP_STR @@ -8824,8 +8825,9 @@ bgp_table_stats_vty (struct vty *vty, const char *name, DEFUN (show_bgp_statistics, show_bgp_statistics_cmd, - "show bgp <ipv4|ipv6> <encap|multicast|unicast|vpn> statistics", + "show [ip] bgp <ipv4|ipv6> <encap|multicast|unicast|vpn> statistics", SHOW_STR + IP_STR BGP_STR "Address Family\n" "Address Family\n" @@ -8842,8 +8844,9 @@ DEFUN (show_bgp_statistics, DEFUN (show_bgp_statistics_view, show_bgp_statistics_view_cmd, - "show bgp <view|vrf> WORD <ipv4|ipv6> <unicast|multicast|vpn|encap> statistics", + "show [ip] bgp <view|vrf> WORD <ipv4|ipv6> <unicast|multicast|vpn|encap> statistics", SHOW_STR + IP_STR BGP_STR BGP_INSTANCE_HELP_STR "Address Family\n" @@ -9052,16 +9055,16 @@ bgp_peer_counts (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi, u_c DEFUN (show_ip_bgp_neighbor_prefix_counts, show_ip_bgp_neighbor_prefix_counts_cmd, - "show ip bgp neighbors <A.B.C.D|X:X::X:X|WORD> prefix-counts [json]", + "show [ip] bgp neighbors <A.B.C.D|X:X::X:X|WORD> prefix-counts [json]", SHOW_STR IP_STR BGP_STR "Detailed information on TCP and BGP neighbor connections\n" "Neighbor to display information about\n" "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" + "Neighbor on BGP configured interface\n" "Display detailed prefix count information\n" - "JavaScript Object Notation\n") + JSON_STR) { int idx_peer = 4; struct peer *peer; @@ -9076,7 +9079,7 @@ DEFUN (show_ip_bgp_neighbor_prefix_counts, DEFUN (show_ip_bgp_instance_neighbor_prefix_counts, show_ip_bgp_instance_neighbor_prefix_counts_cmd, - "show ip bgp <view|vrf> WORD neighbors <A.B.C.D|X:X::X:X|WORD> prefix-counts [json]", + "show [ip] bgp <view|vrf> WORD neighbors <A.B.C.D|X:X::X:X|WORD> prefix-counts [json]", SHOW_STR IP_STR BGP_STR @@ -9084,9 +9087,9 @@ DEFUN (show_ip_bgp_instance_neighbor_prefix_counts, "Detailed information on TCP and BGP neighbor connections\n" "Neighbor to display information about\n" "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" + "Neighbor on BGP configured interface\n" "Display detailed prefix count information\n" - "JavaScript Object Notation\n") + JSON_STR) { int idx_word = 4; int idx_peer = 6; @@ -9102,16 +9105,17 @@ DEFUN (show_ip_bgp_instance_neighbor_prefix_counts, DEFUN (show_bgp_ipv6_neighbor_prefix_counts, show_bgp_ipv6_neighbor_prefix_counts_cmd, - "show bgp ipv6 neighbors <A.B.C.D|X:X::X:X|WORD> prefix-counts [json]", + "show [ip] bgp ipv6 neighbors <A.B.C.D|X:X::X:X|WORD> prefix-counts [json]", SHOW_STR + IP_STR BGP_STR "Address Family\n" "Detailed information on TCP and BGP neighbor connections\n" "Neighbor to display information about\n" "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" + "Neighbor on BGP configured interface\n" "Display detailed prefix count information\n" - "JavaScript Object Notation\n") + JSON_STR) { int idx_peer = 4; struct peer *peer; @@ -9126,17 +9130,18 @@ DEFUN (show_bgp_ipv6_neighbor_prefix_counts, DEFUN (show_bgp_instance_ipv6_neighbor_prefix_counts, show_bgp_instance_ipv6_neighbor_prefix_counts_cmd, - "show bgp <view|vrf> WORD ipv6 neighbors <A.B.C.D|X:X::X:X|WORD> prefix-counts [json]", + "show [ip] bgp <view|vrf> WORD ipv6 neighbors <A.B.C.D|X:X::X:X|WORD> prefix-counts [json]", SHOW_STR + IP_STR BGP_STR BGP_INSTANCE_HELP_STR "Address Family\n" "Detailed information on TCP and BGP neighbor connections\n" "Neighbor to display information about\n" "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" + "Neighbor on BGP configured interface\n" "Display detailed prefix count information\n" - "JavaScript Object Notation\n") + JSON_STR) { int idx_word = 3; int idx_peer = 6; @@ -9152,7 +9157,7 @@ DEFUN (show_bgp_instance_ipv6_neighbor_prefix_counts, DEFUN (show_ip_bgp_ipv4_neighbor_prefix_counts, show_ip_bgp_ipv4_neighbor_prefix_counts_cmd, - "show ip bgp ipv4 <unicast|multicast> neighbors <A.B.C.D|X:X::X:X|WORD> prefix-counts [json]", + "show [ip] bgp ipv4 <unicast|multicast> neighbors <A.B.C.D|X:X::X:X|WORD> prefix-counts [json]", SHOW_STR IP_STR BGP_STR @@ -9162,9 +9167,9 @@ DEFUN (show_ip_bgp_ipv4_neighbor_prefix_counts, "Detailed information on TCP and BGP neighbor connections\n" "Neighbor to display information about\n" "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" + "Neighbor on BGP configured interface\n" "Display detailed prefix count information\n" - "JavaScript Object Notation\n") + JSON_STR) { int idx_safi = 4; int idx_peer = 6; @@ -9183,19 +9188,18 @@ DEFUN (show_ip_bgp_ipv4_neighbor_prefix_counts, DEFUN (show_ip_bgp_vpnv4_neighbor_prefix_counts, show_ip_bgp_vpnv4_neighbor_prefix_counts_cmd, - "show ip bgp vpnv4 all neighbors <A.B.C.D|X:X::X:X|WORD> prefix-counts [json]", + "show [ip] bgp vpnv4 all neighbors <A.B.C.D|X:X::X:X|WORD> prefix-counts [json]", SHOW_STR IP_STR BGP_STR "Address Family\n" - "Address Family modifier\n" - "Address Family modifier\n" + "Display information about all VPNv4 NLRIs\n" "Detailed information on TCP and BGP neighbor connections\n" "Neighbor to display information about\n" "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" + "Neighbor on BGP configured interface\n" "Display detailed prefix count information\n" - "JavaScript Object Notation\n") + JSON_STR) { int idx_peer = 6; struct peer *peer; @@ -9208,6 +9212,25 @@ DEFUN (show_ip_bgp_vpnv4_neighbor_prefix_counts, return bgp_peer_counts (vty, peer, AFI_IP, SAFI_MPLS_VPN, uj); } +DEFUN (show_ip_bgp_vpnv4_all_route_prefix, + show_ip_bgp_vpnv4_all_route_prefix_cmd, + "show [ip] bgp vpnv4 all <A.B.C.D|A.B.C.D/M> [json]", + SHOW_STR + IP_STR + BGP_STR + "Address Family\n" + "Display information about all VPNv4 NLRIs\n" + "Network in the BGP routing table to display\n" + "Network in the BGP routing table to display\n" + JSON_STR) +{ + int idx = 0; + char *network = NULL; + network = argv_find (argv, argc, "A.B.C.D", &idx) ? argv[idx]->arg : NULL; + network = argv_find (argv, argc, "A.B.C.D/M", &idx) ? argv[idx]->arg : NULL; + return bgp_show_route (vty, NULL, network, AFI_IP, SAFI_MPLS_VPN, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); +} + static void show_adj_route (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi, int in, const char *rmap_name, u_char use_json, json_object *json) @@ -9450,7 +9473,7 @@ peer_adj_routes (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi, DEFUN (show_ip_bgp_instance_neighbor_advertised_route, show_ip_bgp_instance_neighbor_advertised_route_cmd, - "show [ip] bgp [<view|vrf>] WORD [<ipv4 [<unicast|multicast>]|ipv6 [<unicast|multicast>]|encap [unicast]|vpnv4 [unicast]>] neighbors <A.B.C.D|X:X::X:X|WORD> [<received-routes|advertised-routes> [route-map WORD]] [json]", + "show [ip] bgp [<view|vrf> WORD] [<ipv4 [<unicast|multicast>]|ipv6 [<unicast|multicast>]|encap [unicast]|vpnv4 [unicast]>] neighbors <A.B.C.D|X:X::X:X|WORD> [<received-routes|advertised-routes> [route-map WORD]] [json]", SHOW_STR IP_STR BGP_STR @@ -9468,12 +9491,12 @@ DEFUN (show_ip_bgp_instance_neighbor_advertised_route, "Detailed information on TCP and BGP neighbor connections\n" "Neighbor to display information about\n" "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" + "Neighbor on BGP configured interface\n" "Display the received routes from neighbor\n" "Display the routes advertised to a BGP neighbor\n" "Route-map to modify the attributes\n" "Name of the route map\n" - "JavaScript Object Notation\n") + JSON_STR) { afi_t afi = AFI_IP6; safi_t safi = SAFI_UNICAST; @@ -9543,10 +9566,10 @@ DEFUN (show_ip_bgp_neighbor_received_prefix_filter, "Detailed information on TCP and BGP neighbor connections\n" "Neighbor to display information about\n" "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" + "Neighbor on BGP configured interface\n" "Display information received from a BGP neighbor\n" "Display the prefixlist filter\n" - "JavaScript Object Notation\n") + JSON_STR) { afi_t afi = AFI_IP6; safi_t safi = SAFI_UNICAST; @@ -9660,11 +9683,11 @@ DEFUN (show_ip_bgp_neighbor_routes, "Detailed information on TCP and BGP neighbor connections\n" "Neighbor to display information about\n" "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" + "Neighbor on BGP configured interface\n" "Display flap statistics of the routes learned from neighbor\n" "Display the dampened routes received from neighbor\n" "Display routes learned from neighbor\n" - "JavaScript Object Notation\n") + JSON_STR) { char *vrf = NULL; char *peerstr = NULL; @@ -10553,16 +10576,15 @@ bgp_route_init (void) install_element (VIEW_NODE, &show_ip_bgp_ipv4_dampening_parameters_cmd); /* Restricted node: VIEW_NODE - (set of dangerous commands) */ - install_element (VIEW_NODE, &show_ip_bgp_instance_all_cmd); install_element (VIEW_NODE, &show_ip_bgp_ipv4_cmd); install_element (VIEW_NODE, &show_ip_bgp_route_cmd); - install_element (VIEW_NODE, &show_ip_bgp_instance_neighbor_advertised_route_cmd); install_element (VIEW_NODE, &show_ip_bgp_neighbor_routes_cmd); install_element (VIEW_NODE, &show_ip_bgp_neighbor_received_prefix_filter_cmd); install_element (VIEW_NODE, &show_ip_bgp_dampening_params_cmd); install_element (VIEW_NODE, &show_ip_bgp_ipv4_dampening_parameters_cmd); + install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_route_prefix_cmd); /* BGP dampening clear commands */ install_element (ENABLE_NODE, &clear_ip_bgp_dampening_cmd); diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index 992e53b8ce..aaf01ff772 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -3557,7 +3557,8 @@ DEFUN (no_set_ecommunity_rt, NO_STR SET_STR "BGP extended community attribute\n" - "Route Target extended community\n") + "Route Target extended community\n" + "VPN extended community\n") { return generic_set_delete (vty, vty->index, "extcommunity rt", NULL); } @@ -3588,7 +3589,8 @@ DEFUN (no_set_ecommunity_soo, NO_STR SET_STR "BGP extended community attribute\n" - "Site-of-Origin extended community\n") + "Site-of-Origin extended community\n" + "VPN extended community\n") { return generic_set_delete (vty, vty->index, "extcommunity soo", NULL); } diff --git a/bgpd/bgp_updgrp_adv.c b/bgpd/bgp_updgrp_adv.c index a95a11b620..9a103de915 100644 --- a/bgpd/bgp_updgrp_adv.c +++ b/bgpd/bgp_updgrp_adv.c @@ -167,7 +167,7 @@ group_announce_route_walkcb (struct update_group *updgrp, void *arg) subgroup_process_announce_selected (subgrp, ri, ctx->rn, ri->addpath_tx_id); } - /* Process the bestpath last so the "show ip bgp neighbor x.x.x.x advertised" + /* Process the bestpath last so the "show [ip] bgp neighbor x.x.x.x advertised" * output shows the attributes from the bestpath */ if (ctx->ri) subgroup_process_announce_selected (subgrp, ctx->ri, ctx->rn, ctx->ri->addpath_tx_id); diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 4532e24977..5ba99f1bdf 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -931,7 +931,8 @@ DEFUN (no_bgp_confederation_identifier, NO_STR "BGP specific commands\n" "AS confederation parameters\n" - "AS number\n") + "AS number\n" + "Set routing domain confederation AS\n") { struct bgp *bgp; @@ -1358,6 +1359,7 @@ DEFUN (bgp_coalesce_time, DEFUN (no_bgp_coalesce_time, no_bgp_coalesce_time_cmd, "no coalesce-time (0-4294967295)", + NO_STR "Subgroup coalesce timer\n" "Subgroup coalesce timer value (in ms)\n") { @@ -2020,7 +2022,9 @@ DEFUN (no_bgp_bestpath_med, "Change the default bestpath selection\n" "MED attribute\n" "Compare MED among confederation paths\n" - "Treat missing MED as the least preferred one\n") + "Treat missing MED as the least preferred one\n" + "Treat missing MED as the least preferred one\n" + "Compare MED among confederation paths\n") { struct bgp *bgp = vty->index; @@ -2607,13 +2611,13 @@ peer_remote_as_vty (struct vty *vty, const char *peer_str, DEFUN (neighbor_remote_as, neighbor_remote_as_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> remote-as <(1-4294967295)|external|internal>", + "neighbor <A.B.C.D|X:X::X:X|WORD> remote-as <(1-4294967295)|internal|external>", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Specify a BGP neighbor\n" AS_STR - "External BGP peer\n" - "Internal BGP peer\n") + "Internal BGP peer\n" + "External BGP peer\n") { int idx_peer = 1; int idx_remote_as = 3; @@ -2766,13 +2770,14 @@ DEFUN (neighbor_interface_config_v6only, DEFUN (neighbor_interface_config_remote_as, neighbor_interface_config_remote_as_cmd, - "neighbor WORD interface remote-as <(1-4294967295)|external|internal>", + "neighbor WORD interface remote-as <(1-4294967295)|internal|external>", NEIGHBOR_STR "Interface name or neighbor tag\n" "Enable BGP on interface\n" + "Specify a BGP neighbor\n" AS_STR - "External BGP peer\n" - "Internal BGP peer\n") + "Internal BGP peer\n" + "External BGP peer\n") { int idx_word = 1; int idx_remote_as = 4; @@ -2782,13 +2787,15 @@ DEFUN (neighbor_interface_config_remote_as, DEFUN (neighbor_interface_v6only_config_remote_as, neighbor_interface_v6only_config_remote_as_cmd, - "neighbor WORD interface v6only remote-as <(1-4294967295)|external|internal>", + "neighbor WORD interface v6only remote-as <(1-4294967295)|internal|external>", NEIGHBOR_STR "Interface name or neighbor tag\n" + "Enable BGP with v6 link-local only\n" "Enable BGP on interface\n" + "Specify a BGP neighbor\n" AS_STR - "External BGP peer\n" - "Internal BGP peer\n") + "Internal BGP peer\n" + "External BGP peer\n") { int idx_word = 1; int idx_remote_as = 5; @@ -2828,7 +2835,11 @@ DEFUN (no_neighbor, "no neighbor <A.B.C.D|X:X::X:X|WORD> [remote-as <(1-4294967295)|internal|external>]", NO_STR NEIGHBOR_STR - NEIGHBOR_ADDR_STR2) + NEIGHBOR_ADDR_STR2 + "Specify a BGP neighbor\n" + AS_STR + "Internal BGP peer\n" + "External BGP peer\n") { int idx_peer = 2; int ret; @@ -2892,8 +2903,10 @@ DEFUN (no_neighbor_interface_config, "Enable BGP with v6 link-local only\n" "Member of the peer-group\n" "Peer-group name\n" - "Specify remote AS\n" - AS_STR) + "Specify a BGP neighbor\n" + AS_STR + "Internal BGP peer\n" + "External BGP peer\n") { int idx_word = 2; struct peer *peer; @@ -2944,7 +2957,9 @@ DEFUN (no_neighbor_interface_peer_group_remote_as, NEIGHBOR_STR "Interface name or neighbor tag\n" "Specify a BGP neighbor\n" - AS_STR) + AS_STR + "Internal BGP peer\n" + "External BGP peer\n") { int idx_word = 2; struct peer_group *group; @@ -4720,6 +4735,7 @@ DEFUN (no_bgp_set_route_map_delay_timer, no_bgp_set_route_map_delay_timer_cmd, "no bgp route-map delay-timer [(0-600)]", NO_STR + BGP_STR "Default BGP route-map delay timer\n" "Reset to default time to wait for processing route-map changes\n" "0 disables the timer, no route updates happen when route-maps change\n") @@ -5440,7 +5456,8 @@ DEFUN (no_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 = 2; struct peer *peer; @@ -5579,7 +5596,7 @@ DEFUN (address_family_vpnv4, "address-family vpnv4 [unicast]", "Enter Address Family command mode\n" "Address Family\n" - "Address Family Modifier\n") + "Address Family modifier\n") { vty->node = BGP_VPNV4_NODE; return CMD_SUCCESS; @@ -5590,7 +5607,7 @@ DEFUN (address_family_vpnv6, "address-family vpnv6 [unicast]", "Enter Address Family command mode\n" "Address Family\n" - "Address Family Modifier\n") + "Address Family modifier\n") { vty->node = BGP_VPNV6_NODE; return CMD_SUCCESS; @@ -5719,7 +5736,7 @@ bgp_clear_prefix (struct vty *vty, const char *view_name, const char *ip_str, /* one clear bgp command to rule them all */ DEFUN (clear_ip_bgp_all, clear_ip_bgp_all_cmd, - "clear [ip] bgp [<view|vrf> WORD] <*|A.B.C.D|X:X::X:X|WORD|(1-4294967295)|external|peer-group WORD> [<ipv4 [<unicast|multicast>]|ipv6 [<unicast|multicast>]|encap [unicast]|vpnv4 [unicast]>] [<soft [<in|out>]|in [prefix-filter]|out>]", + "clear [ip] bgp [<view|vrf> WORD] [<ipv4 [<unicast|multicast>]|ipv6 [<unicast|multicast>]|encap [unicast]|vpnv4 [unicast]>] <*|A.B.C.D|X:X::X:X|WORD|(1-4294967295)|external|peer-group WORD> [<soft [<in|out>]|in [prefix-filter]|out>]", CLEAR_STR IP_STR BGP_STR @@ -5879,12 +5896,13 @@ DEFUN (clear_ip_bgp_prefix, DEFUN (clear_bgp_ipv6_safi_prefix, clear_bgp_ipv6_safi_prefix_cmd, - "clear bgp ipv6 <unicast|multicast> prefix X:X::X:X/M", + "clear [ip] bgp ipv6 <unicast|multicast> prefix X:X::X:X/M", CLEAR_STR + IP_STR BGP_STR "Address Family\n" - "Address Family Modifier\n" - "Address Family Modifier\n" + "Address Family modifier\n" + "Address Family modifier\n" "Clear bestpath and re-advertise\n" "IPv6 prefix\n") { @@ -5898,13 +5916,14 @@ DEFUN (clear_bgp_ipv6_safi_prefix, DEFUN (clear_bgp_instance_ipv6_safi_prefix, clear_bgp_instance_ipv6_safi_prefix_cmd, - "clear bgp <view|vrf> WORD ipv6 <unicast|multicast> prefix X:X::X:X/M", + "clear [ip] bgp <view|vrf> WORD ipv6 <unicast|multicast> prefix X:X::X:X/M", CLEAR_STR + IP_STR BGP_STR BGP_INSTANCE_HELP_STR "Address Family\n" - "Address Family Modifier\n" - "Address Family Modifier\n" + "Address Family modifier\n" + "Address Family modifier\n" "Clear bestpath and re-advertise\n" "IPv6 prefix\n") { @@ -5956,7 +5975,7 @@ DEFUN (show_bgp_vrfs, IP_STR BGP_STR "Show BGP VRFs\n" - "JavaScript Object Notation\n") + JSON_STR) { struct list *inst = bm->bgp; struct listnode *node; @@ -6062,6 +6081,7 @@ DEFUN (show_bgp_memory, show_bgp_memory_cmd, "show [ip] bgp memory", SHOW_STR + IP_STR BGP_STR "Global BGP memory statistics\n") { @@ -6627,10 +6647,10 @@ bgp_show_summary_vty (struct vty *vty, const char *name, return CMD_SUCCESS; } -/* `show ip bgp summary' commands. */ +/* `show [ip] bgp summary' commands. */ DEFUN (show_ip_bgp_summary, show_ip_bgp_summary_cmd, - "show [ip] bgp [<view|vrf> WORD] [<ipv4 [<unicast|multicast>]|ipv6 [<unicast|multicast>]|encap [unicast]|vpnv4 [unicast]>] summary [json]", + "show [ip] bgp [<view|vrf> WORD] [<ipv4 [<unicast|multicast>]|ipv6 [<unicast|multicast>]|encap [unicast]|vpnv4 <all|rd ASN:nn_or_IP-address:nn>>] summary [json]", SHOW_STR IP_STR BGP_STR @@ -6644,9 +6664,11 @@ DEFUN (show_ip_bgp_summary, "Address Family\n" "Address Family modifier\n" "Address Family\n" - "Address Family modifier\n" + "Display information about all VPNv4 NLRIs\n" + "Display information for a route distinguisher\n" + "VPN Route Distinguisher\n" "Summary of BGP neighbor status\n" - "JavaScript Object Notation\n") + JSON_STR) { char *vrf = NULL; afi_t afi = AFI_IP6; @@ -6667,13 +6689,18 @@ DEFUN (show_ip_bgp_summary, if (argv_find (argv, argc, "unicast", &idx) || argv_find (argv, argc, "multicast", &idx)) safi = strmatch (argv[idx]->text, "unicast") ? SAFI_UNICAST : SAFI_MULTICAST; } - else if (argv_find (argv, argc, "encap", &idx) || argv_find (argv, argc, "vpnv4", &idx)) + else if (argv_find (argv, argc, "encap", &idx)) { afi = AFI_IP; - safi = strmatch (argv[idx]->text, "encap") ? SAFI_ENCAP : SAFI_MPLS_VPN; - // advance idx if necessary - argv_find (argv, argc, "unicast", &idx); + safi = SAFI_ENCAP; + } + else if (argv_find (argv, argc, "vpnv4", &idx)) + { + // we show the same thing regardless of rd and all + afi = AFI_IP; + safi = SAFI_MPLS_VPN; } + int uj = use_json (argc, argv); return bgp_show_summary_vty (vty, vrf, afi, safi, uj); @@ -8513,21 +8540,25 @@ bgp_show_neighbor_vty (struct vty *vty, const char *name, return CMD_SUCCESS; } -/* "show ip bgp neighbors" commands. */ +/* "show [ip] bgp neighbors" commands. */ DEFUN (show_ip_bgp_neighbors, show_ip_bgp_neighbors_cmd, - "show [ip] bgp [<view|vrf> WORD] [<ipv4|ipv6>] neighbors [<A.B.C.D|X:X::X:X|WORD>] [json]", + "show [ip] bgp [<view|vrf> WORD] [<ipv4|ipv6|vpnv4 <all|rd ASN:nn_or_IP-address:nn>>] neighbors [<A.B.C.D|X:X::X:X|WORD>] [json]", SHOW_STR IP_STR BGP_STR BGP_INSTANCE_ALL_HELP_STR "Address Family\n" "Address Family\n" + "Address Family\n" + "Display information about all VPNv4 NLRIs\n" + "Display information for a route distinguisher\n" + "VPN Route Distinguisher\n" "Detailed information on TCP and BGP neighbor connections\n" "Neighbor to display information about\n" "Neighbor to display information about\n" - "Neighbor on bgp configured interface\n" - "JavaScript Object Notation\n") + "Neighbor on BGP configured interface\n" + JSON_STR) { char *vrf = NULL; char *sh_arg = NULL; @@ -8540,7 +8571,8 @@ DEFUN (show_ip_bgp_neighbors, if (argv_find (argv, argc, "WORD", &idx)) vrf = argv[idx]->arg; - if (argv_find (argv, argc, "A.B.C.D", &idx) || argv_find (argv, argc, "X:X::X:X", &idx) || + if (argv_find (argv, argc, "A.B.C.D", &idx) || + argv_find (argv, argc, "X:X::X:X", &idx) || argv_find (argv, argc, "WORD", &idx)) { sh_type = show_peer; @@ -8552,7 +8584,7 @@ DEFUN (show_ip_bgp_neighbors, return bgp_show_neighbor_vty (vty, vrf, sh_type, sh_arg, uj); } -/* Show BGP's AS paths internal data. There are both `show ip bgp +/* Show BGP's AS paths internal data. There are both `show [ip] bgp paths' and `show ip mbgp paths'. Those functions results are the same.*/ DEFUN (show_ip_bgp_paths, @@ -8561,6 +8593,8 @@ DEFUN (show_ip_bgp_paths, SHOW_STR IP_STR BGP_STR + "Address Family modifier\n" + "Address Family modifier\n" "Path information\n") { vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE); @@ -8714,8 +8748,9 @@ DEFUN (show_ip_bgp_updgrps, DEFUN (show_bgp_instance_all_ipv6_updgrps, show_bgp_instance_all_ipv6_updgrps_cmd, - "show bgp <view|vrf> all update-groups", + "show [ip] bgp <view|vrf> all update-groups", SHOW_STR + IP_STR BGP_STR BGP_INSTANCE_ALL_HELP_STR "Detailed info about dynamic update groups\n") @@ -8726,8 +8761,9 @@ DEFUN (show_bgp_instance_all_ipv6_updgrps, DEFUN (show_bgp_updgrps_stats, show_bgp_updgrps_stats_cmd, - "show bgp update-groups statistics", + "show [ip] bgp update-groups statistics", SHOW_STR + IP_STR BGP_STR "Detailed info about dynamic update groups\n" "Statistics\n") @@ -8743,8 +8779,9 @@ DEFUN (show_bgp_updgrps_stats, DEFUN (show_bgp_instance_updgrps_stats, show_bgp_instance_updgrps_stats_cmd, - "show bgp <view|vrf> WORD update-groups statistics", + "show [ip] bgp <view|vrf> WORD update-groups statistics", SHOW_STR + IP_STR BGP_STR BGP_INSTANCE_HELP_STR "Detailed info about dynamic update groups\n" @@ -8785,7 +8822,7 @@ show_bgp_updgrps_adj_info_aux (struct vty *vty, const char *name, DEFUN (show_ip_bgp_updgrps_adj, show_ip_bgp_updgrps_adj_cmd, - "show ip bgp update-groups <advertise-queue|advertised-routes|packet-queue>", + "show [ip] bgp update-groups <advertise-queue|advertised-routes|packet-queue>", SHOW_STR IP_STR BGP_STR @@ -8802,7 +8839,7 @@ DEFUN (show_ip_bgp_updgrps_adj, DEFUN (show_ip_bgp_instance_updgrps_adj, show_ip_bgp_instance_updgrps_adj_cmd, - "show ip bgp <view|vrf> WORD update-groups <advertise-queue|advertised-routes|packet-queue>", + "show [ip] bgp <view|vrf> WORD update-groups <advertise-queue|advertised-routes|packet-queue>", SHOW_STR IP_STR BGP_STR @@ -8821,8 +8858,9 @@ DEFUN (show_ip_bgp_instance_updgrps_adj, DEFUN (show_bgp_updgrps_afi_adj, show_bgp_updgrps_afi_adj_cmd, - "show bgp <ipv4|ipv6> <unicast|multicast> update-groups <advertise-queue|advertised-routes|packet-queue>", + "show [ip] bgp <ipv4|ipv6> <unicast|multicast> update-groups <advertise-queue|advertised-routes|packet-queue>", SHOW_STR + IP_STR BGP_STR "Address Family\n" "Address Family\n" @@ -8848,8 +8886,9 @@ DEFUN (show_bgp_updgrps_afi_adj, DEFUN (show_bgp_updgrps_adj, show_bgp_updgrps_adj_cmd, - "show bgp update-groups <advertise-queue|advertised-routes|packet-queue>", + "show [ip] bgp update-groups <advertise-queue|advertised-routes|packet-queue>", SHOW_STR + IP_STR BGP_STR "Detailed info about dynamic update groups\n" "Advertisement queue\n" @@ -8863,8 +8902,9 @@ DEFUN (show_bgp_updgrps_adj, DEFUN (show_bgp_instance_updgrps_adj, show_bgp_instance_updgrps_adj_cmd, - "show bgp <view|vrf> WORD update-groups <advertise-queue|advertised-routes|packet-queue>", + "show [ip] bgp <view|vrf> WORD update-groups <advertise-queue|advertised-routes|packet-queue>", SHOW_STR + IP_STR BGP_STR BGP_INSTANCE_HELP_STR "Detailed info about dynamic update groups\n" @@ -8880,7 +8920,7 @@ DEFUN (show_bgp_instance_updgrps_adj, DEFUN (show_ip_bgp_updgrps_adj_s, show_ip_bgp_updgrps_adj_s_cmd, - "show ip bgp update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>", + "show [ip] bgp update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>", SHOW_STR IP_STR BGP_STR @@ -8903,7 +8943,7 @@ DEFUN (show_ip_bgp_updgrps_adj_s, DEFUN (show_ip_bgp_instance_updgrps_adj_s, show_ip_bgp_instance_updgrps_adj_s_cmd, - "show ip bgp <view|vrf> WORD update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>", + "show [ip] bgp <view|vrf> WORD update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>", SHOW_STR IP_STR BGP_STR @@ -8928,8 +8968,9 @@ DEFUN (show_ip_bgp_instance_updgrps_adj_s, DEFUN (show_bgp_updgrps_afi_adj_s, show_bgp_updgrps_afi_adj_s_cmd, - "show bgp <ipv4|ipv6> <unicast|multicast> update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>", + "show [ip] bgp <ipv4|ipv6> <unicast|multicast> update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>", SHOW_STR + IP_STR BGP_STR "Address Family\n" "Address Family\n" @@ -8960,8 +9001,9 @@ DEFUN (show_bgp_updgrps_afi_adj_s, DEFUN (show_bgp_updgrps_adj_s, show_bgp_updgrps_adj_s_cmd, - "show bgp update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>", + "show [ip] bgp update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>", SHOW_STR + IP_STR BGP_STR "Detailed info about dynamic update groups\n" "Specific subgroup to display info for\n" @@ -8981,8 +9023,9 @@ DEFUN (show_bgp_updgrps_adj_s, DEFUN (show_bgp_instance_updgrps_adj_s, show_bgp_instance_updgrps_adj_s_cmd, - "show bgp <view|vrf> WORD update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>", + "show [ip] bgp <view|vrf> WORD update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>", SHOW_STR + IP_STR BGP_STR BGP_INSTANCE_HELP_STR "Detailed info about dynamic update groups\n" @@ -10677,7 +10720,7 @@ bgp_vty_init (void) install_element (ENABLE_NODE, &clear_bgp_ipv6_safi_prefix_cmd); install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_safi_prefix_cmd); - /* "show ip bgp summary" commands. */ + /* "show [ip] bgp summary" commands. */ install_element (VIEW_NODE, &show_ip_bgp_summary_cmd); install_element (VIEW_NODE, &show_ip_bgp_updgrps_cmd); install_element (VIEW_NODE, &show_bgp_instance_all_ipv6_updgrps_cmd); @@ -10691,7 +10734,6 @@ bgp_vty_init (void) install_element (VIEW_NODE, &show_bgp_updgrps_adj_s_cmd); install_element (VIEW_NODE, &show_bgp_instance_updgrps_adj_s_cmd); install_element (VIEW_NODE, &show_bgp_updgrps_afi_adj_s_cmd); - install_element (VIEW_NODE, &show_ip_bgp_summary_cmd); install_element (VIEW_NODE, &show_ip_bgp_updgrps_cmd); install_element (VIEW_NODE, &show_bgp_instance_all_ipv6_updgrps_cmd); install_element (VIEW_NODE, &show_ip_bgp_updgrps_adj_cmd); @@ -10707,19 +10749,19 @@ bgp_vty_init (void) install_element (VIEW_NODE, &show_bgp_updgrps_stats_cmd); install_element (VIEW_NODE, &show_bgp_instance_updgrps_stats_cmd); - /* "show ip bgp neighbors" commands. */ + /* "show [ip] bgp neighbors" commands. */ install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd); - /* "show ip bgp peer-group" commands. */ + /* "show [ip] bgp peer-group" commands. */ install_element (VIEW_NODE, &show_ip_bgp_peer_groups_cmd); - /* "show ip bgp paths" commands. */ + /* "show [ip] bgp paths" commands. */ install_element (VIEW_NODE, &show_ip_bgp_paths_cmd); - /* "show ip bgp community" commands. */ + /* "show [ip] bgp community" commands. */ install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd); - /* "show ip bgp attribute-info" commands. */ + /* "show [ip] bgp attribute-info" commands. */ install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd); /* "redistribute" commands. */ @@ -10760,13 +10802,13 @@ bgp_vty_init (void) install_element (BGP_NODE, &neighbor_ttl_security_cmd); install_element (BGP_NODE, &no_neighbor_ttl_security_cmd); - /* "show bgp memory" commands. */ + /* "show [ip] bgp memory" commands. */ install_element (VIEW_NODE, &show_bgp_memory_cmd); - /* "show bgp views" commands. */ + /* "show [ip] bgp views" commands. */ install_element (VIEW_NODE, &show_bgp_views_cmd); - /* "show bgp vrfs" commands. */ + /* "show [ip] bgp vrfs" commands. */ install_element (VIEW_NODE, &show_bgp_vrfs_cmd); /* Community-list. */ diff --git a/isisd/isis_vty.c b/isisd/isis_vty.c index df13696b20..848c56a6ac 100644 --- a/isisd/isis_vty.c +++ b/isisd/isis_vty.c @@ -121,6 +121,7 @@ DEFUN (no_ip_router_isis, NO_STR "Interface Internet Protocol config commands\n" "IP router interface commands\n" + "IP router interface commands\n" "IS-IS Routing for IP\n" "Routing process tag\n") { @@ -1560,106 +1561,53 @@ set_lsp_gen_interval (struct vty *vty, struct isis_area *area, DEFUN (lsp_gen_interval, lsp_gen_interval_cmd, - "lsp-gen-interval (1-120)", + "lsp-gen-interval [<level-1|level-2>] (1-120)", "Minimum interval between regenerating same LSP\n" + "Set interval for level 1 only\n" + "Set interval for level 2 only\n" "Minimum interval in seconds\n") { - int idx_number = 1; + int idx = 0; VTY_DECLVAR_CONTEXT (isis_area, area); uint16_t interval; int level; - interval = atoi (argv[idx_number]->arg); - level = IS_LEVEL_1 | IS_LEVEL_2; + level = 0; + level |= argv_find (argv, argc, "level-1", &idx) ? IS_LEVEL_1 : 0; + level |= argv_find (argv, argc, "level-2", &idx) ? IS_LEVEL_2 : 0; + if (!level) + level = IS_LEVEL_1 | IS_LEVEL_2; + + argv_find (argv, argc, "(1-120)", &idx); + + interval = atoi (argv[idx]->arg); return set_lsp_gen_interval (vty, area, interval, level); } DEFUN (no_lsp_gen_interval, no_lsp_gen_interval_cmd, - "no lsp-gen-interval [(1-120)]", + "no lsp-gen-interval [<level-1|level-2>] [(1-120)]", NO_STR "Minimum interval between regenerating same LSP\n" - "Minimum interval in seconds\n") -{ - VTY_DECLVAR_CONTEXT (isis_area, area); - uint16_t interval; - int level; - - interval = DEFAULT_MIN_LSP_GEN_INTERVAL; - level = IS_LEVEL_1 | IS_LEVEL_2; - return set_lsp_gen_interval (vty, area, interval, level); -} - - -DEFUN (lsp_gen_interval_l1, - lsp_gen_interval_l1_cmd, - "lsp-gen-interval level-1 (1-120)", - "Minimum interval between regenerating same LSP\n" "Set interval for level 1 only\n" - "Minimum interval in seconds\n") -{ - int idx_number = 2; - VTY_DECLVAR_CONTEXT (isis_area, area); - uint16_t interval; - int level; - - interval = atoi (argv[idx_number]->arg); - level = IS_LEVEL_1; - return set_lsp_gen_interval (vty, area, interval, level); -} - -DEFUN (no_lsp_gen_interval_l1, - no_lsp_gen_interval_l1_cmd, - "no lsp-gen-interval level-1 [(1-120)]", - NO_STR - "Minimum interval between regenerating same LSP\n" - "Set interval for level 1 only\n") -{ - VTY_DECLVAR_CONTEXT (isis_area, area); - uint16_t interval; - int level; - - interval = DEFAULT_MIN_LSP_GEN_INTERVAL; - level = IS_LEVEL_1; - return set_lsp_gen_interval (vty, area, interval, level); -} - - -DEFUN (lsp_gen_interval_l2, - lsp_gen_interval_l2_cmd, - "lsp-gen-interval level-2 (1-120)", - "Minimum interval between regenerating same LSP\n" "Set interval for level 2 only\n" "Minimum interval in seconds\n") { + int idx = 0; VTY_DECLVAR_CONTEXT (isis_area, area); - int idx_number = 2; uint16_t interval; int level; - interval = atoi (argv[idx_number]->arg); - level = IS_LEVEL_2; - return set_lsp_gen_interval (vty, area, interval, level); -} - -DEFUN (no_lsp_gen_interval_l2, - no_lsp_gen_interval_l2_cmd, - "no lsp-gen-interval level-2 [(1-120)]", - NO_STR - "Minimum interval between regenerating same LSP\n" - "Set interval for level 2 only\n" - "Minimum interval in seconds\n") -{ - VTY_DECLVAR_CONTEXT (isis_area, area); - uint16_t interval; - int level; + level = 0; + level |= argv_find (argv, argc, "level-1", &idx) ? IS_LEVEL_1 : 0; + level |= argv_find (argv, argc, "level-2", &idx) ? IS_LEVEL_2 : 0; + if (!level) + level = IS_LEVEL_1 | IS_LEVEL_2; interval = DEFAULT_MIN_LSP_GEN_INTERVAL; - level = IS_LEVEL_2; return set_lsp_gen_interval (vty, area, interval, level); } - DEFUN (spf_interval, spf_interval_cmd, "spf-interval (1-120)", @@ -1809,6 +1757,7 @@ area_max_lsp_lifetime_set(struct vty *vty, int level, DEFUN (max_lsp_lifetime, max_lsp_lifetime_cmd, "max-lsp-lifetime [<level-1|level-2>] (350-65535)", + "Maximum LSP lifetime\n" "Maximum LSP lifetime for Level 1 only\n" "Maximum LSP lifetime for Level 2 only\n" "LSP lifetime in seconds\n") @@ -1832,6 +1781,7 @@ DEFUN (no_max_lsp_lifetime, no_max_lsp_lifetime_cmd, "no max-lsp-lifetime [<level-1|level-2>] [(350-65535)]", NO_STR + "Maximum LSP lifetime\n" "Maximum LSP lifetime for Level 1 only\n" "Maximum LSP lifetime for Level 2 only\n" "LSP lifetime in seconds\n") @@ -2127,10 +2077,6 @@ isis_vty_init (void) install_element (ISIS_NODE, &lsp_gen_interval_cmd); install_element (ISIS_NODE, &no_lsp_gen_interval_cmd); - install_element (ISIS_NODE, &lsp_gen_interval_l1_cmd); - install_element (ISIS_NODE, &no_lsp_gen_interval_l1_cmd); - install_element (ISIS_NODE, &lsp_gen_interval_l2_cmd); - install_element (ISIS_NODE, &no_lsp_gen_interval_l2_cmd); install_element (ISIS_NODE, &spf_interval_cmd); install_element (ISIS_NODE, &no_spf_interval_cmd); diff --git a/isisd/isisd.c b/isisd/isisd.c index cce0c1e391..4ca9e7fff3 100644 --- a/isisd/isisd.c +++ b/isisd/isisd.c @@ -1525,62 +1525,19 @@ show_isis_database (struct vty *vty, const char *argv, int ui_level) return CMD_SUCCESS; } -DEFUN (show_database_brief, +DEFUN (show_database, show_database_cmd, - "show isis database", - SHOW_STR - "IS-IS information\n" - "IS-IS link state database\n") -{ - return show_isis_database (vty, NULL, ISIS_UI_LEVEL_BRIEF); -} - -DEFUN (show_database_lsp_brief, - show_database_arg_cmd, - "show isis database WORD", - SHOW_STR - "IS-IS information\n" - "IS-IS link state database\n" - "LSP ID\n") -{ - int idx_word = 3; - return show_isis_database (vty, argv[idx_word]->arg, ISIS_UI_LEVEL_BRIEF); -} - -DEFUN (show_database_lsp_detail, - show_database_arg_detail_cmd, - "show isis database WORD detail", - SHOW_STR - "IS-IS information\n" - "IS-IS link state database\n" - "LSP ID\n" - "Detailed information\n") -{ - int idx_word = 3; - return show_isis_database (vty, argv[idx_word]->arg, ISIS_UI_LEVEL_DETAIL); -} - -DEFUN (show_database_detail, - show_database_detail_cmd, - "show isis database detail", - SHOW_STR - "IS-IS information\n" - "IS-IS link state database\n") -{ - return show_isis_database (vty, NULL, ISIS_UI_LEVEL_DETAIL); -} - -DEFUN (show_database_detail_lsp, - show_database_detail_arg_cmd, - "show isis database detail WORD", + "show isis database [detail] [WORD]", SHOW_STR "IS-IS information\n" "IS-IS link state database\n" "Detailed information\n" "LSP ID\n") { - int idx_word = 4; - return show_isis_database (vty, argv[idx_word]->arg, ISIS_UI_LEVEL_DETAIL); + int idx = 0; + int uilevel = argv_find (argv, argc, "detail", &idx) ? ISIS_UI_LEVEL_DETAIL : ISIS_UI_LEVEL_BRIEF; + char *id = argv_find (argv, argc, "WORD", &idx) ? argv[idx]->arg : NULL; + return show_isis_database (vty, id, uilevel); } /* @@ -2181,10 +2138,6 @@ isis_init () install_element (VIEW_NODE, &show_hostname_cmd); install_element (VIEW_NODE, &show_database_cmd); - install_element (VIEW_NODE, &show_database_arg_cmd); - install_element (VIEW_NODE, &show_database_arg_detail_cmd); - install_element (VIEW_NODE, &show_database_detail_cmd); - install_element (VIEW_NODE, &show_database_detail_arg_cmd); install_element (ENABLE_NODE, &show_debugging_isis_cmd); diff --git a/lib/.gitignore b/lib/.gitignore index 87d9bbdb37..f34801eac4 100644 --- a/lib/.gitignore +++ b/lib/.gitignore @@ -17,6 +17,7 @@ gitversion.h.tmp route_types.h memtypes.h command_lex.c +command_lex.h command_parse.c command_parse.h refix diff --git a/lib/command_match.c b/lib/command_match.c index d4996f634d..14501c8626 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -27,7 +27,14 @@ #include "command_match.h" #include "memory.h" -DEFINE_MTYPE_STATIC(LIB, CMD_TOKENS, "Command Tokens") +#ifdef TRACE_MATCHER +#define TM 1 +#else +#define TM 0 +#endif + +#define trace_matcher(...) \ + do { if (TM) fprintf (stderr, __VA_ARGS__); } while (0); /* matcher helper prototypes */ static int @@ -115,12 +122,28 @@ command_match (struct graph *cmdgraph, assert (*el); } +<<<<<<< HEAD + if (!*el) { + trace_matcher ("No match\n"); + } + else { + trace_matcher ("Matched command\n->string %s\n->desc %s\n", (*el)->string, (*el)->doc); + } +||||||| merged common ancestors + if (!*el) { + trace_matcher ("No match"); + } + else { + trace_matcher ("Matched command\n->string %s\n->desc %s\n", (*el)->string, (*el)->doc); + } +======= #ifdef TRACE_MATCHER if (!*el) fprintf (stdout, "No match\n"); else fprintf (stdout, "Matched command\n->string %s\n->desc %s\n", (*el)->string, (*el)->doc); #endif +>>>>>>> osr/master // free the leader token we alloc'd XFREE (MTYPE_TMP, vector_slot (vvline, 0)); @@ -336,6 +359,13 @@ command_complete (struct graph *graph, input_token = vector_slot (vline, idx); + int exact_match_exists = 0; + for (ALL_LIST_ELEMENTS_RO (current,node,gn)) + if (!exact_match_exists) + exact_match_exists = (match_token (gn->data, input_token) == exact_match); + else + break; + for (ALL_LIST_ELEMENTS_RO (current,node,gn)) { struct cmd_token *token = gn->data; @@ -344,17 +374,57 @@ command_complete (struct graph *graph, continue; enum match_type minmatch = min_match_level (token->type); +<<<<<<< HEAD + trace_matcher ("\"%s\" matches \"%s\" (%d) ? ", + input_token, token->text, token->type); +||||||| merged common ancestors + trace_matcher ("\"%s\" matches \"%s\" (%d) ? ", input_token, token->text, token->type); +======= #ifdef TRACE_MATCHER fprintf (stdout, "\"%s\" matches \"%s\" (%d) ? ", input_token, token->text, token->type); #endif +>>>>>>> osr/master - switch (match_token (token, input_token)) + unsigned int last_token = (vector_active (vline) - 1 == idx); + enum match_type matchtype = match_token (token, input_token); + switch (matchtype) { + // occurs when last token is whitespace case trivial_match: +<<<<<<< HEAD + trace_matcher ("trivial_match\n"); + assert(last_token); + listnode_add (next, gn); + break; +||||||| merged common ancestors + trace_matcher ("trivial_match\n"); + assert(idx == vector_active (vline) - 1); + listnode_add (next, gn); + break; +======= #ifdef TRACE_MATCHER fprintf (stdout, "trivial_match\n"); #endif +>>>>>>> osr/master case partly_match: +<<<<<<< HEAD + trace_matcher ("trivial_match\n"); + if (exact_match_exists && !last_token) + break; +||||||| merged common ancestors + trace_matcher ("partly_match\n"); + // last token on line is partial and + // not a space + if (idx == vector_active (vline) - 1) + { + listnode_add (next, gn); + break; + } + if (minmatch <= partly_match) + add_nexthops (next, gn); + + break; +======= #ifdef TRACE_MATCHER fprintf (stdout, "partly_match\n"); #endif @@ -365,11 +435,24 @@ command_complete (struct graph *graph, } if (minmatch > partly_match) break; +>>>>>>> osr/master case exact_match: +<<<<<<< HEAD + trace_matcher ("exact_match\n"); + if (last_token) + listnode_add (next, gn); + else if (matchtype >= minmatch) + add_nexthops (next, gn); +||||||| merged common ancestors + trace_matcher ("exact_match\n"); + add_nexthops (next, gn); + listnode_add (next, gn); +======= #ifdef TRACE_MATCHER fprintf (stdout, "exact_match\n"); #endif add_nexthops (next, gn); +>>>>>>> osr/master break; default: #ifdef TRACE_MATCHER @@ -772,44 +855,140 @@ match_ipv6 (const char *str) return no_match; } +#define IPV6_ADDR_STR "0123456789abcdefABCDEF:.%" +#define IPV6_PREFIX_STR "0123456789abcdefABCDEF:.%/" +#define STATE_START 1 +#define STATE_COLON 2 +#define STATE_DOUBLE 3 +#define STATE_ADDR 4 +#define STATE_DOT 5 +#define STATE_SLASH 6 +#define STATE_MASK 7 static enum match_type match_ipv6_prefix (const char *str) { - struct sockaddr_in6 sin6_dummy; - const char *delim = "/\0"; - char *tofree, *dupe, *prefix, *mask, *endptr; - int nmask = -1; + int state = STATE_START; + int colons = 0, nums = 0, double_colon = 0; + int mask; + const char *sp = NULL; + char *endptr = NULL; + + if (str == NULL) + return partly_match; if (strspn (str, IPV6_PREFIX_STR) != strlen (str)) return no_match; - /* tokenize to prefix + mask */ - tofree = dupe = XSTRDUP (MTYPE_TMP, str); - prefix = strsep (&dupe, delim); - mask = dupe; + while (*str != '\0' && state != STATE_MASK) + { + switch (state) + { + case STATE_START: + if (*str == ':') + { + if (*(str + 1) != ':' && *(str + 1) != '\0') + return no_match; + colons--; + state = STATE_COLON; + } + else + { + sp = str; + state = STATE_ADDR; + } + + continue; + case STATE_COLON: + colons++; + if (*(str + 1) == '/') + return no_match; + else if (*(str + 1) == ':') + state = STATE_DOUBLE; + else + { + sp = str + 1; + state = STATE_ADDR; + } + break; + case STATE_DOUBLE: + if (double_colon) + return no_match; + + if (*(str + 1) == ':') + return no_match; + else + { + if (*(str + 1) != '\0' && *(str + 1) != '/') + colons++; + sp = str + 1; + + if (*(str + 1) == '/') + state = STATE_SLASH; + else + state = STATE_ADDR; + } + + double_colon++; + nums += 1; + break; + case STATE_ADDR: + if (*(str + 1) == ':' || *(str + 1) == '.' + || *(str + 1) == '\0' || *(str + 1) == '/') + { + if (str - sp > 3) + return no_match; + + for (; sp <= str; sp++) + if (*sp == '/') + return no_match; + + nums++; + + if (*(str + 1) == ':') + state = STATE_COLON; + else if (*(str + 1) == '.') + { + if (colons || double_colon) + state = STATE_DOT; + else + return no_match; + } + else if (*(str + 1) == '/') + state = STATE_SLASH; + } + break; + case STATE_DOT: + state = STATE_ADDR; + break; + case STATE_SLASH: + if (*(str + 1) == '\0') + return partly_match; + + state = STATE_MASK; + break; + default: + break; + } + + if (nums > 11) + return no_match; + + if (colons > 7) + return no_match; - /* validate prefix */ - if (inet_pton (AF_INET6, prefix, &sin6_dummy.sin6_addr) != 1) - { - XFREE (MTYPE_TMP, tofree); - return no_match; - } + str++; + } - /* validate mask */ - if (!mask) - { - XFREE (MTYPE_TMP, tofree); + if (state < STATE_MASK) return partly_match; - } - nmask = strtoimax (mask, &endptr, 10); - if (*endptr != '\0' || nmask < 0 || nmask > 128) - { - XFREE (MTYPE_TMP, tofree); + mask = strtol (str, &endptr, 10); + if (*endptr != '\0') + return no_match; + + if (mask < 0 || mask > 128) return no_match; - } - XFREE (MTYPE_TMP, tofree); return exact_match; } #endif diff --git a/lib/routemap.c b/lib/routemap.c index dc89390a96..d6a5b713c5 100644 --- a/lib/routemap.c +++ b/lib/routemap.c @@ -2374,6 +2374,7 @@ DEFUN (no_set_ip_nexthop, "no set ip next-hop [<peer-address|A.B.C.D>]", NO_STR SET_STR + IP_STR "Next hop address\n" "Use peer address (for BGP only)\n" "IP address of next hop\n") diff --git a/ospf6d/ospf6_area.c b/ospf6d/ospf6_area.c index 9ba7287656..06ff40a983 100644 --- a/ospf6d/ospf6_area.c +++ b/ospf6d/ospf6_area.c @@ -512,12 +512,17 @@ DEFUN (area_range, DEFUN (no_area_range, no_area_range_cmd, - "no area A.B.C.D range X:X::X:X/M [<advertise|not-advertise>] [cost (0-16777215)]", + "no area <A.B.C.D|(0-4294967295)> range X:X::X:X/M [<advertise|not-advertise|cost (0-16777215)>]", NO_STR "OSPF6 area parameters\n" - OSPF6_AREA_ID_STR + "OSPF6 area ID in IP address format\n" + "OSPF6 area ID as a decimal value\n" "Configured address range\n" - "Specify IPv6 prefix\n") + "Specify IPv6 prefix\n" + "Advertise\n" + "Do not advertise\n" + "User specified metric for this range\n" + "Advertised metric for this range\n") { int idx_ipv4 = 2; int ret; diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c index ef56028a3b..06962ec069 100644 --- a/ospf6d/ospf6_lsa.c +++ b/ospf6d/ospf6_lsa.c @@ -822,7 +822,17 @@ DEFUN (debug_ospf6_lsa_type, DEBUG_STR OSPF6_STR "Debug Link State Advertisements (LSAs)\n" - "Specify LS type as Hexadecimal\n") + "Display Router LSAs\n" + "Display Network LSAs\n" + "Display Inter-Area-Prefix LSAs\n" + "Display Inter-Router LSAs\n" + "Display As-External LSAs\n" + "Display Link LSAs\n" + "Display Intra-Area-Prefix LSAs\n" + "Display LSAs of unknown origin\n" + "Display details of LSAs\n" + "Dump LSAs\n" + "Display LSA's internal information\n") { int idx_lsa = 3; int idx_type = 4; @@ -869,9 +879,11 @@ DEFUN (no_debug_ospf6_lsa_type, "Display Router LSAs\n" "Display Network LSAs\n" "Display Inter-Area-Prefix LSAs\n" + "Display Inter-Router LSAs\n" "Display As-External LSAs\n" "Display Link LSAs\n" "Display Intra-Area-Prefix LSAs\n" + "Display LSAs of unknown origin\n" "Display details of LSAs\n" "Dump LSAs\n" "Display LSA's internal information\n") diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index 65ded28702..16fb012ea9 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -422,7 +422,8 @@ DEFUN (no_ospf6_timers_lsa, NO_STR "Adjust routing timers\n" "OSPF6 LSA timers\n" - "Minimum delay in receiving new version of a LSA\n") + "Minimum delay in receiving new version of a LSA\n" + "Delay in milliseconds\n") { int idx_number = 4; unsigned int minarrival; diff --git a/ospf6d/ospf6d.c b/ospf6d/ospf6d.c index c66a124890..2aaed5fcbf 100644 --- a/ospf6d/ospf6d.c +++ b/ospf6d/ospf6d.c @@ -84,7 +84,8 @@ DEFUN (show_version_ospf6, show_version_ospf6_cmd, "show version ospf6", SHOW_STR - "Displays ospf6d version\n" + "Display version\n" + "Display ospf6d version\n" ) { vty_out (vty, "Zebra OSPF6d Version: %s%s", @@ -1151,8 +1152,7 @@ DEFUN (show_ipv6_ospf6_linkstate, "Specify Router ID as IPv4 address notation\n" "Display Network Entry\n" "Specify Router ID as IPv4 address notation\n" - "Specify Link state ID as IPv4 address notation\n" - ) + "Specify Link state ID as IPv4 address notation\n") { int idx_ipv4 = 4; struct listnode *node; @@ -1180,7 +1180,7 @@ DEFUN (show_ipv6_ospf6_linkstate_detail, IP6_STR OSPF6_STR "Display linkstate routing table\n" - ) + "Display detailed information\n") { int idx_detail = 4; struct listnode *node; diff --git a/ospfd/ospf_te.c b/ospfd/ospf_te.c index 80156e81f6..321c035d3a 100644 --- a/ospfd/ospf_te.c +++ b/ospfd/ospf_te.c @@ -2299,8 +2299,9 @@ DEFUN (ospf_mpls_te_on, DEFUN (no_ospf_mpls_te, no_ospf_mpls_te_cmd, - "no mpls-tei [on]", + "no mpls-te [on]", NO_STR + MPLS_TE_STR "Disable the MPLS-TE functionality\n") { struct listnode *node, *nnode; diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 12ae94210f..df989982d1 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -380,6 +380,7 @@ DEFUN (ospf_passive_interface, "passive-interface <IFNAME [A.B.C.D]|default>", "Suppress routing updates on an interface\n" "Interface's name\n" + "IPv4 address\n" "Suppress routing updates on interfaces by default\n") { int idx_ipv4 = 2; @@ -452,6 +453,7 @@ DEFUN (no_ospf_passive_interface, NO_STR "Allow routing updates on an interface\n" "Interface's name\n" + "IPv4 address\n" "Allow routing updates on interfaces by default\n") { int idx_ipv4 = 3; @@ -703,14 +705,18 @@ DEFUN (ospf_area_range_not_advertise, DEFUN (no_ospf_area_range, no_ospf_area_range_cmd, - "no area <A.B.C.D|(0-4294967295)> range A.B.C.D/M [<cost (0-16777215)|advertise [cost (0-16777215)] | not-advertise>]", + "no area <A.B.C.D|(0-4294967295)> range A.B.C.D/M [<cost (0-16777215)|advertise [cost (0-16777215)]|not-advertise>]", NO_STR "OSPF area parameters\n" "OSPF area ID in IP address format\n" "OSPF area ID as a decimal value\n" "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" "Advertise this range (default)\n" + "User specified metric for this range\n" + "Advertised metric for this range\n" "DoNotAdvertise this range\n") { int idx_ipv4_number = 2; @@ -1333,6 +1339,7 @@ DEFUN (no_ospf_area_vlink_intervals, "[<hello-interval|retransmit-interval|transmit-delay|dead-interval> (1-65535)" "[<hello-interval|retransmit-interval|transmit-delay|dead-interval> (1-65535)" "]]]", + NO_STR VLINK_HELPSTR_IPADDR VLINK_HELPSTR_TIME_PARAM VLINK_HELPSTR_TIME_PARAM @@ -2155,7 +2162,8 @@ DEFUN (no_ospf_abr_type, "Set OSPF ABR type\n" "Alternative ABR, cisco implementation\n" "Alternative ABR, IBM implementation\n" - "Shortcut ABR\n") + "Shortcut ABR\n" + "Standard ABR\n") { int idx_vendor = 3; struct ospf *ospf = vty->index; @@ -2667,6 +2675,7 @@ DEFUN (ospf_refresh_timer, DEFUN (no_ospf_refresh_timer, no_ospf_refresh_timer_val_cmd, "no refresh timer [(10-1800)]", + NO_STR "Adjust refresh parameters\n" "Unset refresh timer\n" "Timer value in seconds\n") @@ -3390,7 +3399,7 @@ DEFUN (show_ip_ospf, SHOW_STR IP_STR "OSPF information\n" - "JavaScript Object Notation\n") + JSON_STR) { struct ospf *ospf; u_char uj = use_json(argc, argv); @@ -3408,7 +3417,7 @@ DEFUN (show_ip_ospf_instance, IP_STR "OSPF information\n" "Instance ID\n" - "JavaScript Object Notation\n") + JSON_STR) { int idx_number = 3; struct ospf *ospf; @@ -3801,7 +3810,7 @@ DEFUN (show_ip_ospf_interface, "OSPF information\n" "Interface information\n" "Interface name\n" - "JavaScript Object Notation\n") + JSON_STR) { struct ospf *ospf; u_char uj = use_json(argc, argv); @@ -3821,7 +3830,7 @@ DEFUN (show_ip_ospf_instance_interface, "Instance ID\n" "Interface information\n" "Interface name\n" - "JavaScript Object Notation\n") + JSON_STR) { int idx_number = 3; struct ospf *ospf; @@ -3958,7 +3967,7 @@ DEFUN (show_ip_ospf_neighbor, IP_STR "OSPF information\n" "Neighbor list\n" - "JavaScript Object Notation\n") + JSON_STR) { struct ospf *ospf; u_char uj = use_json(argc, argv); @@ -3978,7 +3987,7 @@ DEFUN (show_ip_ospf_instance_neighbor, "OSPF information\n" "Instance ID\n" "Neighbor list\n" - "JavaScript Object Notation\n") + JSON_STR) { int idx_number = 3; struct ospf *ospf; @@ -4071,7 +4080,7 @@ DEFUN (show_ip_ospf_neighbor_all, "OSPF information\n" "Neighbor list\n" "include down status neighbor\n" - "JavaScript Object Notation\n") + JSON_STR) { struct ospf *ospf; u_char uj = use_json(argc, argv); @@ -4091,7 +4100,7 @@ DEFUN (show_ip_ospf_instance_neighbor_all, "Instance ID\n" "Neighbor list\n" "include down status neighbor\n" - "JavaScript Object Notation\n") + JSON_STR) { int idx_number = 3; struct ospf *ospf; @@ -4166,7 +4175,7 @@ DEFUN (show_ip_ospf_neighbor_int, "OSPF information\n" "Neighbor list\n" "Interface name\n" - "JavaScript Object Notation\n") + JSON_STR) { struct ospf *ospf; u_char uj = use_json(argc, argv); @@ -4186,7 +4195,7 @@ DEFUN (show_ip_ospf_instance_neighbor_int, "Instance ID\n" "Neighbor list\n" "Interface name\n" - "JavaScript Object Notation\n") + JSON_STR) { int idx_number = 3; struct ospf *ospf; @@ -4538,7 +4547,7 @@ DEFUN (show_ip_ospf_neighbor_id, "OSPF information\n" "Neighbor list\n" "Neighbor ID\n" - "JavaScript Object Notation\n") + JSON_STR) { struct ospf *ospf; u_char uj = use_json(argc, argv); @@ -4558,7 +4567,7 @@ DEFUN (show_ip_ospf_instance_neighbor_id, "Instance ID\n" "Neighbor list\n" "Neighbor ID\n" - "JavaScript Object Notation\n") + JSON_STR) { int idx_number = 3; struct ospf *ospf; @@ -4630,7 +4639,7 @@ DEFUN (show_ip_ospf_neighbor_detail, "OSPF information\n" "Neighbor list\n" "detail of all neighbors\n" - "JavaScript Object Notation\n") + JSON_STR) { struct ospf *ospf; u_char uj = use_json(argc, argv); @@ -4650,7 +4659,7 @@ DEFUN (show_ip_ospf_instance_neighbor_detail, "Instance ID\n" "Neighbor list\n" "detail of all neighbors\n" - "JavaScript Object Notation\n") + JSON_STR) { int idx_number = 3; struct ospf *ospf; @@ -4729,7 +4738,7 @@ DEFUN (show_ip_ospf_neighbor_detail_all, "Neighbor list\n" "detail of all neighbors\n" "include down status neighbor\n" - "JavaScript Object Notation\n") + JSON_STR) { struct ospf *ospf; u_char uj = use_json(argc, argv); @@ -4750,7 +4759,7 @@ DEFUN (show_ip_ospf_instance_neighbor_detail_all, "Neighbor list\n" "detail of all neighbors\n" "include down status neighbor\n" - "JavaScript Object Notation\n") + JSON_STR) { int idx_number = 3; struct ospf *ospf; @@ -4832,7 +4841,7 @@ DEFUN (show_ip_ospf_neighbor_int_detail, "Neighbor list\n" "Interface name\n" "detail of all neighbors\n" - "JavaScript Object Notation\n") + JSON_STR) { struct ospf *ospf; u_char uj = use_json(argc, argv); @@ -4853,7 +4862,7 @@ DEFUN (show_ip_ospf_instance_neighbor_int_detail, "Neighbor list\n" "Interface name\n" "detail of all neighbors\n" - "JavaScript Object Notation\n") + JSON_STR) { int idx_number = 3; struct ospf *ospf; @@ -5576,27 +5585,6 @@ show_ip_ospf_database_common (struct vty *vty, struct ospf *ospf, return CMD_SUCCESS; } -DEFUN (show_ip_ospf_database, - show_ip_ospf_database_cmd, - "show ip ospf database [<asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as> [A.B.C.D [<self-originate|adv-router A.B.C.D>]]]", - SHOW_STR - IP_STR - "OSPF information\n" - "Database summary\n" - OSPF_LSA_TYPES_DESC - "Link State ID (as an IP address)\n" - "Self-originated link states\n" - "Advertising Router link states\n" - "Advertising Router (as an IP address)\n") -{ - struct ospf *ospf; - - if ((ospf = ospf_lookup()) == NULL || !ospf->oi_running) - return CMD_SUCCESS; - - return (show_ip_ospf_database_common(vty, ospf, 0, argc, argv)); -} - DEFUN (show_ip_ospf_database_max, show_ip_ospf_database_max_cmd, "show ip ospf database <max-age|self-originate>", @@ -5617,7 +5605,7 @@ DEFUN (show_ip_ospf_database_max, DEFUN (show_ip_ospf_instance_database, show_ip_ospf_instance_database_cmd, - "show ip ospf (1-65535) database [<asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as> [A.B.C.D [<self-originate|adv-router A.B.C.D>]]]", + "show ip ospf [(1-65535)] database [<asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as> [A.B.C.D [<self-originate|adv-router A.B.C.D>]]]", SHOW_STR IP_STR "OSPF information\n" @@ -5629,16 +5617,23 @@ DEFUN (show_ip_ospf_instance_database, "Advertising Router link states\n" "Advertising Router (as an IP address)\n") { - int idx_number = 3; struct ospf *ospf; u_short instance = 0; - VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg); + int idx = 0; + if (argv_find (argv, argc, "(1-65535)", &idx)) + { + VTY_GET_INTEGER ("Instance", instance, argv[idx]->arg); + ospf = ospf_lookup_instance (instance); + } + else { + ospf = ospf_lookup(); + } - if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running) + if (!ospf || !ospf->oi_running) return CMD_SUCCESS; - return (show_ip_ospf_database_common(vty, ospf, 1, argc, argv)); + return (show_ip_ospf_database_common(vty, ospf, idx ? 1 : 0, argc, argv)); } DEFUN (show_ip_ospf_instance_database_max, @@ -5750,7 +5745,8 @@ DEFUN (show_ip_ospf_instance_database_type_adv_router, "Database summary\n" OSPF_LSA_TYPES_DESC "Advertising Router link states\n" - "Advertising Router (as an IP address)\n") + "Advertising Router (as an IP address)\n" + "Self-originated link states\n") { int idx_number = 3; struct ospf *ospf; @@ -6898,7 +6894,8 @@ DEFUN_HIDDEN (ospf_priority, "ospf priority (0-255) [A.B.C.D]", "OSPF interface commands\n" "Router priority\n" - "Priority\n") + "Priority\n" + "Address of interface") { return ip_ospf_priority (self, vty, argc, argv); } @@ -7017,7 +7014,8 @@ DEFUN_HIDDEN (ospf_retransmit_interval, "ospf retransmit-interval (3-65535) [A.B.C.D]", "OSPF interface commands\n" "Time between retransmitting lost link state advertisements\n" - "Seconds\n") + "Seconds\n" + "Address of interface") { return ip_ospf_retransmit_interval (self, vty, argc, argv); } @@ -7028,7 +7026,8 @@ DEFUN (no_ip_ospf_retransmit_interval, NO_STR "IP Information\n" "OSPF interface commands\n" - "Time between retransmitting lost link state advertisements\n" //ignored + "Time between retransmitting lost link state advertisements\n" + "Seconds\n" "Address of interface\n") { int idx = 0; @@ -7070,7 +7069,9 @@ DEFUN_HIDDEN (no_ospf_retransmit_interval, "no ospf retransmit-interval [(3-65535)] [A.B.C.D]", NO_STR "OSPF interface commands\n" - "Time between retransmitting lost link state advertisements\n") + "Time between retransmitting lost link state advertisements\n" + "Seconds\n" + "Address of interface\n") { return no_ip_ospf_retransmit_interval (self, vty, argc, argv); } @@ -7118,7 +7119,8 @@ DEFUN_HIDDEN (ospf_transmit_delay, "ospf transmit-delay (1-65535) [A.B.C.D]", "OSPF interface commands\n" "Link state transmit delay\n" - "Seconds\n") + "Seconds\n" + "Address of interface") { return ip_ospf_transmit_delay (self, vty, argc, argv); } @@ -7257,6 +7259,7 @@ DEFUN (no_ip_ospf_area, NO_STR "IP Information\n" "OSPF interface commands\n" + "Instance ID\n" "Disable OSPF on this interface\n" "OSPF area ID in IP address format\n" "OSPF area ID as a decimal value\n") @@ -9205,7 +9208,6 @@ ospf_vty_show_init (void) /* "show ip ospf database" commands. */ install_element (VIEW_NODE, &show_ip_ospf_database_type_adv_router_cmd); - install_element (VIEW_NODE, &show_ip_ospf_database_cmd); install_element (VIEW_NODE, &show_ip_ospf_database_max_cmd); install_element (VIEW_NODE, &show_ip_ospf_instance_database_type_adv_router_cmd); diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c index fefb1fd266..efd21b8067 100644 --- a/ripngd/ripngd.c +++ b/ripngd/ripngd.c @@ -3092,6 +3092,7 @@ ripng_init () /* Install ripng commands. */ install_element (VIEW_NODE, &show_ipv6_ripng_cmd); install_element (VIEW_NODE, &show_ipv6_ripng_status_cmd); + install_element (VIEW_NODE, &show_ipv6_protocols_cmd); install_element (ENABLE_NODE, &clear_ipv6_rip_cmd); diff --git a/tests/test-cli.c b/tests/test-cli.c index e7bed0991e..0590eec713 100644 --- a/tests/test-cli.c +++ b/tests/test-cli.c @@ -30,7 +30,6 @@ DUMMY_DEFUN(cmd2, "arg ipv6 X:X::X:X"); DUMMY_DEFUN(cmd3, "arg ipv6m X:X::X:X/M"); DUMMY_DEFUN(cmd4, "arg range (5-15)"); DUMMY_DEFUN(cmd5, "pat a < a|b>"); -DUMMY_DEFUN(cmd6, "pat b <a|>"); DUMMY_DEFUN(cmd7, "pat c <a | b|c> A.B.C.D"); DUMMY_DEFUN(cmd8, "pat d { foo A.B.C.D|bar X:X::X:X| baz }"); DUMMY_DEFUN(cmd9, "pat e [ WORD ]"); @@ -47,7 +46,6 @@ void test_init(void) install_element (ENABLE_NODE, &cmd3_cmd); install_element (ENABLE_NODE, &cmd4_cmd); install_element (ENABLE_NODE, &cmd5_cmd); - install_element (ENABLE_NODE, &cmd6_cmd); install_element (ENABLE_NODE, &cmd7_cmd); install_element (ENABLE_NODE, &cmd8_cmd); install_element (ENABLE_NODE, &cmd9_cmd); diff --git a/tests/testcli.in b/tests/testcli.in index f4212b9758..5c146ef984 100644 --- a/tests/testcli.in +++ b/tests/testcli.in @@ -50,11 +50,6 @@ pat a ?b pat a c? pat a a x -pat b -pat b ?a -pat b x -pat b x y - pat c a pat c a 1.2.3.4 pat c b 2.3.4 diff --git a/tests/testcli.refout b/tests/testcli.refout index 816227579b..922a620ce6 100644 --- a/tests/testcli.refout +++ b/tests/testcli.refout @@ -1,8 +1,7 @@ test# echo this is a test message
this is a test message
test# echo foo bla
- MESSAGE The message to echo
- <cr>
+% There is no matched command.
test# echo foo bla baz
foo bla baz
test# echo
@@ -116,7 +115,7 @@ cmd4 with 3 args. [01]: range
[02]: 5
test# arg range 9
- <5-15> 02
+ (5-15) 02
test# arg range 9
cmd4 with 3 args.
[00]: arg
@@ -147,7 +146,7 @@ test# pa test# papat
% Command incomplete.
test# pat
-a b c d e f
+a c d e f
test# pat
% Command incomplete.
test#
@@ -173,18 +172,6 @@ test# pat a c test# pat a a x
% [NONE] Unknown command: pat a a x
test#
-test# pat b
-% Command incomplete.
-test# pat b
- a 02
-test# pat b a
-cmd6 with 1 args.
-[00]: a
-test# pat b x
-% [NONE] Unknown command: pat b x
-test# pat b x y
-% [NONE] Unknown command: pat b x y
-test#
test# pat c a
% Command incomplete.
test# pat c a 1.2.3.4
@@ -194,9 +181,7 @@ cmd7 with 4 args. [02]: a
[03]: 1.2.3.4
test# pat c b 2.3.4
-cmd7 with 2 args.
-[00]: b
-[01]: 2.3.4
+% [NONE] Unknown command: pat c b 2.3.4
test# pat c c
A.B.C.D 05
test# pat c c x
diff --git a/tools/cmd_check.py b/tools/cmd_check.py deleted file mode 100755 index bfe90c4392..0000000000 --- a/tools/cmd_check.py +++ /dev/null @@ -1,102 +0,0 @@ -#!/usr/bin/python3 -# Command Checker -# Copyright (C) 2016 Cumulus Networks, Inc. -# -# This file is part of Quagga. -# -# Quagga is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any -# later version. -# -# Quagga is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Quagga; see the file COPYING. If not, write to the Free -# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. -# - -# Parses a source file, ensuring that CLI definitions (DEFUNs, ALIASs, etc) -# have install_command called on them at some point. -import sys -import glob -import re -import os -from pprint import pprint - -# patterns used to extract commands -command_patterns = [ - r'DEF.*\(.*\n\s*([0-9a-z_]*_cmd)', - r'ALIAS.*\(.*\n\s*([0-9a-z_]*_cmd)', -] - -# patterns that count as installing the command -install_patterns = [ - r'install_element.*\(.*{0}', - r'INSTALL.*\(.*{0}' -] - -def process(filename): - cmds = [] - uninstalled = [] - sourcetext = '' - headertext = '' - - # read source file and header file - with open(filename) as cf: - try: - sourcetext = cf.read() - headerfile = filename.replace('.c', '.h') - if os.path.isfile(headerfile): - with open(headerfile) as hf: - headertext = hf.read() - except: - print('Error reading {0}, skipping'.format(filename)) - return - - # build list of defined commands that aren't mentioned in header - for pattern in command_patterns: - matches = re.findall(pattern, sourcetext, re.M) - cmds += filter(lambda x: re.search(x, headertext) is None, matches) - - # build list of not installed commands - for cmd in cmds: - pats = [ ip.format(cmd) for ip in install_patterns ] - if all([ re.search(pat, sourcetext) is None for pat in pats ]): - uninstalled.append(cmd) - - if len(uninstalled) > 0: - print('\033[92m', end='') - print('{0}'.format(filename)) - print('\033[0m', end='') - for cmd in uninstalled: - print(' {0}'.format(cmd)) - print('') - -usage = """ -Usage: - ./cmd_check.py <path> [<path>...] - - where 'path' is a C source file or directory - containing C source files -""" - -if __name__ == '__main__': - if len(sys.argv) < 2: - print(usage) - exit() - - cwd = os.getcwd() - for arg in sys.argv[1:]: - # collect all c files - globstr = arg - if os.path.isdir(arg): - os.chdir(arg) - globstr = '*.c' - for filename in glob.glob(globstr): - process(filename) - os.chdir(cwd) diff --git a/zebra/irdp_interface.c b/zebra/irdp_interface.c index fde759df98..5cabe7e62f 100644 --- a/zebra/irdp_interface.c +++ b/zebra/irdp_interface.c @@ -378,7 +378,8 @@ DEFUN (ip_irdp_multicast, ip_irdp_multicast_cmd, "ip irdp multicast", IP_STR - "ICMP Router discovery on this interface using multicast\n") + "ICMP Router discovery on this interface\n" + "Use multicast mode\n") { VTY_DECLVAR_CONTEXT (interface, ifp); @@ -390,7 +391,8 @@ DEFUN (ip_irdp_broadcast, ip_irdp_broadcast_cmd, "ip irdp broadcast", IP_STR - "ICMP Router discovery on this interface using broadcast\n") + "ICMP Router discovery on this interface\n" + "Use broadcast mode\n") { VTY_DECLVAR_CONTEXT (interface, ifp); @@ -548,9 +550,10 @@ DEFUN (ip_irdp_address_preference, ip_irdp_address_preference_cmd, "ip irdp address A.B.C.D preference (0-2147483647)", IP_STR - "Alter ICMP Router discovery preference this interface\n" - "Specify IRDP non-default preference to advertise\n" + "Alter ICMP Router discovery preference on this interface\n" "Set IRDP address for advertise\n" + "IPv4 address\n" + "Specify IRDP non-default preference to advertise\n" "Preference level\n") { int idx_ipv4 = 3; @@ -590,9 +593,10 @@ DEFUN (no_ip_irdp_address_preference, "no ip irdp address A.B.C.D preference (0-2147483647)", NO_STR IP_STR - "Alter ICMP Router discovery preference this interface\n" - "Removes IRDP non-default preference\n" + "Alter ICMP Router discovery preference on this interface\n" "Select IRDP address\n" + "IPv4 address\n" + "Reset ICMP Router discovery preference on this interface\n" "Old preference level\n") { int idx_ipv4 = 4; @@ -627,7 +631,9 @@ DEFUN (ip_irdp_debug_messages, ip_irdp_debug_messages_cmd, "ip irdp debug messages", IP_STR - "ICMP Router discovery debug Averts. and Solicits (short)\n") + "ICMP Router discovery debug Averts. and Solicits (short)\n" + "IRDP debugging options\n" + "Enable debugging for IRDP messages\n") { VTY_DECLVAR_CONTEXT (interface, ifp); struct zebra_if *zi; @@ -645,7 +651,9 @@ DEFUN (ip_irdp_debug_misc, ip_irdp_debug_misc_cmd, "ip irdp debug misc", IP_STR - "ICMP Router discovery debug Averts. and Solicits (short)\n") + "ICMP Router discovery debug Averts. and Solicits (short)\n" + "IRDP debugging options\n" + "Enable debugging for miscellaneous IRDP events\n") { VTY_DECLVAR_CONTEXT (interface, ifp); struct zebra_if *zi; @@ -663,7 +671,9 @@ DEFUN (ip_irdp_debug_packet, ip_irdp_debug_packet_cmd, "ip irdp debug packet", IP_STR - "ICMP Router discovery debug Averts. and Solicits (short)\n") + "ICMP Router discovery debug Averts. and Solicits (short)\n" + "IRDP debugging options\n" + "Enable debugging for IRDP packets\n") { VTY_DECLVAR_CONTEXT (interface, ifp); struct zebra_if *zi; @@ -682,7 +692,9 @@ DEFUN (ip_irdp_debug_disable, ip_irdp_debug_disable_cmd, "ip irdp debug disable", IP_STR - "ICMP Router discovery debug Averts. and Solicits (short)\n") + "ICMP Router discovery debug Averts. and Solicits (short)\n" + "IRDP debugging options\n" + "Disable debugging for all IRDP events\n") { VTY_DECLVAR_CONTEXT (interface, ifp); struct zebra_if *zi; diff --git a/zebra/rtadv.c b/zebra/rtadv.c index 0d4ce9313e..6a0d01a072 100644 --- a/zebra/rtadv.c +++ b/zebra/rtadv.c @@ -916,6 +916,7 @@ DEFUN (ipv6_nd_ra_interval_msec, "Interface IPv6 config commands\n" "Neighbor discovery\n" "Router Advertisement interval\n" + "Router Advertisement interval in milliseconds\n" "Router Advertisement interval in milliseconds\n") { int idx_number = 4; diff --git a/zebra/zebra_mpls_vty.c b/zebra/zebra_mpls_vty.c index ff84c59432..ee7276f315 100644 --- a/zebra/zebra_mpls_vty.c +++ b/zebra/zebra_mpls_vty.c @@ -786,7 +786,7 @@ DEFUN (show_mpls_table, SHOW_STR MPLS_STR "MPLS table\n" - "JavaScript Object Notation\n") + JSON_STR) { struct zebra_vrf *zvrf; u_char use_json = (argv[3]->arg != NULL); @@ -803,7 +803,7 @@ DEFUN (show_mpls_table_lsp, MPLS_STR "MPLS table\n" "LSP to display information about\n" - "JavaScript Object Notation\n") + JSON_STR) { u_int32_t label; struct zebra_vrf *zvrf; diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c index 54aaef6743..111b55ff78 100644 --- a/zebra/zebra_routemap.c +++ b/zebra/zebra_routemap.c @@ -400,7 +400,9 @@ DEFUN (no_set_src, "no set src [<A.B.C.D|X:X::X:X>]", NO_STR SET_STR - "Source address for route\n") + "Source address for route\n" + "IPv4 address\n" + "IPv6 address\n") { char *ip = (argc == 4) ? argv[3]->arg : NULL; VTY_DECLVAR_CONTEXT (route_map_index, index); @@ -732,8 +734,9 @@ DEFUN (no_ip_protocol_nht_rmap, DEFUN (show_ip_protocol_nht, show_ip_protocol_nht_cmd, "show ip nht route-map", - SHOW_STR - IP_STR + SHOW_STR + IP_STR + "IP nexthop tracking table\n" "IP Next Hop tracking filtering status\n") { int i; @@ -833,9 +836,10 @@ DEFUN (no_ipv6_protocol_nht_rmap, DEFUN (show_ipv6_protocol_nht, show_ipv6_protocol_nht_cmd, "show ipv6 nht route-map", - SHOW_STR - IP6_STR - "IPv6 protocol Next Hop filtering status\n") + SHOW_STR + IP6_STR + "Next Hop filtering status\n" + "Route-map\n") { int i; diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 16a6674695..27189748ad 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -1197,7 +1197,7 @@ DEFUN (show_ip_route, SHOW_STR IP_STR "IP routing table\n" - "JavaScript Object Notation\n") + JSON_STR) { return do_show_ip_route (vty, VRF_DEFAULT_NAME, SAFI_UNICAST, use_json(argc, argv)); } @@ -1293,7 +1293,7 @@ DEFUN (show_ip_route_vrf, IP_STR "IP routing table\n" VRF_CMD_HELP_STR - "JavaScript Object Notation\n") + JSON_STR) { int idx_vrf = 4; u_char uj = use_json(argc, argv); @@ -3877,7 +3877,11 @@ DEFUN (no_ip_zebra_import_table, NO_STR IP_STR "import routes from non-main kernel table\n" - "kernel routing table id\n") + "kernel routing table id\n" + "Distance for imported routes\n" + "Default distance value\n" + "route-map for filtering\n" + "route-map name\n") { u_int32_t table_id = 0; VTY_GET_INTEGER("table", table_id, argv[3]->arg); |
