-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Master: bgp show vpn/encap and RFAPI fixes #113
Changes from 5 commits
8074b6f
28070ee
b99615f
bbd1d85
4f280b1
1c404af
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -173,9 +173,6 @@ bgp_nlri_parse_vpn (struct peer *peer, struct attr *attr, | |
safi_t safi; | ||
int addpath_encoded; | ||
u_int32_t addpath_id; | ||
#if ENABLE_BGP_VNC | ||
u_int32_t label = 0; | ||
#endif | ||
|
||
/* Check peer status. */ | ||
if (peer->status != Established) | ||
|
@@ -251,10 +248,6 @@ bgp_nlri_parse_vpn (struct peer *peer, struct attr *attr, | |
return -1; | ||
} | ||
|
||
#if ENABLE_BGP_VNC | ||
label = decode_label (pnt); | ||
#endif | ||
|
||
/* Copyr label to prefix. */ | ||
tagpnt = pnt; | ||
|
||
|
@@ -294,23 +287,14 @@ bgp_nlri_parse_vpn (struct peer *peer, struct attr *attr, | |
|
||
if (attr) | ||
{ | ||
bgp_update (peer, &p, addpath_id, attr, packet->afi, SAFI_MPLS_VPN, | ||
ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, &prd, tagpnt, 0); | ||
#if ENABLE_BGP_VNC | ||
rfapiProcessUpdate(peer, NULL, &p, &prd, attr, packet->afi, | ||
SAFI_MPLS_VPN, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, | ||
&label); | ||
#endif | ||
bgp_update (peer, &p, addpath_id, attr, packet->afi, SAFI_MPLS_VPN, | ||
ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, &prd, tagpnt, 0); | ||
} | ||
else | ||
{ | ||
#if ENABLE_BGP_VNC | ||
rfapiProcessWithdraw(peer, NULL, &p, &prd, attr, packet->afi, | ||
SAFI_MPLS_VPN, ZEBRA_ROUTE_BGP, 0); | ||
#endif | ||
bgp_withdraw (peer, &p, addpath_id, attr, packet->afi, SAFI_MPLS_VPN, | ||
ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, &prd, tagpnt); | ||
} | ||
bgp_withdraw (peer, &p, addpath_id, attr, packet->afi, SAFI_MPLS_VPN, | ||
ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, &prd, tagpnt); | ||
} | ||
} | ||
/* Packet length consistency check. */ | ||
if (pnt != lim) | ||
|
@@ -657,7 +641,7 @@ show_adj_route_vpn (struct vty *vty, struct peer *peer, struct prefix_rd *prd, u | |
struct rd_as rd_as; | ||
struct rd_ip rd_ip = {0}; | ||
#if ENABLE_BGP_VNC | ||
struct rd_vnc_eth rd_vnc_eth; | ||
struct rd_vnc_eth rd_vnc_eth = {0}; | ||
#endif | ||
u_char *pnt; | ||
|
||
|
@@ -733,23 +717,7 @@ show_adj_route_vpn (struct vty *vty, struct peer *peer, struct prefix_rd *prd, u | |
return CMD_SUCCESS; | ||
} | ||
|
||
enum bgp_show_type | ||
{ | ||
bgp_show_type_normal, | ||
bgp_show_type_regexp, | ||
bgp_show_type_prefix_list, | ||
bgp_show_type_filter_list, | ||
bgp_show_type_neighbor, | ||
bgp_show_type_cidr_only, | ||
bgp_show_type_prefix_longer, | ||
bgp_show_type_community_all, | ||
bgp_show_type_community, | ||
bgp_show_type_community_exact, | ||
bgp_show_type_community_list, | ||
bgp_show_type_community_list_exact | ||
}; | ||
|
||
static int | ||
int | ||
bgp_show_mpls_vpn (struct vty *vty, afi_t afi, struct prefix_rd *prd, | ||
enum bgp_show_type type, void *output_arg, int tags, u_char use_json) | ||
{ | ||
|
@@ -867,7 +835,7 @@ bgp_show_mpls_vpn (struct vty *vty, afi_t afi, struct prefix_rd *prd, | |
struct rd_as rd_as; | ||
struct rd_ip rd_ip = {0}; | ||
#if ENABLE_BGP_VNC | ||
struct rd_vnc_eth rd_vnc_eth; | ||
struct rd_vnc_eth rd_vnc_eth = {0}; | ||
#endif | ||
u_char *pnt; | ||
|
||
|
@@ -967,9 +935,9 @@ bgp_show_mpls_vpn (struct vty *vty, afi_t afi, struct prefix_rd *prd, | |
return CMD_SUCCESS; | ||
} | ||
|
||
DEFUN (show_bgp_ip_vpn_rd, | ||
show_bgp_ip_vpn_rd_cmd, | ||
"show [ip] bgp "BGP_AFI_CMD_STR" vpn [rd ASN:nn_or_IP-address:nn] [json]", | ||
DEFUN (show_bgp_ip_vpn_all_rd, | ||
show_bgp_ip_vpn_all_rd_cmd, | ||
"show bgp "BGP_AFI_CMD_STR" vpn all [rd ASN:nn_or_IP-address:nn] [json]", | ||
SHOW_STR | ||
IP_STR | ||
BGP_STR | ||
|
@@ -979,17 +947,17 @@ DEFUN (show_bgp_ip_vpn_rd, | |
"VPN Route Distinguisher\n" | ||
JSON_STR) | ||
{ | ||
int idx_ext_community = 5; | ||
int idx_rd = 5; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. idx_rd is not going to be 5. If I enter: 'show ip bgp ipv4 vpn all rd ASN:nn_or_IP-address:nn" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Additionally, removing the '[ip]' serves only to fragment the command space. I went through and merged the entire |
||
int ret; | ||
struct prefix_rd prd; | ||
afi_t afi; | ||
int idx = 0; | ||
|
||
if (argv_find_and_parse_afi (argv, argc, &idx, &afi)) | ||
{ | ||
if (argv[idx_ext_community]->arg) | ||
if (argc >= 7 && argv[idx_rd]->arg) | ||
{ | ||
ret = str2prefix_rd (argv[idx_ext_community]->arg, &prd); | ||
ret = str2prefix_rd (argv[idx_rd]->arg, &prd); | ||
if (! ret) | ||
{ | ||
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); | ||
|
@@ -1005,34 +973,17 @@ DEFUN (show_bgp_ip_vpn_rd, | |
return CMD_SUCCESS; | ||
} | ||
|
||
#ifdef KEEP_OLD_VPN_COMMANDS | ||
DEFUN (show_ip_bgp_vpn_all, | ||
show_ip_bgp_vpn_all_cmd, | ||
"show [ip] bgp <vpnv4|vpnv6>", | ||
SHOW_STR | ||
IP_STR | ||
BGP_STR | ||
BGP_VPNVX_HELP_STR) | ||
{ | ||
afi_t afi; | ||
int idx = 0; | ||
|
||
if (argv_find_and_parse_vpnvx (argv, argc, &idx, &afi)) | ||
return bgp_show_mpls_vpn (vty, afi, NULL, bgp_show_type_normal, NULL, 0, 0); | ||
return CMD_SUCCESS; | ||
} | ||
|
||
DEFUN (show_ip_bgp_vpn_rd, | ||
show_ip_bgp_vpn_rd_cmd, | ||
"show [ip] bgp <vpnv4|vpnv6> rd ASN:nn_or_IP-address:nn", | ||
"show [ip] bgp "BGP_AFI_CMD_STR" vpn rd ASN:nn_or_IP-address:nn", | ||
SHOW_STR | ||
IP_STR | ||
BGP_STR | ||
BGP_VPNVX_HELP_STR | ||
BGP_AFI_HELP_STR | ||
"Display information for a route distinguisher\n" | ||
"VPN Route Distinguisher\n") | ||
{ | ||
int idx_ext_community = 5; | ||
int idx_ext_community = argc-1; | ||
int ret; | ||
struct prefix_rd prd; | ||
afi_t afi; | ||
|
@@ -1051,6 +1002,23 @@ DEFUN (show_ip_bgp_vpn_rd, | |
return CMD_SUCCESS; | ||
} | ||
|
||
#ifdef KEEP_OLD_VPN_COMMANDS | ||
DEFUN (show_ip_bgp_vpn_all, | ||
show_ip_bgp_vpn_all_cmd, | ||
"show [ip] bgp <vpnv4|vpnv6>", | ||
SHOW_STR | ||
IP_STR | ||
BGP_STR | ||
BGP_VPNVX_HELP_STR) | ||
{ | ||
afi_t afi; | ||
int idx = 0; | ||
|
||
if (argv_find_and_parse_vpnvx (argv, argc, &idx, &afi)) | ||
return bgp_show_mpls_vpn (vty, afi, NULL, bgp_show_type_normal, NULL, 0, 0); | ||
return CMD_SUCCESS; | ||
} | ||
|
||
DEFUN (show_ip_bgp_vpn_all_tags, | ||
show_ip_bgp_vpn_all_tags_cmd, | ||
"show [ip] bgp <vpnv4|vpnv6> all tags", | ||
|
@@ -1386,7 +1354,8 @@ bgp_mplsvpn_init (void) | |
install_element (BGP_VPNV6_NODE, &vpnv6_network_cmd); | ||
install_element (BGP_VPNV6_NODE, &no_vpnv6_network_cmd); | ||
|
||
install_element (VIEW_NODE, &show_bgp_ip_vpn_rd_cmd); | ||
install_element (VIEW_NODE, &show_bgp_ip_vpn_all_rd_cmd); | ||
install_element (VIEW_NODE, &show_ip_bgp_vpn_rd_cmd); | ||
#ifdef KEEP_OLD_VPN_COMMANDS | ||
install_element (VIEW_NODE, &show_ip_bgp_vpn_all_cmd); | ||
install_element (VIEW_NODE, &show_ip_bgp_vpn_rd_cmd); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
show [ip] bgp