Merge pull request #65 from LabNConsulting/working/2.0/afi-safi-vty/c

Updated: stable/2.0 pull to pick up bgp afi/safi vty changes (Issues #14 and #61)
This commit is contained in:
Donald Sharp 2017-01-12 12:54:30 -05:00 committed by GitHub
commit dc54fc5360
5 changed files with 781 additions and 1659 deletions

View File

@ -35,6 +35,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#include "bgpd/bgp_attr.h" #include "bgpd/bgp_attr.h"
#include "bgpd/bgp_mplsvpn.h" #include "bgpd/bgp_mplsvpn.h"
#include "bgpd/bgp_packet.h" #include "bgpd/bgp_packet.h"
#include "bgpd/bgp_vty.h"
#if ENABLE_BGP_VNC #if ENABLE_BGP_VNC
#include "bgpd/rfapi/rfapi_backend.h" #include "bgpd/rfapi/rfapi_backend.h"
@ -198,7 +199,7 @@ bgp_nlri_parse_vpn (struct peer *peer, struct attr *attr,
if (prefixlen < VPN_PREFIXLEN_MIN_BYTES*8) if (prefixlen < VPN_PREFIXLEN_MIN_BYTES*8)
{ {
zlog_err ("%s [Error] Update packet error / VPNv4 (prefix length %d less than VPNv4 min length)", zlog_err ("%s [Error] Update packet error / VPN (prefix length %d less than VPN min length)",
peer->host, prefixlen); peer->host, prefixlen);
return -1; return -1;
} }
@ -206,7 +207,7 @@ bgp_nlri_parse_vpn (struct peer *peer, struct attr *attr,
/* sanity check against packet data */ /* sanity check against packet data */
if ((pnt + psize) > lim) if ((pnt + psize) > lim)
{ {
zlog_err ("%s [Error] Update packet error / VPNv4 (prefix length %d exceeds packet size %u)", zlog_err ("%s [Error] Update packet error / VPN (prefix length %d exceeds packet size %u)",
peer->host, peer->host,
prefixlen, (uint)(lim-pnt)); prefixlen, (uint)(lim-pnt));
return -1; return -1;
@ -215,7 +216,7 @@ bgp_nlri_parse_vpn (struct peer *peer, struct attr *attr,
/* sanity check against storage for the IP address portion */ /* sanity check against storage for the IP address portion */
if ((psize - VPN_PREFIXLEN_MIN_BYTES) > (ssize_t) sizeof(p.u)) if ((psize - VPN_PREFIXLEN_MIN_BYTES) > (ssize_t) sizeof(p.u))
{ {
zlog_err ("%s [Error] Update packet error / VPNv4 (psize %d exceeds storage size %zu)", zlog_err ("%s [Error] Update packet error / VPN (psize %d exceeds storage size %zu)",
peer->host, peer->host,
prefixlen - VPN_PREFIXLEN_MIN_BYTES*8, sizeof(p.u)); prefixlen - VPN_PREFIXLEN_MIN_BYTES*8, sizeof(p.u));
return -1; return -1;
@ -224,7 +225,7 @@ bgp_nlri_parse_vpn (struct peer *peer, struct attr *attr,
/* Sanity check against max bitlen of the address family */ /* Sanity check against max bitlen of the address family */
if ((psize - VPN_PREFIXLEN_MIN_BYTES) > prefix_blen (&p)) if ((psize - VPN_PREFIXLEN_MIN_BYTES) > prefix_blen (&p))
{ {
zlog_err ("%s [Error] Update packet error / VPNv4 (psize %d exceeds family (%u) max byte len %u)", zlog_err ("%s [Error] Update packet error / VPN (psize %d exceeds family (%u) max byte len %u)",
peer->host, peer->host,
prefixlen - VPN_PREFIXLEN_MIN_BYTES*8, prefixlen - VPN_PREFIXLEN_MIN_BYTES*8,
p.family, prefix_blen (&p)); p.family, prefix_blen (&p));
@ -295,7 +296,7 @@ bgp_nlri_parse_vpn (struct peer *peer, struct attr *attr,
/* Packet length consistency check. */ /* Packet length consistency check. */
if (pnt != lim) if (pnt != lim)
{ {
zlog_err ("%s [Error] Update packet error / VPNv4 (%zu data remaining after parsing)", zlog_err ("%s [Error] Update packet error / VPN (%zu data remaining after parsing)",
peer->host, lim - pnt); peer->host, lim - pnt);
return -1; return -1;
} }
@ -485,7 +486,7 @@ DEFUN (no_vpnv4_network,
} }
static int static int
show_adj_route_vpn (struct vty *vty, struct peer *peer, struct prefix_rd *prd, u_char use_json) show_adj_route_vpn (struct vty *vty, struct peer *peer, afi_t afi, struct prefix_rd *prd, u_char use_json)
{ {
struct bgp *bgp; struct bgp *bgp;
struct bgp_table *table; struct bgp_table *table;
@ -528,7 +529,7 @@ show_adj_route_vpn (struct vty *vty, struct peer *peer, struct prefix_rd *prd, u
json_object_string_add(json_ocode, "incomplete", "?"); json_object_string_add(json_ocode, "incomplete", "?");
} }
for (rn = bgp_table_top (bgp->rib[AFI_IP][SAFI_MPLS_VPN]); rn; for (rn = bgp_table_top (bgp->rib[afi][SAFI_MPLS_VPN]); rn;
rn = bgp_route_next (rn)) rn = bgp_route_next (rn))
{ {
if (prd && memcmp (rn->p.u.val, prd->val, 8) != 0) if (prd && memcmp (rn->p.u.val, prd->val, 8) != 0)
@ -954,25 +955,25 @@ DEFUN (show_bgp_ipv6_vpn_rd,
return bgp_show_mpls_vpn (vty, AFI_IP6, &prd, bgp_show_type_normal, NULL, 0, use_json (argc, argv)); return bgp_show_mpls_vpn (vty, AFI_IP6, &prd, bgp_show_type_normal, NULL, 0, use_json (argc, argv));
} }
DEFUN (show_ip_bgp_vpnv4_all, DEFUN (show_bgp_ip_vpn_all,
show_ip_bgp_vpnv4_all_cmd, show_bgp_ip_vpn_all_cmd,
"show ip bgp vpnv4 all", "show bgp "BGP_AFI_CMD_STR" vpn all",
SHOW_STR SHOW_STR
IP_STR IP_STR
BGP_STR BGP_STR
"Display VPNv4 NLRI specific information\n" BGP_AFI_HELP_STR
"Display information about all VPNv4 NLRIs\n") "Display information about all VPN NLRIs\n")
{ {
return bgp_show_mpls_vpn (vty, AFI_IP, NULL, bgp_show_type_normal, NULL, 0, 0); return bgp_show_mpls_vpn (vty, bgp_vty_afi_from_arg(argv[0]), NULL, bgp_show_type_normal, NULL, 0, 0);
} }
DEFUN (show_ip_bgp_vpnv4_rd, DEFUN (show_bgp_ip_vpn_rd,
show_ip_bgp_vpnv4_rd_cmd, show_bgp_ip_vpn_rd_cmd,
"show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn", "show bgp "BGP_AFI_CMD_STR" vpn rd ASN:nn_or_IP-address:nn",
SHOW_STR SHOW_STR
IP_STR IP_STR
BGP_STR BGP_STR
"Display VPNv4 NLRI specific information\n" BGP_AFI_HELP_STR
"Display information for a route distinguisher\n" "Display information for a route distinguisher\n"
"VPN Route Distinguisher\n") "VPN Route Distinguisher\n")
{ {
@ -985,29 +986,29 @@ DEFUN (show_ip_bgp_vpnv4_rd,
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
return CMD_WARNING; return CMD_WARNING;
} }
return bgp_show_mpls_vpn (vty, AFI_IP, &prd, bgp_show_type_normal, NULL, 0, 0); return bgp_show_mpls_vpn (vty, bgp_vty_afi_from_arg(argv[0]), &prd, bgp_show_type_normal, NULL, 0, 0);
} }
DEFUN (show_ip_bgp_vpnv4_all_tags, DEFUN (show_bgp_ip_vpn_all_tags,
show_ip_bgp_vpnv4_all_tags_cmd, show_bgp_ip_vpn_all_tags_cmd,
"show ip bgp vpnv4 all tags", "show bgp "BGP_AFI_CMD_STR" vpn all tags",
SHOW_STR SHOW_STR
IP_STR IP_STR
BGP_STR BGP_STR
"Display VPNv4 NLRI specific information\n" BGP_AFI_HELP_STR
"Display information about all VPNv4 NLRIs\n" "Display information about all VPNv4 NLRIs\n"
"Display BGP tags for prefixes\n") "Display BGP tags for prefixes\n")
{ {
return bgp_show_mpls_vpn (vty, AFI_IP, NULL, bgp_show_type_normal, NULL, 1, 0); return bgp_show_mpls_vpn (vty, bgp_vty_afi_from_arg(argv[0]), NULL, bgp_show_type_normal, NULL, 1, 0);
} }
DEFUN (show_ip_bgp_vpnv4_rd_tags, DEFUN (show_bgp_ip_vpn_rd_tags,
show_ip_bgp_vpnv4_rd_tags_cmd, show_bgp_ip_vpn_rd_tags_cmd,
"show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn tags", "show bgp "BGP_AFI_CMD_STR" vpn rd ASN:nn_or_IP-address:nn tags",
SHOW_STR SHOW_STR
IP_STR IP_STR
BGP_STR BGP_STR
"Display VPNv4 NLRI specific information\n" BGP_AFI_HELP_STR
"Display information for a route distinguisher\n" "Display information for a route distinguisher\n"
"VPN Route Distinguisher\n" "VPN Route Distinguisher\n"
"Display BGP tags for prefixes\n") "Display BGP tags for prefixes\n")
@ -1015,103 +1016,34 @@ DEFUN (show_ip_bgp_vpnv4_rd_tags,
int ret; int ret;
struct prefix_rd prd; struct prefix_rd prd;
ret = str2prefix_rd (argv[0], &prd); ret = str2prefix_rd (argv[1], &prd);
if (! ret) if (! ret)
{ {
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
return CMD_WARNING; return CMD_WARNING;
} }
return bgp_show_mpls_vpn (vty, AFI_IP, &prd, bgp_show_type_normal, NULL, 1, 0); return bgp_show_mpls_vpn (vty, bgp_vty_afi_from_arg(argv[0]), &prd, bgp_show_type_normal, NULL, 1, 0);
} }
DEFUN (show_ip_bgp_vpnv4_all_neighbor_routes, DEFUN (show_bgp_ip_vpn_all_neighbor_routes,
show_ip_bgp_vpnv4_all_neighbor_routes_cmd, show_bgp_ip_vpn_all_neighbor_routes_cmd,
"show ip bgp vpnv4 all neighbors A.B.C.D routes {json}", "show bgp "BGP_AFI_CMD_STR" vpn all neighbors (A.B.C.D|X:X::X:X) routes {json}",
SHOW_STR SHOW_STR
IP_STR IP_STR
BGP_STR BGP_STR
"Display VPNv4 NLRI specific information\n" BGP_AFI_HELP_STR
"Display information about all VPNv4 NLRIs\n" "Display information about all VPNv4 NLRIs\n"
"Detailed information on TCP and BGP neighbor connections\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"
"JavaScript Object Notation\n")
{
union sockunion su;
struct peer *peer;
int ret;
u_char uj = use_json(argc, argv);
ret = str2sockunion (argv[0], &su);
if (ret < 0)
{
if (uj)
{
json_object *json_no = NULL;
json_no = json_object_new_object();
json_object_string_add(json_no, "warning", "Malformed address");
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
json_object_free(json_no);
}
else
vty_out (vty, "Malformed address: %s%s", argv[0], VTY_NEWLINE);
return CMD_WARNING;
}
peer = peer_lookup (NULL, &su);
if (! peer || ! peer->afc[AFI_IP][SAFI_MPLS_VPN])
{
if (uj)
{
json_object *json_no = NULL;
json_no = json_object_new_object();
json_object_string_add(json_no, "warning", "No such neighbor or address family");
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
json_object_free(json_no);
}
else
vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE);
return CMD_WARNING;
}
return bgp_show_mpls_vpn (vty, AFI_IP, NULL, bgp_show_type_neighbor, &su, 0, uj);
}
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_STR
IP_STR
BGP_STR
"Display VPNv4 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 routes learned from neighbor\n" "Display routes learned from neighbor\n"
"JavaScript Object Notation\n") "JavaScript Object Notation\n")
{ {
int ret;
union sockunion su; union sockunion su;
struct peer *peer; struct peer *peer;
struct prefix_rd prd; int ret;
u_char uj = use_json(argc, argv); u_char uj = use_json(argc, argv);
afi_t afi = bgp_vty_afi_from_arg(argv[0]);
ret = str2prefix_rd (argv[0], &prd);
if (! ret)
{
if (uj)
{
json_object *json_no = NULL;
json_no = json_object_new_object();
json_object_string_add(json_no, "warning", "Malformed Route Distinguisher");
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
json_object_free(json_no);
}
else
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
return CMD_WARNING;
}
ret = str2sockunion (argv[1], &su); ret = str2sockunion (argv[1], &su);
if (ret < 0) if (ret < 0)
@ -1130,7 +1062,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_routes,
} }
peer = peer_lookup (NULL, &su); peer = peer_lookup (NULL, &su);
if (! peer || ! peer->afc[AFI_IP][SAFI_MPLS_VPN]) if (! peer || ! peer->afc[afi][SAFI_MPLS_VPN])
{ {
if (uj) if (uj)
{ {
@ -1145,28 +1077,48 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_routes,
return CMD_WARNING; return CMD_WARNING;
} }
return bgp_show_mpls_vpn (vty, AFI_IP, &prd, bgp_show_type_neighbor, &su, 0, uj); return bgp_show_mpls_vpn (vty, afi, NULL, bgp_show_type_neighbor, &su, 0, uj);
} }
DEFUN (show_ip_bgp_vpnv4_all_neighbor_advertised_routes, DEFUN (show_bgp_ip_vpn_rd_neighbor_routes,
show_ip_bgp_vpnv4_all_neighbor_advertised_routes_cmd, show_bgp_ip_vpn_rd_neighbor_routes_cmd,
"show ip bgp vpnv4 all neighbors A.B.C.D advertised-routes {json}", "show bgp "BGP_AFI_CMD_STR" vpn rd ASN:nn_or_IP-address:nn neighbors (A.B.C.D|X:X::X:X) routes {json}",
SHOW_STR SHOW_STR
IP_STR IP_STR
BGP_STR BGP_STR
"Display VPNv4 NLRI specific information\n" BGP_AFI_HELP_STR
"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" "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" "Neighbor to display information about\n"
"Display routes learned from neighbor\n"
"JavaScript Object Notation\n") "JavaScript Object Notation\n")
{ {
int ret; int ret;
struct peer *peer;
union sockunion su; union sockunion su;
struct peer *peer;
struct prefix_rd prd;
u_char uj = use_json(argc, argv); u_char uj = use_json(argc, argv);
afi_t afi = bgp_vty_afi_from_arg(argv[0]);
ret = str2sockunion (argv[0], &su); ret = str2prefix_rd (argv[1], &prd);
if (! ret)
{
if (uj)
{
json_object *json_no = NULL;
json_no = json_object_new_object();
json_object_string_add(json_no, "warning", "Malformed Route Distinguisher");
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
json_object_free(json_no);
}
else
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
return CMD_WARNING;
}
ret = str2sockunion (argv[2], &su);
if (ret < 0) if (ret < 0)
{ {
if (uj) if (uj)
@ -1181,8 +1133,9 @@ DEFUN (show_ip_bgp_vpnv4_all_neighbor_advertised_routes,
vty_out (vty, "Malformed address: %s%s", argv[0], VTY_NEWLINE); vty_out (vty, "Malformed address: %s%s", argv[0], VTY_NEWLINE);
return CMD_WARNING; return CMD_WARNING;
} }
peer = peer_lookup (NULL, &su); peer = peer_lookup (NULL, &su);
if (! peer || ! peer->afc[AFI_IP][SAFI_MPLS_VPN]) if (! peer || ! peer->afc[afi][SAFI_MPLS_VPN])
{ {
if (uj) if (uj)
{ {
@ -1197,28 +1150,28 @@ DEFUN (show_ip_bgp_vpnv4_all_neighbor_advertised_routes,
return CMD_WARNING; return CMD_WARNING;
} }
return show_adj_route_vpn (vty, peer, NULL, uj); return bgp_show_mpls_vpn (vty, afi, &prd, bgp_show_type_neighbor, &su, 0, uj);
} }
DEFUN (show_ip_bgp_vpnv4_rd_neighbor_advertised_routes, DEFUN (show_bgp_ip_vpn_all_neighbor_advertised_routes,
show_ip_bgp_vpnv4_rd_neighbor_advertised_routes_cmd, show_bgp_ip_vpn_all_neighbor_advertised_routes_cmd,
"show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D advertised-routes {json}", "show bgp "BGP_AFI_CMD_STR" vpn all neighbors (A.B.C.D|X:X::X:X) advertised-routes {json}",
SHOW_STR SHOW_STR
IP_STR IP_STR
BGP_STR BGP_STR
"Display VPNv4 NLRI specific information\n" BGP_AFI_HELP_STR
"Display information for a route distinguisher\n" "Display information about all VPN NLRIs\n"
"VPN Route Distinguisher\n"
"Detailed information on TCP and BGP neighbor connections\n" "Detailed information on TCP and BGP neighbor connections\n"
"Neighbor to display information about\n" "Neighbor to display information about\n"
"Neighbor to display information about\n"
"Display the routes advertised to a BGP neighbor\n" "Display the routes advertised to a BGP neighbor\n"
"JavaScript Object Notation\n") "JavaScript Object Notation\n")
{ {
int ret; int ret;
struct peer *peer; struct peer *peer;
struct prefix_rd prd;
union sockunion su; union sockunion su;
u_char uj = use_json(argc, argv); u_char uj = use_json(argc, argv);
afi_t afi = bgp_vty_afi_from_arg(argv[0]);
ret = str2sockunion (argv[1], &su); ret = str2sockunion (argv[1], &su);
if (ret < 0) if (ret < 0)
@ -1236,7 +1189,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_advertised_routes,
return CMD_WARNING; return CMD_WARNING;
} }
peer = peer_lookup (NULL, &su); peer = peer_lookup (NULL, &su);
if (! peer || ! peer->afc[AFI_IP][SAFI_MPLS_VPN]) if (! peer || ! peer->afc[afi][SAFI_MPLS_VPN])
{ {
if (uj) if (uj)
{ {
@ -1251,7 +1204,63 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_advertised_routes,
return CMD_WARNING; return CMD_WARNING;
} }
ret = str2prefix_rd (argv[0], &prd); return show_adj_route_vpn (vty, peer, afi, NULL, uj);
}
DEFUN (show_bgp_ip_vpn_rd_neighbor_advertised_routes,
show_bgp_ip_vpn_rd_neighbor_advertised_routes_cmd,
"show bgp "BGP_AFI_CMD_STR" vpn rd ASN:nn_or_IP-address:nn neighbors (A.B.C.D|X:X::X:X) advertised-routes {json}",
SHOW_STR
IP_STR
BGP_STR
BGP_AFI_HELP_STR
"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"
"JavaScript Object Notation\n")
{
int ret;
struct peer *peer;
struct prefix_rd prd;
union sockunion su;
u_char uj = use_json(argc, argv);
afi_t afi = bgp_vty_afi_from_arg(argv[0]);
ret = str2sockunion (argv[2], &su);
if (ret < 0)
{
if (uj)
{
json_object *json_no = NULL;
json_no = json_object_new_object();
json_object_string_add(json_no, "warning", "Malformed address");
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
json_object_free(json_no);
}
else
vty_out (vty, "Malformed address: %s%s", argv[2], VTY_NEWLINE);
return CMD_WARNING;
}
peer = peer_lookup (NULL, &su);
if (! peer || ! peer->afc[afi][SAFI_MPLS_VPN])
{
if (uj)
{
json_object *json_no = NULL;
json_no = json_object_new_object();
json_object_string_add(json_no, "warning", "No such neighbor or address family");
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
json_object_free(json_no);
}
else
vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE);
return CMD_WARNING;
}
ret = str2prefix_rd (argv[1], &prd);
if (! ret) if (! ret)
{ {
if (uj) if (uj)
@ -1267,7 +1276,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_advertised_routes,
return CMD_WARNING; return CMD_WARNING;
} }
return show_adj_route_vpn (vty, peer, &prd, uj); return show_adj_route_vpn (vty, peer, afi, &prd, uj);
} }
void void
@ -1281,12 +1290,12 @@ bgp_mplsvpn_init (void)
install_element (VIEW_NODE, &show_bgp_ipv4_vpn_rd_cmd); install_element (VIEW_NODE, &show_bgp_ipv4_vpn_rd_cmd);
install_element (VIEW_NODE, &show_bgp_ipv6_vpn_cmd); 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_rd_cmd);
install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_cmd); install_element (VIEW_NODE, &show_bgp_ip_vpn_all_cmd);
install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_cmd); install_element (VIEW_NODE, &show_bgp_ip_vpn_rd_cmd);
install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_tags_cmd); install_element (VIEW_NODE, &show_bgp_ip_vpn_all_tags_cmd);
install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_tags_cmd); install_element (VIEW_NODE, &show_bgp_ip_vpn_rd_tags_cmd);
install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbor_routes_cmd); install_element (VIEW_NODE, &show_bgp_ip_vpn_all_neighbor_routes_cmd);
install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbor_routes_cmd); install_element (VIEW_NODE, &show_bgp_ip_vpn_rd_neighbor_routes_cmd);
install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbor_advertised_routes_cmd); install_element (VIEW_NODE, &show_bgp_ip_vpn_all_neighbor_advertised_routes_cmd);
install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbor_advertised_routes_cmd); install_element (VIEW_NODE, &show_bgp_ip_vpn_rd_neighbor_advertised_routes_cmd);
} }

File diff suppressed because it is too large Load Diff

View File

@ -2342,63 +2342,6 @@ struct route_map_rule_cmd route_set_ipv6_nexthop_peer_cmd =
#endif /* HAVE_IPV6 */ #endif /* HAVE_IPV6 */
/* `set vpnv4 nexthop A.B.C.D' */
static route_map_result_t
route_set_vpnv4_nexthop (void *rule, struct prefix *prefix,
route_map_object_t type, void *object)
{
struct in_addr *address;
struct bgp_info *bgp_info;
if (type == RMAP_BGP)
{
/* Fetch routemap's rule information. */
address = rule;
bgp_info = object;
/* Set next hop value. */
(bgp_attr_extra_get (bgp_info->attr))->mp_nexthop_global_in = *address;
(bgp_attr_extra_get (bgp_info->attr))->mp_nexthop_len = 4;
}
return RMAP_OKAY;
}
static void *
route_set_vpnv4_nexthop_compile (const char *arg)
{
int ret;
struct in_addr *address;
address = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (struct in_addr));
ret = inet_aton (arg, address);
if (ret == 0)
{
XFREE (MTYPE_ROUTE_MAP_COMPILED, address);
return NULL;
}
return address;
}
static void
route_set_vpnv4_nexthop_free (void *rule)
{
XFREE (MTYPE_ROUTE_MAP_COMPILED, rule);
}
/* Route map commands for ip nexthop set. */
struct route_map_rule_cmd route_set_vpnv4_nexthop_cmd =
{
"vpnv4 next-hop",
route_set_vpnv4_nexthop,
route_set_vpnv4_nexthop_compile,
route_set_vpnv4_nexthop_free
};
/* `set originator-id' */ /* `set originator-id' */
/* For origin set. */ /* For origin set. */
@ -4500,40 +4443,6 @@ ALIAS (no_set_ipv6_nexthop_local,
"IPv6 address of next hop\n") "IPv6 address of next hop\n")
#endif /* HAVE_IPV6 */ #endif /* HAVE_IPV6 */
DEFUN (set_vpnv4_nexthop,
set_vpnv4_nexthop_cmd,
"set vpnv4 next-hop A.B.C.D",
SET_STR
"VPNv4 information\n"
"VPNv4 next-hop address\n"
"IP address of next hop\n")
{
return bgp_route_set_add (vty, vty->index, "vpnv4 next-hop", argv[0]);
}
DEFUN (no_set_vpnv4_nexthop,
no_set_vpnv4_nexthop_cmd,
"no set vpnv4 next-hop",
NO_STR
SET_STR
"VPNv4 information\n"
"VPNv4 next-hop address\n")
{
if (argc == 0)
return bgp_route_set_delete (vty, vty->index, "vpnv4 next-hop", NULL);
return bgp_route_set_delete (vty, vty->index, "vpnv4 next-hop", argv[0]);
}
ALIAS (no_set_vpnv4_nexthop,
no_set_vpnv4_nexthop_val_cmd,
"no set vpnv4 next-hop A.B.C.D",
NO_STR
SET_STR
"VPNv4 information\n"
"VPNv4 next-hop address\n"
"IP address of next hop\n")
DEFUN (set_originator_id, DEFUN (set_originator_id,
set_originator_id_cmd, set_originator_id_cmd,
"set originator-id A.B.C.D", "set originator-id A.B.C.D",
@ -4604,7 +4513,6 @@ bgp_route_map_init (void)
route_map_install_set (&route_set_aggregator_as_cmd); route_map_install_set (&route_set_aggregator_as_cmd);
route_map_install_set (&route_set_community_cmd); route_map_install_set (&route_set_community_cmd);
route_map_install_set (&route_set_community_delete_cmd); route_map_install_set (&route_set_community_delete_cmd);
route_map_install_set (&route_set_vpnv4_nexthop_cmd);
route_map_install_set (&route_set_originator_id_cmd); route_map_install_set (&route_set_originator_id_cmd);
route_map_install_set (&route_set_ecommunity_rt_cmd); route_map_install_set (&route_set_ecommunity_rt_cmd);
route_map_install_set (&route_set_ecommunity_soo_cmd); route_map_install_set (&route_set_ecommunity_soo_cmd);
@ -4710,9 +4618,6 @@ bgp_route_map_init (void)
install_element (RMAP_NODE, &set_ecommunity_soo_cmd); install_element (RMAP_NODE, &set_ecommunity_soo_cmd);
install_element (RMAP_NODE, &no_set_ecommunity_soo_cmd); install_element (RMAP_NODE, &no_set_ecommunity_soo_cmd);
install_element (RMAP_NODE, &no_set_ecommunity_soo_val_cmd); install_element (RMAP_NODE, &no_set_ecommunity_soo_val_cmd);
install_element (RMAP_NODE, &set_vpnv4_nexthop_cmd);
install_element (RMAP_NODE, &no_set_vpnv4_nexthop_cmd);
install_element (RMAP_NODE, &no_set_vpnv4_nexthop_val_cmd);
install_element (RMAP_NODE, &set_originator_id_cmd); install_element (RMAP_NODE, &set_originator_id_cmd);
install_element (RMAP_NODE, &no_set_originator_id_cmd); install_element (RMAP_NODE, &no_set_originator_id_cmd);
install_element (RMAP_NODE, &no_set_originator_id_val_cmd); install_element (RMAP_NODE, &no_set_originator_id_val_cmd);

File diff suppressed because it is too large Load Diff

View File

@ -30,15 +30,20 @@ struct bgp;
#define BGP_INSTANCE_ALL_CMD "(view|vrf) all" #define BGP_INSTANCE_ALL_CMD "(view|vrf) all"
#define BGP_INSTANCE_ALL_HELP_STR "BGP view\nBGP VRF\nAll Views/VRFs\n" #define BGP_INSTANCE_ALL_HELP_STR "BGP view\nBGP VRF\nAll Views/VRFs\n"
#define AFI_SAFI_STR \ #define BGP_AFI_CMD_STR "(ipv4|ipv6)"
"Address family\n" \ #define BGP_AFI_HELP_STR "Address Family\nAddress Family\n"
"Address Family modifier\n" \ #define BGP_SAFI_CMD_STR "(unicast|multicast|vpn|encap)"
"Address Family modifier\n" \ #define BGP_SAFI_HELP_STR \
"Address Family modifier\n" \ "Address Family modifier\n" \
"Address Family modifier\n" \
"Address Family modifier\n" \
"Address Family modifier\n" "Address Family modifier\n"
#define BGP_AFI_SAFI_CMD_STR BGP_AFI_CMD_STR" "BGP_SAFI_CMD_STR
#define BGP_AFI_SAFI_HELP_STR BGP_AFI_HELP_STR BGP_SAFI_HELP_STR
extern void bgp_vty_init (void); extern void bgp_vty_init (void);
extern const char *afi_safi_print (afi_t, safi_t); extern const char *afi_safi_print (afi_t, safi_t);
extern const char *afi_safi_json (afi_t, safi_t);
extern int bgp_config_write_update_delay (struct vty *, struct bgp *); extern int bgp_config_write_update_delay (struct vty *, struct bgp *);
extern int bgp_config_write_wpkt_quanta(struct vty *vty, struct bgp *bgp); extern int bgp_config_write_wpkt_quanta(struct vty *vty, struct bgp *bgp);
extern int bgp_config_write_listen(struct vty *vty, struct bgp *bgp); extern int bgp_config_write_listen(struct vty *vty, struct bgp *bgp);
@ -53,6 +58,9 @@ bgp_parse_afi(const char *str, afi_t *afi);
extern int extern int
bgp_parse_safi(const char *str, safi_t *safi); bgp_parse_safi(const char *str, safi_t *safi);
extern afi_t
bgp_vty_afi_from_arg(const char *afi_str);
extern safi_t extern safi_t
bgp_vty_safi_from_arg(const char *safi_str); bgp_vty_safi_from_arg(const char *safi_str);