HAVE_IPV6 introduced. Otherwise looks good. donald
On Thu, Dec 24, 2015 at 1:10 PM, Lou Berger <[email protected]> wrote: > This patch set adds show commands in the form > show bgp <afi> <safi> ... > > Signed-off-by: Lou Berger <[email protected]> > --- > bgpd/bgp_mplsvpn.c | 406 > ++++++++++++++++++++++++++++++++++++++++++----------- > bgpd/bgp_route.c | 321 ++++++++++++++---------------------------- > 2 files changed, 427 insertions(+), 300 deletions(-) > > diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c > index 2d52d9f..9070273 100644 > --- a/bgpd/bgp_mplsvpn.c > +++ b/bgpd/bgp_mplsvpn.c > @@ -467,10 +467,14 @@ enum bgp_show_type > }; > > static int > -bgp_show_mpls_vpn (struct vty *vty, struct prefix_rd *prd, enum > bgp_show_type type, > - void *output_arg, int tags) > +bgp_show_mpls_vpn( > + struct vty *vty, > + afi_t afi, > + struct prefix_rd *prd, > + enum bgp_show_type type, > + void *output_arg, > + int tags) > { > - afi_t afi = AFI_IP; > struct bgp *bgp; > struct bgp_table *table; > struct bgp_node *rn; > @@ -571,25 +575,37 @@ bgp_show_mpls_vpn (struct vty *vty, struct prefix_rd > *prd, enum bgp_show_type ty > return CMD_SUCCESS; > } > > -DEFUN (show_ip_bgp_vpnv4_all, > - show_ip_bgp_vpnv4_all_cmd, > - "show ip bgp vpnv4 all", > +DEFUN (show_bgp_ipv4_vpn, > + show_bgp_ipv4_vpn_cmd, > + "show bgp ipv4 vpn", > SHOW_STR > - IP_STR > BGP_STR > - "Display VPNv4 NLRI specific information\n" > - "Display information about all VPNv4 NLRIs\n") > + "Address Family\n" > + "Display VPN NLRI specific information\n") > { > - return bgp_show_mpls_vpn (vty, NULL, bgp_show_type_normal, NULL, 0); > + return bgp_show_mpls_vpn (vty, AFI_IP, NULL, bgp_show_type_normal, > NULL, 0); > } > > -DEFUN (show_ip_bgp_vpnv4_rd, > - show_ip_bgp_vpnv4_rd_cmd, > - "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn", > +#ifdef HAVE_IPV6 > +DEFUN (show_bgp_ipv6_vpn, > + show_bgp_ipv6_vpn_cmd, > + "show bgp ipv6 vpn", > SHOW_STR > - IP_STR > BGP_STR > - "Display VPNv4 NLRI specific information\n" > + "Address Family\n" > + "Display VPN NLRI specific information\n") > +{ > + return bgp_show_mpls_vpn (vty, AFI_IP6, NULL, bgp_show_type_normal, > NULL, 0); > +} > +#endif > + > +DEFUN (show_bgp_ipv4_vpn_rd, > + show_bgp_ipv4_vpn_rd_cmd, > + "show bgp ipv4 vpn rd ASN:nn_or_IP-address:nn", > + SHOW_STR > + BGP_STR > + "Address Family\n" > + "Display VPN NLRI specific information\n" > "Display information for a route distinguisher\n" > "VPN Route Distinguisher\n") > { > @@ -602,29 +618,84 @@ DEFUN (show_ip_bgp_vpnv4_rd, > vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); > return CMD_WARNING; > } > - return bgp_show_mpls_vpn (vty, &prd, bgp_show_type_normal, NULL, 0); > + return bgp_show_mpls_vpn (vty, AFI_IP, &prd, bgp_show_type_normal, > NULL, 0); > } > > -DEFUN (show_ip_bgp_vpnv4_all_tags, > - show_ip_bgp_vpnv4_all_tags_cmd, > - "show ip bgp vpnv4 all tags", > +DEFUN (show_bgp_ipv6_vpn_rd, > + show_bgp_ipv6_vpn_rd_cmd, > + "show bgp ipv6 vpn rd ASN:nn_or_IP-address:nn", > SHOW_STR > - IP_STR > BGP_STR > - "Display VPNv4 NLRI specific information\n" > - "Display information about all VPNv4 NLRIs\n" > + "Address Family\n" > + "Display VPN NLRI specific information\n" > + "Display information for a route distinguisher\n" > + "VPN Route Distinguisher\n") > +{ > + int ret; > + struct prefix_rd prd; > + > + ret = str2prefix_rd (argv[0], &prd); > + if (! ret) > + { > + vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); > + return CMD_WARNING; > + } > + return bgp_show_mpls_vpn (vty, AFI_IP6, &prd, bgp_show_type_normal, > NULL, 0); > +} > + > + > +DEFUN (show_bgp_ipv4_vpn_tags, > + show_bgp_ipv4_vpn_tags_cmd, > + "show bgp ipv4 vpn tags", > + SHOW_STR > + BGP_STR > + "Address Family\n" > + "Display VPN NLRI specific information\n" > "Display BGP tags for prefixes\n") > { > - return bgp_show_mpls_vpn (vty, NULL, bgp_show_type_normal, NULL, 1); > + return bgp_show_mpls_vpn (vty, AFI_IP, NULL, bgp_show_type_normal, > NULL, 1); > } > +DEFUN (show_bgp_ipv6_vpn_tags, > + show_bgp_ipv6_vpn_tags_cmd, > + "show bgp ipv6 vpn tags", > + SHOW_STR > + BGP_STR > + "Address Family\n" > + "Display VPN NLRI specific information\n" > + "Display BGP tags for prefixes\n") > +{ > + return bgp_show_mpls_vpn (vty, AFI_IP6, NULL, bgp_show_type_normal, > NULL, 1); > +} > + > +DEFUN (show_bgp_ipv4_vpn_rd_tags, > + show_bgp_ipv4_vpn_rd_tags_cmd, > + "show bgp ipv4 vpn rd ASN:nn_or_IP-address:nn tags", > + SHOW_STR > + BGP_STR > + "Address Family\n" > + "Display VPN NLRI specific information\n" > + "Display information for a route distinguisher\n" > + "VPN Route Distinguisher\n" > + "Display BGP tags for prefixes\n") > +{ > + int ret; > + struct prefix_rd prd; > > -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", > + ret = str2prefix_rd (argv[0], &prd); > + if (! ret) > + { > + vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); > + return CMD_WARNING; > + } > + return bgp_show_mpls_vpn (vty, AFI_IP, &prd, bgp_show_type_normal, > NULL, 1); > +} > +DEFUN (show_bgp_ipv6_vpn_rd_tags, > + show_bgp_ipv6_vpn_rd_tags_cmd, > + "show bgp ipv6 vpn rd ASN:nn_or_IP-address:nn tags", > SHOW_STR > - IP_STR > BGP_STR > - "Display VPNv4 NLRI specific information\n" > + "Address Family\n" > + "Display VPN NLRI specific information\n" > "Display information for a route distinguisher\n" > "VPN Route Distinguisher\n" > "Display BGP tags for prefixes\n") > @@ -638,19 +709,19 @@ DEFUN (show_ip_bgp_vpnv4_rd_tags, > vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); > return CMD_WARNING; > } > - return bgp_show_mpls_vpn (vty, &prd, bgp_show_type_normal, NULL, 1); > + return bgp_show_mpls_vpn (vty, AFI_IP6, &prd, bgp_show_type_normal, > NULL, 1); > } > > -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", > +DEFUN (show_bgp_ipv4_vpn_neighbor_routes, > + show_bgp_ipv4_vpn_neighbor_routes_cmd, > + "show bgp ipv4 vpn neighbors (A.B.C.D|X:X::X:X) routes", > SHOW_STR > - IP_STR > BGP_STR > - "Display VPNv4 NLRI specific information\n" > - "Display information about all VPNv4 NLRIs\n" > + "Address Family\n" > + "Display VPN NLRI specific information\n" > "Detailed information on TCP and BGP neighbor connections\n" > "Neighbor to display information about\n" > + "Neighbor to display information about\n" > "Display routes learned from neighbor\n") > { > union sockunion su; > @@ -671,35 +742,28 @@ DEFUN (show_ip_bgp_vpnv4_all_neighbor_routes, > return CMD_WARNING; > } > > - return bgp_show_mpls_vpn (vty, NULL, bgp_show_type_neighbor, &su, 0); > + return bgp_show_mpls_vpn (vty, AFI_IP, NULL, bgp_show_type_neighbor, > &su, 0); > } > > -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", > +#ifdef HAVE_IPV6 > +DEFUN (show_bgp_ipv6_vpn_neighbor_routes, > + show_bgp_ipv6_vpn_neighbor_routes_cmd, > + "show bgp ipv6 vpn neighbors (A.B.C.D|X:X::X:X) routes", > SHOW_STR > - IP_STR > BGP_STR > - "Display VPNv4 NLRI specific information\n" > - "Display information for a route distinguisher\n" > - "VPN Route Distinguisher\n" > + "Address Family\n" > + "Display VPN NLRI specific information\n" > "Detailed information on TCP and BGP neighbor connections\n" > "Neighbor to display information about\n" > + "Neighbor to display information about\n" > "Display routes learned from neighbor\n") > { > - int ret; > union sockunion su; > struct peer *peer; > - struct prefix_rd prd; > > - ret = str2prefix_rd (argv[0], &prd); > - if (! ret) > - { > - vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); > - return CMD_WARNING; > - } > + int ret; > > - ret = str2sockunion (argv[1], &su); > + ret = str2sockunion (argv[0], &su); > if (ret < 0) > { > vty_out (vty, "Malformed address: %s%s", argv[0], VTY_NEWLINE); > @@ -707,23 +771,23 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_routes, > } > > peer = peer_lookup (NULL, &su); > - if (! peer || ! peer->afc[AFI_IP][SAFI_MPLS_VPN]) > + if (! peer || ! peer->afc[AFI_IP6][SAFI_MPLS_VPN]) > { > vty_out (vty, "%% No such neighbor or address family%s", > VTY_NEWLINE); > return CMD_WARNING; > } > > - return bgp_show_mpls_vpn (vty, &prd, bgp_show_type_neighbor, &su, 0); > + return bgp_show_mpls_vpn (vty, AFI_IP6, NULL, bgp_show_type_neighbor, > &su, 0); > } > +#endif > > -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", > +DEFUN (show_bgp_ipv4_vpn_neighbor_advertised_routes, > + show_bgp_ipv4_vpn_neighbor_advertised_routes_cmd, > + "show bgp ipv4 vpn neighbors (A.B.C.D|X:X::X:X) advertised-routes", > SHOW_STR > - IP_STR > BGP_STR > - "Display VPNv4 NLRI specific information\n" > - "Display information about all VPNv4 NLRIs\n" > + "Address Family\n" > + "Display VPN NLRI specific information\n" > "Detailed information on TCP and BGP neighbor connections\n" > "Neighbor to display information about\n" > "Display the routes advertised to a BGP neighbor\n") > @@ -747,29 +811,59 @@ DEFUN > (show_ip_bgp_vpnv4_all_neighbor_advertised_routes, > > return show_adj_route_vpn (vty, peer, NULL); > } > +DEFUN (show_bgp_ipv6_vpn_neighbor_advertised_routes, > + show_bgp_ipv6_vpn_neighbor_advertised_routes_cmd, > + "show bgp ipv6 vpn neighbors (A.B.C.D|X:X::X:X) advertised-routes", > + SHOW_STR > + BGP_STR > + "Address Family\n" > + "Display VPN NLRI specific information\n" > + "Detailed information on TCP and BGP neighbor connections\n" > + "Neighbor to display information about\n" > + "Display the routes advertised to a BGP neighbor\n") > +{ > + int ret; > + struct peer *peer; > + union sockunion su; > + > + ret = str2sockunion (argv[0], &su); > + if (ret < 0) > + { > + vty_out (vty, "%% Malformed address: %s%s", argv[0], VTY_NEWLINE); > + return CMD_WARNING; > + } > + peer = peer_lookup (NULL, &su); > + if (! peer || ! peer->afc[AFI_IP6][SAFI_MPLS_VPN]) > + { > + vty_out (vty, "%% No such neighbor or address family%s", > VTY_NEWLINE); > + return CMD_WARNING; > + } > + > + return show_adj_route_vpn (vty, peer, NULL); > +} > > 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", > + show_bgp_ipv4_vpn_rd_neighbor_advertised_routes_cmd, > + "show bgp ipv4 vpn rd ASN:nn_or_IP-address:nn neighbors > (A.B.C.D|X:X::X:X) advertised-routes", > SHOW_STR > - IP_STR > BGP_STR > - "Display VPNv4 NLRI specific information\n" > + "Address Family\n" > + "Display VPN NLRI specific information\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" > "Display the routes advertised to a BGP neighbor\n") > { > int ret; > struct peer *peer; > struct prefix_rd prd; > union sockunion su; > - > ret = str2sockunion (argv[1], &su); > if (ret < 0) > { > - vty_out (vty, "%% Malformed address: %s%s", argv[0], VTY_NEWLINE); > + vty_out (vty, "%% Malformed address: %s%s", argv[1], VTY_NEWLINE); > return CMD_WARNING; > } > peer = peer_lookup (NULL, &su); > @@ -788,6 +882,129 @@ DEFUN > (show_ip_bgp_vpnv4_rd_neighbor_advertised_routes, > > return show_adj_route_vpn (vty, peer, &prd); > } > +DEFUN (show_ip_bgp_vpnv6_rd_neighbor_advertised_routes, > + show_bgp_ipv6_vpn_rd_neighbor_advertised_routes_cmd, > + "show bgp ipv6 vpn rd ASN:nn_or_IP-address:nn neighbors > (A.B.C.D|X:X::X:X) advertised-routes", > + SHOW_STR > + BGP_STR > + "Address Family\n" > + "Display VPN NLRI specific information\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" > + "Display the routes advertised to a BGP neighbor\n") > +{ > + int ret; > + struct peer *peer; > + struct prefix_rd prd; > + union sockunion su; > + ret = str2sockunion (argv[1], &su); > + if (ret < 0) > + { > + vty_out (vty, "%% Malformed address: %s%s", argv[1], VTY_NEWLINE); > + return CMD_WARNING; > + } > + peer = peer_lookup (NULL, &su); > + if (! peer || ! peer->afc[AFI_IP6][SAFI_MPLS_VPN]) > + { > + vty_out (vty, "%% No such neighbor or address family%s", > VTY_NEWLINE); > + return CMD_WARNING; > + } > + > + ret = str2prefix_rd (argv[0], &prd); > + if (! ret) > + { > + vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); > + return CMD_WARNING; > + } > + > + return show_adj_route_vpn (vty, peer, &prd); > +} > + > +DEFUN (show_bgp_ipv4_vpn_rd_neighbor_routes, > + show_bgp_ipv4_vpn_rd_neighbor_routes_cmd, > + "show bgp ipv4 vpn rd ASN:nn_or_IP-address:nn neighbors > (A.B.C.D|X:X::X:X) routes", > + SHOW_STR > + BGP_STR > + "Address Family\n" > + "Address Family modifier\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" > + "Display routes learned from neighbor\n") > +{ > + int ret; > + union sockunion *su; > + struct peer *peer; > + struct prefix_rd prd; > + > + ret = str2prefix_rd (argv[0], &prd); > + if (! ret) > + { > + vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); > + return CMD_WARNING; > + } > + > + su = sockunion_str2su (argv[1]); > + if (su == NULL) > + { > + vty_out (vty, "Malformed address: %s%s", argv[1], VTY_NEWLINE); > + return CMD_WARNING; > + } > + > + peer = peer_lookup (NULL, su); > + if (! peer || ! peer->afc[AFI_IP][SAFI_MPLS_VPN]) > + { > + vty_out (vty, "%% No such neighbor or address family%s", > VTY_NEWLINE); > + return CMD_WARNING; > + } > + > + return bgp_show_mpls_vpn (vty, AFI_IP, &prd, bgp_show_type_neighbor, > su, 0); > +} > +DEFUN (show_bgp_ipv6_vpn_rd_neighbor_routes, > + show_bgp_ipv6_vpn_rd_neighbor_routes_cmd, > + "show bgp ipv6 vpn rd ASN:nn_or_IP-address:nn neighbors > (A.B.C.D|X:X::X:X) routes", > + SHOW_STR > + BGP_STR > + "Address Family\n" > + "Address Family modifier\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" > + "Display routes learned from neighbor\n") > +{ > + int ret; > + union sockunion *su; > + struct peer *peer; > + struct prefix_rd prd; > + > + ret = str2prefix_rd (argv[0], &prd); > + if (! ret) > + { > + vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); > + return CMD_WARNING; > + } > + > + su = sockunion_str2su (argv[1]); > + if (su == NULL) > + { > + vty_out (vty, "Malformed address: %s%s", argv[1], VTY_NEWLINE); > + return CMD_WARNING; > + } > + > + peer = peer_lookup (NULL, su); > + if (! peer || ! peer->afc[AFI_IP6][SAFI_MPLS_VPN]) > + { > + vty_out (vty, "%% No such neighbor or address family%s", > VTY_NEWLINE); > + return CMD_WARNING; > + } > + > + return bgp_show_mpls_vpn (vty, AFI_IP6, &prd, bgp_show_type_neighbor, > su, 0); > +} > > void > bgp_mplsvpn_init (void) > @@ -796,22 +1013,43 @@ bgp_mplsvpn_init (void) > install_element (BGP_VPNV4_NODE, &vpnv4_network_route_map_cmd); > install_element (BGP_VPNV4_NODE, &no_vpnv4_network_cmd); > > - > - install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_cmd); > - install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_cmd); > - install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_tags_cmd); > - install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_tags_cmd); > - install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbor_routes_cmd); > - install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbor_routes_cmd); > - install_element (VIEW_NODE, > &show_ip_bgp_vpnv4_all_neighbor_advertised_routes_cmd); > - install_element (VIEW_NODE, > &show_ip_bgp_vpnv4_rd_neighbor_advertised_routes_cmd); > - > - install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_cmd); > - install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_cmd); > - install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_tags_cmd); > - install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_tags_cmd); > - install_element (ENABLE_NODE, > &show_ip_bgp_vpnv4_all_neighbor_routes_cmd); > - install_element (ENABLE_NODE, > &show_ip_bgp_vpnv4_rd_neighbor_routes_cmd); > - install_element (ENABLE_NODE, > &show_ip_bgp_vpnv4_all_neighbor_advertised_routes_cmd); > - install_element (ENABLE_NODE, > &show_ip_bgp_vpnv4_rd_neighbor_advertised_routes_cmd); > + install_element (VIEW_NODE, &show_bgp_ipv4_vpn_cmd); > + install_element (VIEW_NODE, &show_bgp_ipv4_vpn_rd_cmd); > + install_element (VIEW_NODE, &show_bgp_ipv4_vpn_tags_cmd); > + install_element (VIEW_NODE, &show_bgp_ipv4_vpn_rd_tags_cmd); > + install_element (VIEW_NODE, &show_bgp_ipv4_vpn_neighbor_routes_cmd); > + install_element (VIEW_NODE, > &show_bgp_ipv4_vpn_neighbor_advertised_routes_cmd); > + install_element (VIEW_NODE, > &show_bgp_ipv4_vpn_rd_neighbor_advertised_routes_cmd); > + install_element (VIEW_NODE, &show_bgp_ipv4_vpn_rd_neighbor_routes_cmd); > + > +#ifdef HAVE_IPV6 > + install_element (VIEW_NODE, &show_bgp_ipv6_vpn_cmd); > + install_element (VIEW_NODE, &show_bgp_ipv6_vpn_rd_cmd); > + install_element (VIEW_NODE, &show_bgp_ipv6_vpn_tags_cmd); > + install_element (VIEW_NODE, &show_bgp_ipv6_vpn_rd_tags_cmd); > + install_element (VIEW_NODE, &show_bgp_ipv6_vpn_neighbor_routes_cmd); > + install_element (VIEW_NODE, > &show_bgp_ipv6_vpn_neighbor_advertised_routes_cmd); > + install_element (VIEW_NODE, > &show_bgp_ipv6_vpn_rd_neighbor_advertised_routes_cmd); > + install_element (VIEW_NODE, &show_bgp_ipv6_vpn_rd_neighbor_routes_cmd); > +#endif > + > + install_element (ENABLE_NODE, &show_bgp_ipv4_vpn_cmd); > + install_element (ENABLE_NODE, &show_bgp_ipv4_vpn_rd_cmd); > + install_element (ENABLE_NODE, &show_bgp_ipv4_vpn_tags_cmd); > + install_element (ENABLE_NODE, &show_bgp_ipv4_vpn_rd_tags_cmd); > + install_element (ENABLE_NODE, &show_bgp_ipv4_vpn_neighbor_routes_cmd); > + install_element (ENABLE_NODE, > &show_bgp_ipv4_vpn_neighbor_advertised_routes_cmd); > + install_element (ENABLE_NODE, > &show_bgp_ipv4_vpn_rd_neighbor_advertised_routes_cmd); > + install_element (ENABLE_NODE, > &show_bgp_ipv4_vpn_rd_neighbor_routes_cmd); > + > +#ifdef HAVE_IPV6 > + install_element (ENABLE_NODE, &show_bgp_ipv6_vpn_cmd); > + install_element (ENABLE_NODE, &show_bgp_ipv6_vpn_rd_cmd); > + install_element (ENABLE_NODE, &show_bgp_ipv6_vpn_tags_cmd); > + install_element (ENABLE_NODE, &show_bgp_ipv6_vpn_rd_tags_cmd); > + install_element (ENABLE_NODE, &show_bgp_ipv6_vpn_neighbor_routes_cmd); > + install_element (ENABLE_NODE, > &show_bgp_ipv6_vpn_neighbor_advertised_routes_cmd); > + install_element (ENABLE_NODE, > &show_bgp_ipv6_vpn_rd_neighbor_advertised_routes_cmd); > + install_element (ENABLE_NODE, > &show_bgp_ipv6_vpn_rd_neighbor_routes_cmd); > +#endif > } > diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c > index 036d27d..53f33a4 100644 > --- a/bgpd/bgp_route.c > +++ b/bgpd/bgp_route.c > @@ -6951,21 +6951,10 @@ bgp_show_route (struct vty *vty, const char > *view_name, const char *ip_str, > } > > /* BGP route print out function. */ > -DEFUN (show_ip_bgp, > - show_ip_bgp_cmd, > - "show ip bgp", > - SHOW_STR > - IP_STR > - BGP_STR) > -{ > - return bgp_show (vty, NULL, AFI_IP, SAFI_UNICAST, bgp_show_type_normal, > NULL); > -} > - > -DEFUN (show_ip_bgp_ipv4, > - show_ip_bgp_ipv4_cmd, > - "show ip bgp ipv4 (unicast|multicast)", > +DEFUN (show_bgp_ipv4_safi, > + show_bgp_ipv4_safi_cmd, > + "show bgp ipv4 (unicast|multicast)", > SHOW_STR > - IP_STR > BGP_STR > "Address family\n" > "Address Family modifier\n" > @@ -6978,31 +6967,10 @@ DEFUN (show_ip_bgp_ipv4, > return bgp_show (vty, NULL, AFI_IP, SAFI_UNICAST, bgp_show_type_normal, > NULL); > } > > -ALIAS (show_ip_bgp_ipv4, > - show_bgp_ipv4_safi_cmd, > - "show bgp ipv4 (unicast|multicast)", > - SHOW_STR > - BGP_STR > - "Address family\n" > - "Address Family modifier\n" > - "Address Family modifier\n") > - > -DEFUN (show_ip_bgp_route, > - show_ip_bgp_route_cmd, > - "show ip bgp A.B.C.D", > - SHOW_STR > - IP_STR > - BGP_STR > - "Network in the BGP routing table to display\n") > -{ > - return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL, > 0); > -} > - > -DEFUN (show_ip_bgp_ipv4_route, > - show_ip_bgp_ipv4_route_cmd, > - "show ip bgp ipv4 (unicast|multicast) A.B.C.D", > +DEFUN (show_bgp_ipv4_safi_route, > + show_bgp_ipv4_safi_route_cmd, > + "show bgp ipv4 (unicast|multicast) A.B.C.D", > SHOW_STR > - IP_STR > BGP_STR > "Address family\n" > "Address Family modifier\n" > @@ -7015,36 +6983,39 @@ DEFUN (show_ip_bgp_ipv4_route, > return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, NULL, > 0); > } > > -ALIAS (show_ip_bgp_ipv4_route, > - show_bgp_ipv4_safi_route_cmd, > - "show bgp ipv4 (unicast|multicast) A.B.C.D", > +DEFUN (show_bgp_ipv4_vpn_route, > + show_bgp_ipv4_vpn_route_cmd, > + "show bgp ipv4 vpn A.B.C.D", > SHOW_STR > BGP_STR > - "Address family\n" > - "Address Family modifier\n" > - "Address Family modifier\n" > + "Address Family\n" > + "Display VPN NLRI specific information\n" > "Network in the BGP routing table to display\n") > +{ > + return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_MPLS_VPN, NULL, > 0); > +} > > -DEFUN (show_ip_bgp_vpnv4_all_route, > - show_ip_bgp_vpnv4_all_route_cmd, > - "show ip bgp vpnv4 all A.B.C.D", > +#ifdef HAVE_IPV6 > +DEFUN (show_bgp_ipv6_vpn_route, > + show_bgp_ipv6_vpn_route_cmd, > + "show bgp ipv6 vpn X:X::X:X", > SHOW_STR > - IP_STR > BGP_STR > - "Display VPNv4 NLRI specific information\n" > - "Display information about all VPNv4 NLRIs\n" > + "Address Family\n" > + "Display VPN NLRI specific information\n" > "Network in the BGP routing table to display\n") > { > - return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_MPLS_VPN, NULL, > 0); > + return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_MPLS_VPN, > NULL, 0); > } > +#endif > > -DEFUN (show_ip_bgp_vpnv4_rd_route, > - show_ip_bgp_vpnv4_rd_route_cmd, > - "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn A.B.C.D", > +DEFUN (show_bgp_ipv4_vpn_rd_route, > + show_bgp_ipv4_vpn_rd_route_cmd, > + "show bgp ipv4 vpn rd ASN:nn_or_IP-address:nn A.B.C.D", > SHOW_STR > - IP_STR > BGP_STR > - "Display VPNv4 NLRI specific information\n" > + IP_STR > + "Display VPN NLRI specific information\n" > "Display information for a route distinguisher\n" > "VPN Route Distinguisher\n" > "Network in the BGP routing table to display\n") > @@ -7061,15 +7032,27 @@ DEFUN (show_ip_bgp_vpnv4_rd_route, > return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MPLS_VPN, &prd, > 0); > } > > -DEFUN (show_ip_bgp_prefix, > - show_ip_bgp_prefix_cmd, > - "show ip bgp A.B.C.D/M", > +DEFUN (show_bgp_ipv6_vpn_rd_route, > + show_bgp_ipv6_vpn_rd_route_cmd, > + "show bgp ipv6 vpn rd ASN:nn_or_IP-address:nn X:X::X:X", > SHOW_STR > - IP_STR > BGP_STR > - "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") > + "Address Family\n" > + "Display VPN NLRI specific information\n" > + "Display information for a route distinguisher\n" > + "VPN Route Distinguisher\n" > + "Network in the BGP routing table to display\n") > { > - return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL, > 1); > + int ret; > + struct prefix_rd prd; > + > + ret = str2prefix_rd (argv[0], &prd); > + if (! ret) > + { > + vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); > + return CMD_WARNING; > + } > + return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_MPLS_VPN, > &prd, 0); > } > > DEFUN (show_ip_bgp_ipv4_prefix, > @@ -7157,87 +7140,58 @@ DEFUN (show_ip_bgp_view, > return bgp_show (vty, bgp, AFI_IP, SAFI_UNICAST, bgp_show_type_normal, > NULL); > } > > -DEFUN (show_ip_bgp_view_route, > - show_ip_bgp_view_route_cmd, > - "show ip bgp view WORD A.B.C.D", > +DEFUN (show_bgp_ipv4_prefix, > + show_bgp_ipv4_prefix_cmd, > + "show bgp ipv4 A.B.C.D/M", > SHOW_STR > - IP_STR > BGP_STR > - "BGP view\n" > - "View name\n" > - "Network in the BGP routing table to display\n") > -{ > - return bgp_show_route (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST, > NULL, 0); > -} > - > -DEFUN (show_ip_bgp_view_prefix, > - show_ip_bgp_view_prefix_cmd, > - "show ip bgp view WORD A.B.C.D/M", > - SHOW_STR > IP_STR > - BGP_STR > - "BGP view\n" > - "View name\n" > "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") > { > - return bgp_show_route (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST, > NULL, 1); > -} > - > -#ifdef HAVE_IPV6 > -DEFUN (show_bgp, > - show_bgp_cmd, > - "show bgp", > - SHOW_STR > - BGP_STR) > -{ > - return bgp_show (vty, NULL, AFI_IP6, SAFI_UNICAST, bgp_show_type_normal, > - NULL); > + return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL, > 1); > } > > -ALIAS (show_bgp, > - show_bgp_ipv6_cmd, > - "show bgp ipv6", > - SHOW_STR > - BGP_STR > - "Address family\n") > - > -DEFUN (show_bgp_ipv6_safi, > - show_bgp_ipv6_safi_cmd, > - "show bgp ipv6 (unicast|multicast)", > +DEFUN (show_bgp_ipv4_safi_prefix, > + show_bgp_ipv4_safi_prefix_cmd, > + "show bgp ipv4 (unicast|multicast) A.B.C.D/M", > SHOW_STR > BGP_STR > "Address family\n" > "Address Family modifier\n" > - "Address Family modifier\n") > + "Address Family modifier\n" > + "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") > { > if (strncmp (argv[0], "m", 1) == 0) > - return bgp_show (vty, NULL, AFI_IP6, SAFI_MULTICAST, > bgp_show_type_normal, > - NULL); > + return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MULTICAST, > NULL, 1); > > - return bgp_show (vty, NULL, AFI_IP6, SAFI_UNICAST, > bgp_show_type_normal, NULL); > + return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, NULL, > 1); > } > > -/* old command */ > -DEFUN (show_ipv6_bgp, > - show_ipv6_bgp_cmd, > - "show ipv6 bgp", > +DEFUN (show_bgp_ipv4_vpn_prefix, > + show_bgp_ipv4_vpn_prefix_cmd, > + "show bgp ipv4 vpn A.B.C.D/M", > SHOW_STR > + BGP_STR > IP_STR > - BGP_STR) > + "Display VPN NLRI specific information\n" > + "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") > { > - return bgp_show (vty, NULL, AFI_IP6, SAFI_UNICAST, bgp_show_type_normal, > - NULL); > + return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_MPLS_VPN, NULL, > 1); > } > > -DEFUN (show_bgp_route, > - show_bgp_route_cmd, > - "show bgp X:X::X:X", > +#ifdef HAVE_IPV6 > +DEFUN (show_bgp_ipv6_vpn_prefix, > + show_bgp_ipv6_vpn_prefix_cmd, > + "show bgp ipv6 vpn X:X::X:X/M", > SHOW_STR > BGP_STR > - "Network in the BGP routing table to display\n") > + "Address Family\n" > + "Display VPN NLRI specific information\n" > + "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") > { > - return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, > 0); > + return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_MPLS_VPN, > NULL, 1); > } > +#endif > > ALIAS (show_bgp_route, > show_bgp_ipv6_route_cmd, > @@ -7263,36 +7217,44 @@ DEFUN (show_bgp_ipv6_safi_route, > return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL, > 0); > } > > -/* old command */ > -DEFUN (show_ipv6_bgp_route, > - show_ipv6_bgp_route_cmd, > - "show ipv6 bgp X:X::X:X", > +DEFUN (show_bgp_ipv6_route, > + show_bgp_ipv6_route_cmd, > + "show bgp ipv6 X:X::X:X", > SHOW_STR > - IP_STR > BGP_STR > + "Address family\n" > "Network in the BGP routing table to display\n") > { > return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, > 0); > } > > -DEFUN (show_bgp_prefix, > - show_bgp_prefix_cmd, > - "show bgp X:X::X:X/M", > +DEFUN (show_bgp_ipv6_safi_route, > + show_bgp_ipv6_safi_route_cmd, > + "show bgp ipv6 (unicast|multicast) X:X::X:X", > SHOW_STR > BGP_STR > - "IPv6 prefix <network>/<length>\n") > + "Address family\n" > + "Address Family modifier\n" > + "Address Family modifier\n" > + "Network in the BGP routing table to display\n") > { > - return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, > 1); > + if (strncmp (argv[0], "m", 1) == 0) > + return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, > NULL, 0); > + > + return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL, > 0); > } > > -ALIAS (show_bgp_prefix, > +/* new002 */ > +DEFUN (show_bgp_ipv6_prefix, > show_bgp_ipv6_prefix_cmd, > "show bgp ipv6 X:X::X:X/M", > SHOW_STR > BGP_STR > "Address family\n" > - "IPv6 prefix <network>/<length>\n") > - > + "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n") > +{ > + return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, > 1); > +} > DEFUN (show_bgp_ipv6_safi_prefix, > show_bgp_ipv6_safi_prefix_cmd, > "show bgp ipv6 (unicast|multicast) X:X::X:X/M", > @@ -7309,25 +7271,14 @@ DEFUN (show_bgp_ipv6_safi_prefix, > return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL, > 1); > } > > -/* old command */ > -DEFUN (show_ipv6_bgp_prefix, > - show_ipv6_bgp_prefix_cmd, > - "show ipv6 bgp X:X::X:X/M", > - SHOW_STR > - IP_STR > - BGP_STR > - "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n") > -{ > - return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, > 1); > -} > - > DEFUN (show_bgp_view, > - show_bgp_view_cmd, > - "show bgp view WORD", > + show_bgp_view_ipv6_cmd, > + "show bgp view WORD ipv6", > SHOW_STR > - BGP_STR > + BGP_STR > "BGP view\n" > - "View name\n") > + "View name\n" > + "Address family\n") > { > struct bgp *bgp; > > @@ -7341,29 +7292,8 @@ DEFUN (show_bgp_view, > > return bgp_show (vty, bgp, AFI_IP6, SAFI_UNICAST, bgp_show_type_normal, > NULL); > } > - > -ALIAS (show_bgp_view, > - show_bgp_view_ipv6_cmd, > - "show bgp view WORD ipv6", > - SHOW_STR > - BGP_STR > - "BGP view\n" > - "View name\n" > - "Address family\n") > > DEFUN (show_bgp_view_route, > - show_bgp_view_route_cmd, > - "show bgp view WORD X:X::X:X", > - SHOW_STR > - BGP_STR > - "BGP view\n" > - "View name\n" > - "Network in the BGP routing table to display\n") > -{ > - return bgp_show_route (vty, argv[0], argv[1], AFI_IP6, SAFI_UNICAST, > NULL, 0); > -} > - > -ALIAS (show_bgp_view_route, > show_bgp_view_ipv6_route_cmd, > "show bgp view WORD ipv6 X:X::X:X", > SHOW_STR > @@ -7372,20 +7302,11 @@ ALIAS (show_bgp_view_route, > "View name\n" > "Address family\n" > "Network in the BGP routing table to display\n") > - > -DEFUN (show_bgp_view_prefix, > - show_bgp_view_prefix_cmd, > - "show bgp view WORD X:X::X:X/M", > - SHOW_STR > - BGP_STR > - "BGP view\n" > - "View name\n" > - "IPv6 prefix <network>/<length>\n") > { > - return bgp_show_route (vty, argv[0], argv[1], AFI_IP6, SAFI_UNICAST, > NULL, 1); > + return bgp_show_route (vty, argv[0], argv[1], AFI_IP6, SAFI_UNICAST, > NULL, 0); > } > > -ALIAS (show_bgp_view_prefix, > +DEFUN (show_bgp_view_prefix, > show_bgp_view_ipv6_prefix_cmd, > "show bgp view WORD ipv6 X:X::X:X/M", > SHOW_STR > @@ -7394,42 +7315,10 @@ ALIAS (show_bgp_view_prefix, > "View name\n" > "Address family\n" > "IPv6 prefix <network>/<length>\n") > - > -/* old command */ > -DEFUN (show_ipv6_mbgp, > - show_ipv6_mbgp_cmd, > - "show ipv6 mbgp", > - SHOW_STR > - IP_STR > - MBGP_STR) > { > - return bgp_show (vty, NULL, AFI_IP6, SAFI_MULTICAST, > bgp_show_type_normal, > - NULL); > -} > - > -/* old command */ > -DEFUN (show_ipv6_mbgp_route, > - show_ipv6_mbgp_route_cmd, > - "show ipv6 mbgp X:X::X:X", > - SHOW_STR > - IP_STR > - MBGP_STR > - "Network in the MBGP routing table to display\n") > -{ > - return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_MULTICAST, > NULL, 0); > + return bgp_show_route (vty, argv[0], argv[1], AFI_IP6, SAFI_UNICAST, > NULL, 1); > } > > -/* old command */ > -DEFUN (show_ipv6_mbgp_prefix, > - show_ipv6_mbgp_prefix_cmd, > - "show ipv6 mbgp X:X::X:X/M", > - SHOW_STR > - IP_STR > - MBGP_STR > - "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n") > -{ > - return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_MULTICAST, > NULL, 1); > -} > #endif > > > @@ -7604,12 +7493,12 @@ bgp_show_prefix_list (struct vty *vty, const char > *prefix_list_str, afi_t afi, > return bgp_show (vty, NULL, afi, safi, type, plist); > } > > -DEFUN (show_ip_bgp_prefix_list, > - show_ip_bgp_prefix_list_cmd, > - "show ip bgp prefix-list WORD", > +DEFUN (show_bgp_ipv4_prefix_list, > + show_bgp_ipv4_prefix_list_cmd, > + "show bgp ipv4 prefix-list WORD", > SHOW_STR > - IP_STR > BGP_STR > + IP_STR > "Display routes conforming to the prefix-list\n" > "IP prefix-list name\n") > { > -- > 2.1.3 > > > _______________________________________________ > Quagga-dev mailing list > [email protected] > https://lists.quagga.net/mailman/listinfo/quagga-dev >
_______________________________________________ Quagga-dev mailing list [email protected] https://lists.quagga.net/mailman/listinfo/quagga-dev
