mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-05-03 14:34:25 +00:00
bgpd rfapi: Shift rfapi receive hooks for vpn and encap safis into
bgp_update/bgp_withdraw (Issue #91) Signed-off-by: G. Paul Ziemba <paulz@labn.net>
This commit is contained in:
parent
8074b6fda3
commit
28070ee3c4
@ -188,15 +188,7 @@ bgp_nlri_parse_encap(
|
|||||||
if (attr) {
|
if (attr) {
|
||||||
bgp_update (peer, &p, 0, attr, afi, SAFI_ENCAP,
|
bgp_update (peer, &p, 0, attr, afi, SAFI_ENCAP,
|
||||||
ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, &prd, NULL, 0);
|
ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, &prd, NULL, 0);
|
||||||
#if ENABLE_BGP_VNC
|
|
||||||
rfapiProcessUpdate(peer, NULL, &p, &prd, attr, afi, SAFI_ENCAP,
|
|
||||||
ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, NULL);
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
#if ENABLE_BGP_VNC
|
|
||||||
rfapiProcessWithdraw(peer, NULL, &p, &prd, attr, afi, SAFI_ENCAP,
|
|
||||||
ZEBRA_ROUTE_BGP, 0);
|
|
||||||
#endif
|
|
||||||
bgp_withdraw (peer, &p, 0, attr, afi, SAFI_ENCAP,
|
bgp_withdraw (peer, &p, 0, attr, afi, SAFI_ENCAP,
|
||||||
ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, &prd, NULL);
|
ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, &prd, NULL);
|
||||||
}
|
}
|
||||||
|
@ -173,9 +173,6 @@ bgp_nlri_parse_vpn (struct peer *peer, struct attr *attr,
|
|||||||
safi_t safi;
|
safi_t safi;
|
||||||
int addpath_encoded;
|
int addpath_encoded;
|
||||||
u_int32_t addpath_id;
|
u_int32_t addpath_id;
|
||||||
#if ENABLE_BGP_VNC
|
|
||||||
u_int32_t label = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Check peer status. */
|
/* Check peer status. */
|
||||||
if (peer->status != Established)
|
if (peer->status != Established)
|
||||||
@ -251,10 +248,6 @@ bgp_nlri_parse_vpn (struct peer *peer, struct attr *attr,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_BGP_VNC
|
|
||||||
label = decode_label (pnt);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Copyr label to prefix. */
|
/* Copyr label to prefix. */
|
||||||
tagpnt = pnt;
|
tagpnt = pnt;
|
||||||
|
|
||||||
@ -294,23 +287,14 @@ bgp_nlri_parse_vpn (struct peer *peer, struct attr *attr,
|
|||||||
|
|
||||||
if (attr)
|
if (attr)
|
||||||
{
|
{
|
||||||
bgp_update (peer, &p, addpath_id, attr, packet->afi, SAFI_MPLS_VPN,
|
bgp_update (peer, &p, addpath_id, attr, packet->afi, SAFI_MPLS_VPN,
|
||||||
ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, &prd, tagpnt, 0);
|
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
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if ENABLE_BGP_VNC
|
bgp_withdraw (peer, &p, addpath_id, attr, packet->afi, SAFI_MPLS_VPN,
|
||||||
rfapiProcessWithdraw(peer, NULL, &p, &prd, attr, packet->afi,
|
ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, &prd, tagpnt);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/* Packet length consistency check. */
|
/* Packet length consistency check. */
|
||||||
if (pnt != lim)
|
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_as rd_as;
|
||||||
struct rd_ip rd_ip = {0};
|
struct rd_ip rd_ip = {0};
|
||||||
#if ENABLE_BGP_VNC
|
#if ENABLE_BGP_VNC
|
||||||
struct rd_vnc_eth rd_vnc_eth;
|
struct rd_vnc_eth rd_vnc_eth = {0};
|
||||||
#endif
|
#endif
|
||||||
u_char *pnt;
|
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_as rd_as;
|
||||||
struct rd_ip rd_ip = {0};
|
struct rd_ip rd_ip = {0};
|
||||||
#if ENABLE_BGP_VNC
|
#if ENABLE_BGP_VNC
|
||||||
struct rd_vnc_eth rd_vnc_eth;
|
struct rd_vnc_eth rd_vnc_eth = {0};
|
||||||
#endif
|
#endif
|
||||||
u_char *pnt;
|
u_char *pnt;
|
||||||
|
|
||||||
|
@ -2680,6 +2680,21 @@ bgp_update (struct peer *peer, struct prefix *p, u_int32_t addpath_id,
|
|||||||
bgp_process (bgp, rn, afi, safi);
|
bgp_process (bgp, rn, afi, safi);
|
||||||
bgp_unlock_node (rn);
|
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;
|
return 0;
|
||||||
} // End of implicit withdraw
|
} // End of implicit withdraw
|
||||||
|
|
||||||
@ -2774,6 +2789,21 @@ bgp_update (struct peer *peer, struct prefix *p, u_int32_t addpath_id,
|
|||||||
/* Process change. */
|
/* Process change. */
|
||||||
bgp_process (bgp, rn, afi, safi);
|
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;
|
return 0;
|
||||||
|
|
||||||
/* This BGP update is filtered. Log the reason then update BGP
|
/* 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_node *rn;
|
||||||
struct bgp_info *ri;
|
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;
|
bgp = peer->bgp;
|
||||||
|
|
||||||
/* Lookup node. */
|
/* Lookup node. */
|
||||||
|
@ -417,9 +417,10 @@ del_vnc_route (
|
|||||||
{
|
{
|
||||||
|
|
||||||
vnc_zlog_debug_verbose
|
vnc_zlog_debug_verbose
|
||||||
("%s: trying bi=%p, bi->peer=%p, bi->type=%d, bi->sub_type=%d, bi->extra->vnc.export.rfapi_handle=%p",
|
("%s: trying bi=%p, bi->peer=%p, bi->type=%d, bi->sub_type=%d, bi->extra->vnc.export.rfapi_handle=%p, local_pref=%u",
|
||||||
__func__, bi, bi->peer, bi->type, bi->sub_type,
|
__func__, bi, bi->peer, bi->type, bi->sub_type,
|
||||||
(bi->extra ? bi->extra->vnc.export.rfapi_handle : NULL));
|
(bi->extra ? bi->extra->vnc.export.rfapi_handle : NULL),
|
||||||
|
((bi->attr && CHECK_FLAG(bi->attr->flag, ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF)))? bi->attr->local_pref: 0));
|
||||||
|
|
||||||
if (bi->peer == peer &&
|
if (bi->peer == peer &&
|
||||||
bi->type == type &&
|
bi->type == type &&
|
||||||
|
@ -3724,6 +3724,12 @@ rfapiBgpInfoFilteredImportVPN (
|
|||||||
if (rn->info)
|
if (rn->info)
|
||||||
original_had_routes = 1;
|
original_had_routes = 1;
|
||||||
|
|
||||||
|
if (VNC_DEBUG(VERBOSE))
|
||||||
|
{
|
||||||
|
vnc_zlog_debug_verbose ("%s: showing IT node on entry", __func__);
|
||||||
|
rfapiShowItNode (NULL, rn); /* debug */
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Look for same route (will have same RD and peer)
|
* Look for same route (will have same RD and peer)
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user