-
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 4 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; | ||
|
||
|
@@ -867,7 +851,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; | ||
|
||
|
@@ -969,7 +953,7 @@ bgp_show_mpls_vpn (struct vty *vty, afi_t afi, struct prefix_rd *prd, | |
|
||
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]", | ||
"show bgp "BGP_AFI_CMD_STR" vpn all [rd ASN:nn_or_IP-address:nn] [json]", | ||
SHOW_STR | ||
IP_STR | ||
BGP_STR | ||
|
@@ -979,17 +963,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); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2680,6 +2680,21 @@ bgp_update (struct peer *peer, struct prefix *p, u_int32_t addpath_id, | |
bgp_process (bgp, rn, afi, safi); | ||
bgp_unlock_node (rn); | ||
|
||
#if ENABLE_BGP_VNC | ||
if (SAFI_MPLS_VPN == safi) | ||
{ | ||
uint32_t label = decode_label(tag); | ||
|
||
rfapiProcessUpdate(peer, NULL, p, prd, attr, afi, safi, type, sub_type, | ||
&label); | ||
} | ||
if (SAFI_ENCAP == safi) | ||
{ | ||
rfapiProcessUpdate(peer, NULL, p, prd, attr, afi, safi, type, sub_type, | ||
NULL); | ||
} | ||
#endif | ||
|
||
return 0; | ||
} // End of implicit withdraw | ||
|
||
|
@@ -2774,6 +2789,21 @@ bgp_update (struct peer *peer, struct prefix *p, u_int32_t addpath_id, | |
/* Process change. */ | ||
bgp_process (bgp, rn, afi, safi); | ||
|
||
#if ENABLE_BGP_VNC | ||
if (SAFI_MPLS_VPN == safi) | ||
{ | ||
uint32_t label = decode_label(tag); | ||
|
||
rfapiProcessUpdate(peer, NULL, p, prd, attr, afi, safi, type, sub_type, | ||
&label); | ||
} | ||
if (SAFI_ENCAP == safi) | ||
{ | ||
rfapiProcessUpdate(peer, NULL, p, prd, attr, afi, safi, type, sub_type, | ||
NULL); | ||
} | ||
#endif | ||
|
||
return 0; | ||
|
||
/* This BGP update is filtered. Log the reason then update BGP | ||
|
@@ -2813,6 +2843,13 @@ bgp_withdraw (struct peer *peer, struct prefix *p, u_int32_t addpath_id, | |
struct bgp_node *rn; | ||
struct bgp_info *ri; | ||
|
||
#if ENABLE_BGP_VNC | ||
if ((SAFI_MPLS_VPN == safi) || (SAFI_ENCAP == safi)) | ||
{ | ||
rfapiProcessWithdraw(peer, NULL, p, prd, NULL, afi, safi, type, 0); | ||
} | ||
#endif | ||
|
||
bgp = peer->bgp; | ||
|
||
/* Lookup node. */ | ||
|
@@ -9441,7 +9478,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]", | ||
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. It was my understanding that we are converting to a 'afi safi' format. Shouldn't we loose encap and vpnv4 as afi's then? |
||
SHOW_STR | ||
IP_STR | ||
BGP_STR | ||
|
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