mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-17 21:38:11 +00:00
bgpd: More bgp_node -> bgp_dest cleanup
Some more of the bgp_node usage snuck in from big commits in the past month or so from feature work. Do some work to put it back to bgp_dest for incoming future work. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
parent
8228a9a7a5
commit
09319b4e0f
@ -156,7 +156,7 @@ struct bmp {
|
|||||||
* table entry, the sync* fields note down what we sent last
|
* table entry, the sync* fields note down what we sent last
|
||||||
*/
|
*/
|
||||||
struct prefix syncpos;
|
struct prefix syncpos;
|
||||||
struct bgp_node *syncrdpos;
|
struct bgp_dest *syncrdpos;
|
||||||
uint64_t syncpeerid;
|
uint64_t syncpeerid;
|
||||||
afi_t syncafi;
|
afi_t syncafi;
|
||||||
safi_t syncsafi;
|
safi_t syncsafi;
|
||||||
|
@ -65,7 +65,8 @@ DEFINE_QOBJ_TYPE(bgp_evpn_es)
|
|||||||
static int delete_all_vni_routes(struct bgp *bgp, struct bgpevpn *vpn);
|
static int delete_all_vni_routes(struct bgp *bgp, struct bgpevpn *vpn);
|
||||||
static void bgp_evpn_update_type2_route_entry(struct bgp *bgp,
|
static void bgp_evpn_update_type2_route_entry(struct bgp *bgp,
|
||||||
struct bgpevpn *vpn,
|
struct bgpevpn *vpn,
|
||||||
struct bgp_node *rn, struct bgp_path_info *local_pi,
|
struct bgp_dest *dest,
|
||||||
|
struct bgp_path_info *local_pi,
|
||||||
const char *caller);
|
const char *caller);
|
||||||
static struct in_addr zero_vtep_ip;
|
static struct in_addr zero_vtep_ip;
|
||||||
|
|
||||||
@ -545,9 +546,9 @@ static void evpn_convert_nexthop_to_ipv6(struct attr *attr)
|
|||||||
attr->mp_nexthop_len = IPV6_MAX_BYTELEN;
|
attr->mp_nexthop_len = IPV6_MAX_BYTELEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct bgp_node *bgp_global_evpn_node_get(
|
struct bgp_dest *bgp_global_evpn_node_get(struct bgp_table *table, afi_t afi,
|
||||||
struct bgp_table *table, afi_t afi,
|
safi_t safi,
|
||||||
safi_t safi, const struct prefix_evpn *evp,
|
const struct prefix_evpn *evp,
|
||||||
struct prefix_rd *prd)
|
struct prefix_rd *prd)
|
||||||
{
|
{
|
||||||
struct prefix_evpn global_p;
|
struct prefix_evpn global_p;
|
||||||
@ -562,9 +563,9 @@ struct bgp_node *bgp_global_evpn_node_get(
|
|||||||
return bgp_afi_node_get(table, afi, safi, (struct prefix *)evp, prd);
|
return bgp_afi_node_get(table, afi, safi, (struct prefix *)evp, prd);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct bgp_node *bgp_global_evpn_node_lookup(
|
struct bgp_dest *bgp_global_evpn_node_lookup(struct bgp_table *table, afi_t afi,
|
||||||
struct bgp_table *table, afi_t afi,
|
safi_t safi,
|
||||||
safi_t safi, const struct prefix_evpn *evp,
|
const struct prefix_evpn *evp,
|
||||||
struct prefix_rd *prd)
|
struct prefix_rd *prd)
|
||||||
{
|
{
|
||||||
struct prefix_evpn global_p;
|
struct prefix_evpn global_p;
|
||||||
@ -1359,9 +1360,9 @@ static int update_evpn_type5_route(struct bgp *bgp_vrf, struct prefix_evpn *evp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void bgp_evpn_get_sync_info(struct bgp *bgp, esi_t *esi,
|
static void bgp_evpn_get_sync_info(struct bgp *bgp, esi_t *esi,
|
||||||
struct bgp_node *rn, uint32_t loc_seq, uint32_t *max_sync_seq,
|
struct bgp_dest *dest, uint32_t loc_seq,
|
||||||
bool *active_on_peer, bool *peer_router,
|
uint32_t *max_sync_seq, bool *active_on_peer,
|
||||||
bool *proxy_from_peer)
|
bool *peer_router, bool *proxy_from_peer)
|
||||||
{
|
{
|
||||||
struct bgp_path_info *tmp_pi;
|
struct bgp_path_info *tmp_pi;
|
||||||
struct bgp_path_info *second_best_path = NULL;
|
struct bgp_path_info *second_best_path = NULL;
|
||||||
@ -1372,7 +1373,7 @@ static void bgp_evpn_get_sync_info(struct bgp *bgp, esi_t *esi,
|
|||||||
/* find the best non-local path. a local path can only be present
|
/* find the best non-local path. a local path can only be present
|
||||||
* as best path
|
* as best path
|
||||||
*/
|
*/
|
||||||
for (tmp_pi = bgp_dest_get_bgp_path_info(rn); tmp_pi;
|
for (tmp_pi = bgp_dest_get_bgp_path_info(dest); tmp_pi;
|
||||||
tmp_pi = tmp_pi->next) {
|
tmp_pi = tmp_pi->next) {
|
||||||
if (tmp_pi->sub_type != BGP_ROUTE_IMPORTED ||
|
if (tmp_pi->sub_type != BGP_ROUTE_IMPORTED ||
|
||||||
!CHECK_FLAG(tmp_pi->flags, BGP_PATH_VALID))
|
!CHECK_FLAG(tmp_pi->flags, BGP_PATH_VALID))
|
||||||
@ -1420,11 +1421,12 @@ static void bgp_evpn_get_sync_info(struct bgp *bgp, esi_t *esi,
|
|||||||
* VPN route table. It will take precedence over all sync paths.
|
* VPN route table. It will take precedence over all sync paths.
|
||||||
*/
|
*/
|
||||||
static void update_evpn_route_entry_sync_info(struct bgp *bgp,
|
static void update_evpn_route_entry_sync_info(struct bgp *bgp,
|
||||||
struct bgp_node *rn, struct attr *attr, uint32_t loc_seq,
|
struct bgp_dest *dest,
|
||||||
bool setup_sync)
|
struct attr *attr,
|
||||||
|
uint32_t loc_seq, bool setup_sync)
|
||||||
{
|
{
|
||||||
esi_t *esi;
|
esi_t *esi;
|
||||||
struct prefix_evpn *evp = (struct prefix_evpn *)&rn->p;
|
struct prefix_evpn *evp = (struct prefix_evpn *)&dest->p;
|
||||||
|
|
||||||
if (evp->prefix.route_type != BGP_EVPN_MAC_IP_ROUTE)
|
if (evp->prefix.route_type != BGP_EVPN_MAC_IP_ROUTE)
|
||||||
return;
|
return;
|
||||||
@ -1437,7 +1439,7 @@ static void update_evpn_route_entry_sync_info(struct bgp *bgp,
|
|||||||
bool peer_router = false;
|
bool peer_router = false;
|
||||||
bool proxy_from_peer = false;
|
bool proxy_from_peer = false;
|
||||||
|
|
||||||
bgp_evpn_get_sync_info(bgp, esi, rn, loc_seq,
|
bgp_evpn_get_sync_info(bgp, esi, dest, loc_seq,
|
||||||
&max_sync_seq, &active_on_peer,
|
&max_sync_seq, &active_on_peer,
|
||||||
&peer_router, &proxy_from_peer);
|
&peer_router, &proxy_from_peer);
|
||||||
attr->mm_sync_seqnum = max_sync_seq;
|
attr->mm_sync_seqnum = max_sync_seq;
|
||||||
@ -1937,8 +1939,10 @@ static int delete_evpn_route(struct bgp *bgp, struct bgpevpn *vpn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void bgp_evpn_update_type2_route_entry(struct bgp *bgp,
|
static void bgp_evpn_update_type2_route_entry(struct bgp *bgp,
|
||||||
struct bgpevpn *vpn, struct bgp_node *rn,
|
struct bgpevpn *vpn,
|
||||||
struct bgp_path_info *local_pi, const char *caller)
|
struct bgp_dest *dest,
|
||||||
|
struct bgp_path_info *local_pi,
|
||||||
|
const char *caller)
|
||||||
{
|
{
|
||||||
afi_t afi = AFI_L2VPN;
|
afi_t afi = AFI_L2VPN;
|
||||||
safi_t safi = SAFI_EVPN;
|
safi_t safi = SAFI_EVPN;
|
||||||
@ -1947,9 +1951,9 @@ static void bgp_evpn_update_type2_route_entry(struct bgp *bgp,
|
|||||||
struct attr *attr_new;
|
struct attr *attr_new;
|
||||||
uint32_t seq;
|
uint32_t seq;
|
||||||
int add_l3_ecomm = 0;
|
int add_l3_ecomm = 0;
|
||||||
struct bgp_node *global_rn;
|
struct bgp_dest *global_dest;
|
||||||
struct bgp_path_info *global_pi;
|
struct bgp_path_info *global_pi;
|
||||||
struct prefix_evpn *evp = (struct prefix_evpn *)&rn->p;
|
struct prefix_evpn *evp = (struct prefix_evpn *)&dest->p;
|
||||||
int route_change;
|
int route_change;
|
||||||
bool old_is_sync = false;
|
bool old_is_sync = false;
|
||||||
|
|
||||||
@ -2008,8 +2012,8 @@ static void bgp_evpn_update_type2_route_entry(struct bgp *bgp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Update the route entry. */
|
/* Update the route entry. */
|
||||||
route_change = update_evpn_route_entry(bgp, vpn, afi, safi,
|
route_change = update_evpn_route_entry(
|
||||||
rn, &attr, 0, &pi, 0, seq,
|
bgp, vpn, afi, safi, dest, &attr, 0, &pi, 0, seq,
|
||||||
true /* setup_sync */, &old_is_sync);
|
true /* setup_sync */, &old_is_sync);
|
||||||
|
|
||||||
assert(pi);
|
assert(pi);
|
||||||
@ -2026,14 +2030,14 @@ static void bgp_evpn_update_type2_route_entry(struct bgp *bgp,
|
|||||||
* advertised to peers; otherwise, ensure it is evicted and
|
* advertised to peers; otherwise, ensure it is evicted and
|
||||||
* (re)install the remote route into zebra.
|
* (re)install the remote route into zebra.
|
||||||
*/
|
*/
|
||||||
evpn_route_select_install(bgp, vpn, rn);
|
evpn_route_select_install(bgp, vpn, dest);
|
||||||
|
|
||||||
if (CHECK_FLAG(pi->flags, BGP_PATH_REMOVED)) {
|
if (CHECK_FLAG(pi->flags, BGP_PATH_REMOVED)) {
|
||||||
route_change = 0;
|
route_change = 0;
|
||||||
} else {
|
} else {
|
||||||
if (!CHECK_FLAG(pi->flags, BGP_PATH_SELECTED)) {
|
if (!CHECK_FLAG(pi->flags, BGP_PATH_SELECTED)) {
|
||||||
route_change = 0;
|
route_change = 0;
|
||||||
evpn_cleanup_local_non_best_route(bgp, vpn, rn, pi);
|
evpn_cleanup_local_non_best_route(bgp, vpn, dest, pi);
|
||||||
} else {
|
} else {
|
||||||
bool new_is_sync;
|
bool new_is_sync;
|
||||||
|
|
||||||
@ -2056,17 +2060,17 @@ static void bgp_evpn_update_type2_route_entry(struct bgp *bgp,
|
|||||||
|
|
||||||
if (route_change) {
|
if (route_change) {
|
||||||
/* Update route in global routing table. */
|
/* Update route in global routing table. */
|
||||||
global_rn = bgp_global_evpn_node_get(bgp->rib[afi][safi],
|
global_dest = bgp_global_evpn_node_get(bgp->rib[afi][safi], afi,
|
||||||
afi, safi, evp, &vpn->prd);
|
safi, evp, &vpn->prd);
|
||||||
assert(global_rn);
|
assert(global_dest);
|
||||||
update_evpn_route_entry(bgp, vpn, afi, safi, global_rn,
|
update_evpn_route_entry(
|
||||||
attr_new, 0, &global_pi, 0,
|
bgp, vpn, afi, safi, global_dest, attr_new, 0,
|
||||||
mac_mobility_seqnum(attr_new),
|
&global_pi, 0, mac_mobility_seqnum(attr_new),
|
||||||
false /* setup_sync */, NULL /* old_is_sync */);
|
false /* setup_sync */, NULL /* old_is_sync */);
|
||||||
|
|
||||||
/* Schedule for processing and unlock node. */
|
/* Schedule for processing and unlock node. */
|
||||||
bgp_process(bgp, global_rn, afi, safi);
|
bgp_process(bgp, global_dest, afi, safi);
|
||||||
bgp_dest_unlock_node(global_rn);
|
bgp_dest_unlock_node(global_dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Unintern temporary. */
|
/* Unintern temporary. */
|
||||||
|
@ -83,7 +83,7 @@ esi_t zero_esi_buf, *zero_esi = &zero_esi_buf;
|
|||||||
*/
|
*/
|
||||||
static int bgp_evpn_es_route_select_install(struct bgp *bgp,
|
static int bgp_evpn_es_route_select_install(struct bgp *bgp,
|
||||||
struct bgp_evpn_es *es,
|
struct bgp_evpn_es *es,
|
||||||
struct bgp_node *rn)
|
struct bgp_dest *dest)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
afi_t afi = AFI_L2VPN;
|
afi_t afi = AFI_L2VPN;
|
||||||
@ -93,8 +93,8 @@ static int bgp_evpn_es_route_select_install(struct bgp *bgp,
|
|||||||
struct bgp_path_info_pair old_and_new;
|
struct bgp_path_info_pair old_and_new;
|
||||||
|
|
||||||
/* Compute the best path. */
|
/* Compute the best path. */
|
||||||
bgp_best_selection(bgp, rn, &bgp->maxpaths[afi][safi],
|
bgp_best_selection(bgp, dest, &bgp->maxpaths[afi][safi], &old_and_new,
|
||||||
&old_and_new, afi, safi);
|
afi, safi);
|
||||||
old_select = old_and_new.old;
|
old_select = old_and_new.old;
|
||||||
new_select = old_and_new.new;
|
new_select = old_and_new.new;
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ static int bgp_evpn_es_route_select_install(struct bgp *bgp,
|
|||||||
if (old_select && old_select == new_select
|
if (old_select && old_select == new_select
|
||||||
&& old_select->type == ZEBRA_ROUTE_BGP
|
&& old_select->type == ZEBRA_ROUTE_BGP
|
||||||
&& old_select->sub_type == BGP_ROUTE_IMPORTED
|
&& old_select->sub_type == BGP_ROUTE_IMPORTED
|
||||||
&& !CHECK_FLAG(rn->flags, BGP_NODE_USER_CLEAR)
|
&& !CHECK_FLAG(dest->flags, BGP_NODE_USER_CLEAR)
|
||||||
&& !CHECK_FLAG(old_select->flags, BGP_PATH_ATTR_CHANGED)
|
&& !CHECK_FLAG(old_select->flags, BGP_PATH_ATTR_CHANGED)
|
||||||
&& !bgp_addpath_is_addpath_used(&bgp->tx_addpath, afi, safi)) {
|
&& !bgp_addpath_is_addpath_used(&bgp->tx_addpath, afi, safi)) {
|
||||||
if (bgp_zebra_has_route_changed(old_select)) {
|
if (bgp_zebra_has_route_changed(old_select)) {
|
||||||
@ -114,24 +114,25 @@ static int bgp_evpn_es_route_select_install(struct bgp *bgp,
|
|||||||
true /*esr*/);
|
true /*esr*/);
|
||||||
}
|
}
|
||||||
UNSET_FLAG(old_select->flags, BGP_PATH_MULTIPATH_CHG);
|
UNSET_FLAG(old_select->flags, BGP_PATH_MULTIPATH_CHG);
|
||||||
bgp_zebra_clear_route_change_flags(rn);
|
bgp_zebra_clear_route_change_flags(dest);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the user did a "clear" this flag will be set */
|
/* If the user did a "clear" this flag will be set */
|
||||||
UNSET_FLAG(rn->flags, BGP_NODE_USER_CLEAR);
|
UNSET_FLAG(dest->flags, BGP_NODE_USER_CLEAR);
|
||||||
|
|
||||||
/* bestpath has changed; update relevant fields and install or uninstall
|
/* bestpath has changed; update relevant fields and install or uninstall
|
||||||
* into the zebra RIB.
|
* into the zebra RIB.
|
||||||
*/
|
*/
|
||||||
if (old_select || new_select)
|
if (old_select || new_select)
|
||||||
bgp_bump_version(rn);
|
bgp_bump_version(dest);
|
||||||
|
|
||||||
if (old_select)
|
if (old_select)
|
||||||
bgp_path_info_unset_flag(rn, old_select, BGP_PATH_SELECTED);
|
bgp_path_info_unset_flag(dest, old_select, BGP_PATH_SELECTED);
|
||||||
if (new_select) {
|
if (new_select) {
|
||||||
bgp_path_info_set_flag(rn, new_select, BGP_PATH_SELECTED);
|
bgp_path_info_set_flag(dest, new_select, BGP_PATH_SELECTED);
|
||||||
bgp_path_info_unset_flag(rn, new_select, BGP_PATH_ATTR_CHANGED);
|
bgp_path_info_unset_flag(dest, new_select,
|
||||||
|
BGP_PATH_ATTR_CHANGED);
|
||||||
UNSET_FLAG(new_select->flags, BGP_PATH_MULTIPATH_CHG);
|
UNSET_FLAG(new_select->flags, BGP_PATH_MULTIPATH_CHG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,11 +149,11 @@ static int bgp_evpn_es_route_select_install(struct bgp *bgp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Clear any route change flags. */
|
/* Clear any route change flags. */
|
||||||
bgp_zebra_clear_route_change_flags(rn);
|
bgp_zebra_clear_route_change_flags(dest);
|
||||||
|
|
||||||
/* Reap old select bgp_path_info, if it has been removed */
|
/* Reap old select bgp_path_info, if it has been removed */
|
||||||
if (old_select && CHECK_FLAG(old_select->flags, BGP_PATH_REMOVED))
|
if (old_select && CHECK_FLAG(old_select->flags, BGP_PATH_REMOVED))
|
||||||
bgp_path_info_reap(rn, old_select);
|
bgp_path_info_reap(dest, old_select);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -163,17 +164,17 @@ static int bgp_evpn_es_route_install(struct bgp *bgp,
|
|||||||
struct bgp_path_info *parent_pi)
|
struct bgp_path_info *parent_pi)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct bgp_node *rn = NULL;
|
struct bgp_dest *dest = NULL;
|
||||||
struct bgp_path_info *pi = NULL;
|
struct bgp_path_info *pi = NULL;
|
||||||
struct attr *attr_new = NULL;
|
struct attr *attr_new = NULL;
|
||||||
|
|
||||||
/* Create (or fetch) route within the VNI.
|
/* Create (or fetch) route within the VNI.
|
||||||
* NOTE: There is no RD here.
|
* NOTE: There is no RD here.
|
||||||
*/
|
*/
|
||||||
rn = bgp_node_get(es->route_table, (struct prefix *)p);
|
dest = bgp_node_get(es->route_table, (struct prefix *)p);
|
||||||
|
|
||||||
/* Check if route entry is already present. */
|
/* Check if route entry is already present. */
|
||||||
for (pi = bgp_dest_get_bgp_path_info(rn); pi; pi = pi->next)
|
for (pi = bgp_dest_get_bgp_path_info(dest); pi; pi = pi->next)
|
||||||
if (pi->extra
|
if (pi->extra
|
||||||
&& (struct bgp_path_info *)pi->extra->parent ==
|
&& (struct bgp_path_info *)pi->extra->parent ==
|
||||||
parent_pi)
|
parent_pi)
|
||||||
@ -185,16 +186,16 @@ static int bgp_evpn_es_route_install(struct bgp *bgp,
|
|||||||
|
|
||||||
/* Create new route with its attribute. */
|
/* Create new route with its attribute. */
|
||||||
pi = info_make(parent_pi->type, BGP_ROUTE_IMPORTED, 0,
|
pi = info_make(parent_pi->type, BGP_ROUTE_IMPORTED, 0,
|
||||||
parent_pi->peer, attr_new, rn);
|
parent_pi->peer, attr_new, dest);
|
||||||
SET_FLAG(pi->flags, BGP_PATH_VALID);
|
SET_FLAG(pi->flags, BGP_PATH_VALID);
|
||||||
bgp_path_info_extra_get(pi);
|
bgp_path_info_extra_get(pi);
|
||||||
pi->extra->parent = bgp_path_info_lock(parent_pi);
|
pi->extra->parent = bgp_path_info_lock(parent_pi);
|
||||||
bgp_dest_lock_node((struct bgp_node *)parent_pi->net);
|
bgp_dest_lock_node((struct bgp_dest *)parent_pi->net);
|
||||||
bgp_path_info_add(rn, pi);
|
bgp_path_info_add(dest, pi);
|
||||||
} else {
|
} else {
|
||||||
if (attrhash_cmp(pi->attr, parent_pi->attr)
|
if (attrhash_cmp(pi->attr, parent_pi->attr)
|
||||||
&& !CHECK_FLAG(pi->flags, BGP_PATH_REMOVED)) {
|
&& !CHECK_FLAG(pi->flags, BGP_PATH_REMOVED)) {
|
||||||
bgp_dest_unlock_node(rn);
|
bgp_dest_unlock_node(dest);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* The attribute has changed. */
|
/* The attribute has changed. */
|
||||||
@ -203,7 +204,7 @@ static int bgp_evpn_es_route_install(struct bgp *bgp,
|
|||||||
|
|
||||||
/* Restore route, if needed. */
|
/* Restore route, if needed. */
|
||||||
if (CHECK_FLAG(pi->flags, BGP_PATH_REMOVED))
|
if (CHECK_FLAG(pi->flags, BGP_PATH_REMOVED))
|
||||||
bgp_path_info_restore(rn, pi);
|
bgp_path_info_restore(dest, pi);
|
||||||
|
|
||||||
/* Mark if nexthop has changed. */
|
/* Mark if nexthop has changed. */
|
||||||
if (!IPV4_ADDR_SAME(&pi->attr->nexthop, &attr_new->nexthop))
|
if (!IPV4_ADDR_SAME(&pi->attr->nexthop, &attr_new->nexthop))
|
||||||
@ -216,9 +217,9 @@ static int bgp_evpn_es_route_install(struct bgp *bgp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Perform route selection and update zebra, if required. */
|
/* Perform route selection and update zebra, if required. */
|
||||||
ret = bgp_evpn_es_route_select_install(bgp, es, rn);
|
ret = bgp_evpn_es_route_select_install(bgp, es, dest);
|
||||||
|
|
||||||
bgp_dest_unlock_node(rn);
|
bgp_dest_unlock_node(dest);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -228,7 +229,7 @@ static int bgp_evpn_es_route_uninstall(struct bgp *bgp, struct bgp_evpn_es *es,
|
|||||||
struct prefix_evpn *p, struct bgp_path_info *parent_pi)
|
struct prefix_evpn *p, struct bgp_path_info *parent_pi)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct bgp_node *rn;
|
struct bgp_dest *dest;
|
||||||
struct bgp_path_info *pi;
|
struct bgp_path_info *pi;
|
||||||
|
|
||||||
if (!es->route_table)
|
if (!es->route_table)
|
||||||
@ -237,12 +238,12 @@ static int bgp_evpn_es_route_uninstall(struct bgp *bgp, struct bgp_evpn_es *es,
|
|||||||
/* Locate route within the ESI.
|
/* Locate route within the ESI.
|
||||||
* NOTE: There is no RD here.
|
* NOTE: There is no RD here.
|
||||||
*/
|
*/
|
||||||
rn = bgp_node_lookup(es->route_table, (struct prefix *)p);
|
dest = bgp_node_lookup(es->route_table, (struct prefix *)p);
|
||||||
if (!rn)
|
if (!dest)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Find matching route entry. */
|
/* Find matching route entry. */
|
||||||
for (pi = bgp_dest_get_bgp_path_info(rn); pi; pi = pi->next)
|
for (pi = bgp_dest_get_bgp_path_info(dest); pi; pi = pi->next)
|
||||||
if (pi->extra
|
if (pi->extra
|
||||||
&& (struct bgp_path_info *)pi->extra->parent ==
|
&& (struct bgp_path_info *)pi->extra->parent ==
|
||||||
parent_pi)
|
parent_pi)
|
||||||
@ -252,13 +253,13 @@ static int bgp_evpn_es_route_uninstall(struct bgp *bgp, struct bgp_evpn_es *es,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Mark entry for deletion */
|
/* Mark entry for deletion */
|
||||||
bgp_path_info_delete(rn, pi);
|
bgp_path_info_delete(dest, pi);
|
||||||
|
|
||||||
/* Perform route selection and update zebra, if required. */
|
/* Perform route selection and update zebra, if required. */
|
||||||
ret = bgp_evpn_es_route_select_install(bgp, es, rn);
|
ret = bgp_evpn_es_route_select_install(bgp, es, dest);
|
||||||
|
|
||||||
/* Unlock route node. */
|
/* Unlock route node. */
|
||||||
bgp_dest_unlock_node(rn);
|
bgp_dest_unlock_node(dest);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -293,7 +294,7 @@ int bgp_evpn_es_route_install_uninstall(struct bgp *bgp, struct bgp_evpn_es *es,
|
|||||||
*/
|
*/
|
||||||
static void bgp_evpn_es_route_del_all(struct bgp *bgp, struct bgp_evpn_es *es)
|
static void bgp_evpn_es_route_del_all(struct bgp *bgp, struct bgp_evpn_es *es)
|
||||||
{
|
{
|
||||||
struct bgp_node *rn;
|
struct bgp_dest *dest;
|
||||||
struct bgp_path_info *pi, *nextpi;
|
struct bgp_path_info *pi, *nextpi;
|
||||||
|
|
||||||
/* de-activate the ES */
|
/* de-activate the ES */
|
||||||
@ -301,13 +302,12 @@ static void bgp_evpn_es_route_del_all(struct bgp *bgp, struct bgp_evpn_es *es)
|
|||||||
bgp_evpn_local_type1_evi_route_del(bgp, es);
|
bgp_evpn_local_type1_evi_route_del(bgp, es);
|
||||||
|
|
||||||
/* Walk this ES's routing table and delete all routes. */
|
/* Walk this ES's routing table and delete all routes. */
|
||||||
for (rn = bgp_table_top(es->route_table); rn;
|
for (dest = bgp_table_top(es->route_table); dest;
|
||||||
rn = bgp_route_next(rn)) {
|
dest = bgp_route_next(dest)) {
|
||||||
for (pi = bgp_dest_get_bgp_path_info(rn);
|
for (pi = bgp_dest_get_bgp_path_info(dest);
|
||||||
(pi != NULL) && (nextpi = pi->next, 1);
|
(pi != NULL) && (nextpi = pi->next, 1); pi = nextpi) {
|
||||||
pi = nextpi) {
|
bgp_path_info_delete(dest, pi);
|
||||||
bgp_path_info_delete(rn, pi);
|
bgp_path_info_reap(dest, pi);
|
||||||
bgp_path_info_reap(rn, pi);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -327,10 +327,11 @@ static void bgp_evpn_es_route_del_all(struct bgp *bgp, struct bgp_evpn_es *es)
|
|||||||
* Note: vpn is applicable only to EAD-EVI routes (NULL for EAD-ES and
|
* Note: vpn is applicable only to EAD-EVI routes (NULL for EAD-ES and
|
||||||
* ESR).
|
* ESR).
|
||||||
*/
|
*/
|
||||||
static int bgp_evpn_mh_route_update(struct bgp *bgp,
|
static int bgp_evpn_mh_route_update(struct bgp *bgp, struct bgp_evpn_es *es,
|
||||||
struct bgp_evpn_es *es, struct bgpevpn *vpn, afi_t afi,
|
struct bgpevpn *vpn, afi_t afi, safi_t safi,
|
||||||
safi_t safi, struct bgp_node *rn, struct attr *attr,
|
struct bgp_dest *dest, struct attr *attr,
|
||||||
int add, struct bgp_path_info **ri, int *route_changed)
|
int add, struct bgp_path_info **ri,
|
||||||
|
int *route_changed)
|
||||||
{
|
{
|
||||||
struct bgp_path_info *tmp_pi = NULL;
|
struct bgp_path_info *tmp_pi = NULL;
|
||||||
struct bgp_path_info *local_pi = NULL; /* local route entry if any */
|
struct bgp_path_info *local_pi = NULL; /* local route entry if any */
|
||||||
@ -339,11 +340,11 @@ static int bgp_evpn_mh_route_update(struct bgp *bgp,
|
|||||||
struct prefix_evpn *evp;
|
struct prefix_evpn *evp;
|
||||||
|
|
||||||
*ri = NULL;
|
*ri = NULL;
|
||||||
evp = (struct prefix_evpn *)&rn->p;
|
evp = (struct prefix_evpn *)&dest->p;
|
||||||
*route_changed = 1;
|
*route_changed = 1;
|
||||||
|
|
||||||
/* locate the local and remote entries if any */
|
/* locate the local and remote entries if any */
|
||||||
for (tmp_pi = bgp_dest_get_bgp_path_info(rn); tmp_pi;
|
for (tmp_pi = bgp_dest_get_bgp_path_info(dest); tmp_pi;
|
||||||
tmp_pi = tmp_pi->next) {
|
tmp_pi = tmp_pi->next) {
|
||||||
if (tmp_pi->peer == bgp->peer_self
|
if (tmp_pi->peer == bgp->peer_self
|
||||||
&& tmp_pi->type == ZEBRA_ROUTE_BGP
|
&& tmp_pi->type == ZEBRA_ROUTE_BGP
|
||||||
@ -379,7 +380,7 @@ static int bgp_evpn_mh_route_update(struct bgp *bgp,
|
|||||||
|
|
||||||
/* Create new route with its attribute. */
|
/* Create new route with its attribute. */
|
||||||
tmp_pi = info_make(ZEBRA_ROUTE_BGP, BGP_ROUTE_STATIC, 0,
|
tmp_pi = info_make(ZEBRA_ROUTE_BGP, BGP_ROUTE_STATIC, 0,
|
||||||
bgp->peer_self, attr_new, rn);
|
bgp->peer_self, attr_new, dest);
|
||||||
SET_FLAG(tmp_pi->flags, BGP_PATH_VALID);
|
SET_FLAG(tmp_pi->flags, BGP_PATH_VALID);
|
||||||
|
|
||||||
if (evp->prefix.route_type == BGP_EVPN_AD_ROUTE) {
|
if (evp->prefix.route_type == BGP_EVPN_AD_ROUTE) {
|
||||||
@ -392,7 +393,7 @@ static int bgp_evpn_mh_route_update(struct bgp *bgp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* add the newly created path to the route-node */
|
/* add the newly created path to the route-node */
|
||||||
bgp_path_info_add(rn, tmp_pi);
|
bgp_path_info_add(dest, tmp_pi);
|
||||||
} else {
|
} else {
|
||||||
tmp_pi = local_pi;
|
tmp_pi = local_pi;
|
||||||
if (attrhash_cmp(tmp_pi->attr, attr)
|
if (attrhash_cmp(tmp_pi->attr, attr)
|
||||||
@ -403,12 +404,12 @@ static int bgp_evpn_mh_route_update(struct bgp *bgp,
|
|||||||
* Add (or update) attribute to hash.
|
* Add (or update) attribute to hash.
|
||||||
*/
|
*/
|
||||||
attr_new = bgp_attr_intern(attr);
|
attr_new = bgp_attr_intern(attr);
|
||||||
bgp_path_info_set_flag(rn, tmp_pi,
|
bgp_path_info_set_flag(dest, tmp_pi,
|
||||||
BGP_PATH_ATTR_CHANGED);
|
BGP_PATH_ATTR_CHANGED);
|
||||||
|
|
||||||
/* Restore route, if needed. */
|
/* Restore route, if needed. */
|
||||||
if (CHECK_FLAG(tmp_pi->flags, BGP_PATH_REMOVED))
|
if (CHECK_FLAG(tmp_pi->flags, BGP_PATH_REMOVED))
|
||||||
bgp_path_info_restore(rn, tmp_pi);
|
bgp_path_info_restore(dest, tmp_pi);
|
||||||
|
|
||||||
/* Unintern existing, set to new. */
|
/* Unintern existing, set to new. */
|
||||||
bgp_attr_unintern(&tmp_pi->attr);
|
bgp_attr_unintern(&tmp_pi->attr);
|
||||||
@ -444,8 +445,8 @@ static int bgp_evpn_mh_route_delete(struct bgp *bgp, struct bgp_evpn_es *es,
|
|||||||
afi_t afi = AFI_L2VPN;
|
afi_t afi = AFI_L2VPN;
|
||||||
safi_t safi = SAFI_EVPN;
|
safi_t safi = SAFI_EVPN;
|
||||||
struct bgp_path_info *pi;
|
struct bgp_path_info *pi;
|
||||||
struct bgp_node *rn = NULL; /* rn in esi table */
|
struct bgp_dest *dest = NULL; /* dest in esi table */
|
||||||
struct bgp_node *global_rn = NULL; /* rn in global table */
|
struct bgp_dest *global_dest = NULL; /* dest in global table */
|
||||||
struct bgp_table *rt_table;
|
struct bgp_table *rt_table;
|
||||||
struct prefix_rd *prd;
|
struct prefix_rd *prd;
|
||||||
|
|
||||||
@ -461,8 +462,8 @@ static int bgp_evpn_mh_route_delete(struct bgp *bgp, struct bgp_evpn_es *es,
|
|||||||
* If it doesn't exist, ther is nothing to do.
|
* If it doesn't exist, ther is nothing to do.
|
||||||
* Note: there is no RD here.
|
* Note: there is no RD here.
|
||||||
*/
|
*/
|
||||||
rn = bgp_node_lookup(rt_table, (struct prefix *)p);
|
dest = bgp_node_lookup(rt_table, (struct prefix *)p);
|
||||||
if (!rn)
|
if (!dest)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (BGP_DEBUG(evpn_mh, EVPN_MH_RT))
|
if (BGP_DEBUG(evpn_mh, EVPN_MH_RT))
|
||||||
@ -476,29 +477,30 @@ static int bgp_evpn_mh_route_delete(struct bgp *bgp, struct bgp_evpn_es *es,
|
|||||||
/* Next, locate route node in the global EVPN routing table.
|
/* Next, locate route node in the global EVPN routing table.
|
||||||
* Note that this table is a 2-level tree (RD-level + Prefix-level)
|
* Note that this table is a 2-level tree (RD-level + Prefix-level)
|
||||||
*/
|
*/
|
||||||
global_rn = bgp_global_evpn_node_lookup(bgp->rib[afi][safi], afi, safi,
|
global_dest =
|
||||||
|
bgp_global_evpn_node_lookup(bgp->rib[afi][safi], afi, safi,
|
||||||
(const struct prefix_evpn *)p, prd);
|
(const struct prefix_evpn *)p, prd);
|
||||||
if (global_rn) {
|
if (global_dest) {
|
||||||
|
|
||||||
/* Delete route entry in the global EVPN table. */
|
/* Delete route entry in the global EVPN table. */
|
||||||
delete_evpn_route_entry(bgp, afi, safi, global_rn, &pi);
|
delete_evpn_route_entry(bgp, afi, safi, global_dest, &pi);
|
||||||
|
|
||||||
/* Schedule for processing - withdraws to peers happen from
|
/* Schedule for processing - withdraws to peers happen from
|
||||||
* this table.
|
* this table.
|
||||||
*/
|
*/
|
||||||
if (pi)
|
if (pi)
|
||||||
bgp_process(bgp, global_rn, afi, safi);
|
bgp_process(bgp, global_dest, afi, safi);
|
||||||
bgp_dest_unlock_node(global_rn);
|
bgp_dest_unlock_node(global_dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Delete route entry in the ESI or VNI routing table.
|
* Delete route entry in the ESI or VNI routing table.
|
||||||
* This can just be removed.
|
* This can just be removed.
|
||||||
*/
|
*/
|
||||||
delete_evpn_route_entry(bgp, afi, safi, rn, &pi);
|
delete_evpn_route_entry(bgp, afi, safi, dest, &pi);
|
||||||
if (pi)
|
if (pi)
|
||||||
bgp_path_info_reap(rn, pi);
|
bgp_path_info_reap(dest, pi);
|
||||||
bgp_dest_unlock_node(rn);
|
bgp_dest_unlock_node(dest);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -551,7 +553,7 @@ static int bgp_evpn_type4_route_update(struct bgp *bgp,
|
|||||||
safi_t safi = SAFI_EVPN;
|
safi_t safi = SAFI_EVPN;
|
||||||
struct attr attr;
|
struct attr attr;
|
||||||
struct attr *attr_new = NULL;
|
struct attr *attr_new = NULL;
|
||||||
struct bgp_node *rn = NULL;
|
struct bgp_dest *dest = NULL;
|
||||||
struct bgp_path_info *pi = NULL;
|
struct bgp_path_info *pi = NULL;
|
||||||
|
|
||||||
memset(&attr, 0, sizeof(struct attr));
|
memset(&attr, 0, sizeof(struct attr));
|
||||||
@ -567,11 +569,11 @@ static int bgp_evpn_type4_route_update(struct bgp *bgp,
|
|||||||
|
|
||||||
/* First, create (or fetch) route node within the ESI. */
|
/* First, create (or fetch) route node within the ESI. */
|
||||||
/* NOTE: There is no RD here. */
|
/* NOTE: There is no RD here. */
|
||||||
rn = bgp_node_get(es->route_table, (struct prefix *)p);
|
dest = bgp_node_get(es->route_table, (struct prefix *)p);
|
||||||
|
|
||||||
/* Create or update route entry. */
|
/* Create or update route entry. */
|
||||||
ret = bgp_evpn_mh_route_update(bgp, es, NULL, afi, safi,
|
ret = bgp_evpn_mh_route_update(bgp, es, NULL, afi, safi, dest, &attr, 1,
|
||||||
rn, &attr, 1, &pi, &route_changed);
|
&pi, &route_changed);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
flog_err(EC_BGP_ES_INVALID,
|
flog_err(EC_BGP_ES_INVALID,
|
||||||
"%u ERROR: Failed to updated ES route ESI: %s VTEP %s",
|
"%u ERROR: Failed to updated ES route ESI: %s VTEP %s",
|
||||||
@ -586,8 +588,8 @@ static int bgp_evpn_type4_route_update(struct bgp *bgp,
|
|||||||
* this is just to set the flags correctly
|
* this is just to set the flags correctly
|
||||||
* as local route in the ES always wins.
|
* as local route in the ES always wins.
|
||||||
*/
|
*/
|
||||||
bgp_evpn_es_route_select_install(bgp, es, rn);
|
bgp_evpn_es_route_select_install(bgp, es, dest);
|
||||||
bgp_dest_unlock_node(rn);
|
bgp_dest_unlock_node(dest);
|
||||||
|
|
||||||
/* If this is a new route or some attribute has changed, export the
|
/* If this is a new route or some attribute has changed, export the
|
||||||
* route to the global table. The route will be advertised to peers
|
* route to the global table. The route will be advertised to peers
|
||||||
@ -597,14 +599,15 @@ static int bgp_evpn_type4_route_update(struct bgp *bgp,
|
|||||||
if (route_changed) {
|
if (route_changed) {
|
||||||
struct bgp_path_info *global_pi;
|
struct bgp_path_info *global_pi;
|
||||||
|
|
||||||
rn = bgp_global_evpn_node_get(bgp->rib[afi][safi], afi, safi,
|
dest = bgp_global_evpn_node_get(bgp->rib[afi][safi], afi, safi,
|
||||||
p, &es->prd);
|
p, &es->prd);
|
||||||
bgp_evpn_mh_route_update(bgp, es, NULL, afi, safi,
|
bgp_evpn_mh_route_update(bgp, es, NULL, afi, safi, dest,
|
||||||
rn, attr_new, 1, &global_pi, &route_changed);
|
attr_new, 1, &global_pi,
|
||||||
|
&route_changed);
|
||||||
|
|
||||||
/* Schedule for processing and unlock node. */
|
/* Schedule for processing and unlock node. */
|
||||||
bgp_process(bgp, rn, afi, safi);
|
bgp_process(bgp, dest, afi, safi);
|
||||||
bgp_dest_unlock_node(rn);
|
bgp_dest_unlock_node(dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Unintern temporary. */
|
/* Unintern temporary. */
|
||||||
@ -695,7 +698,7 @@ static int bgp_evpn_type4_remote_routes_import(struct bgp *bgp,
|
|||||||
afi_t afi;
|
afi_t afi;
|
||||||
safi_t safi;
|
safi_t safi;
|
||||||
char buf[PREFIX_STRLEN];
|
char buf[PREFIX_STRLEN];
|
||||||
struct bgp_node *rd_rn, *rn;
|
struct bgp_dest *rd_dest, *dest;
|
||||||
struct bgp_table *table;
|
struct bgp_table *table;
|
||||||
struct bgp_path_info *pi;
|
struct bgp_path_info *pi;
|
||||||
|
|
||||||
@ -705,16 +708,18 @@ static int bgp_evpn_type4_remote_routes_import(struct bgp *bgp,
|
|||||||
/* Walk entire global routing table and evaluate routes which could be
|
/* Walk entire global routing table and evaluate routes which could be
|
||||||
* imported into this Ethernet Segment.
|
* imported into this Ethernet Segment.
|
||||||
*/
|
*/
|
||||||
for (rd_rn = bgp_table_top(bgp->rib[afi][safi]); rd_rn;
|
for (rd_dest = bgp_table_top(bgp->rib[afi][safi]); rd_dest;
|
||||||
rd_rn = bgp_route_next(rd_rn)) {
|
rd_dest = bgp_route_next(rd_dest)) {
|
||||||
table = bgp_dest_get_bgp_table_info(rd_rn);
|
table = bgp_dest_get_bgp_table_info(rd_dest);
|
||||||
if (!table)
|
if (!table)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) {
|
for (dest = bgp_table_top(table); dest;
|
||||||
struct prefix_evpn *evp = (struct prefix_evpn *)&rn->p;
|
dest = bgp_route_next(dest)) {
|
||||||
|
struct prefix_evpn *evp =
|
||||||
|
(struct prefix_evpn *)&dest->p;
|
||||||
|
|
||||||
for (pi = bgp_dest_get_bgp_path_info(rn); pi;
|
for (pi = bgp_dest_get_bgp_path_info(dest); pi;
|
||||||
pi = pi->next) {
|
pi = pi->next) {
|
||||||
/*
|
/*
|
||||||
* Consider "valid" remote routes applicable for
|
* Consider "valid" remote routes applicable for
|
||||||
@ -845,7 +850,7 @@ static int bgp_evpn_type1_route_update(struct bgp *bgp,
|
|||||||
safi_t safi = SAFI_EVPN;
|
safi_t safi = SAFI_EVPN;
|
||||||
struct attr attr;
|
struct attr attr;
|
||||||
struct attr *attr_new = NULL;
|
struct attr *attr_new = NULL;
|
||||||
struct bgp_node *rn = NULL;
|
struct bgp_dest *dest = NULL;
|
||||||
struct bgp_path_info *pi = NULL;
|
struct bgp_path_info *pi = NULL;
|
||||||
int route_changed = 0;
|
int route_changed = 0;
|
||||||
struct prefix_rd *global_rd;
|
struct prefix_rd *global_rd;
|
||||||
@ -867,11 +872,11 @@ static int bgp_evpn_type1_route_update(struct bgp *bgp,
|
|||||||
bgp_evpn_type1_evi_route_extcomm_build(es, vpn, &attr);
|
bgp_evpn_type1_evi_route_extcomm_build(es, vpn, &attr);
|
||||||
|
|
||||||
/* First, create (or fetch) route node within the VNI. */
|
/* First, create (or fetch) route node within the VNI. */
|
||||||
rn = bgp_node_get(vpn->route_table, (struct prefix *)p);
|
dest = bgp_node_get(vpn->route_table, (struct prefix *)p);
|
||||||
|
|
||||||
/* Create or update route entry. */
|
/* Create or update route entry. */
|
||||||
ret = bgp_evpn_mh_route_update(bgp, es, vpn, afi, safi,
|
ret = bgp_evpn_mh_route_update(bgp, es, vpn, afi, safi, dest,
|
||||||
rn, &attr, 1, &pi, &route_changed);
|
&attr, 1, &pi, &route_changed);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
flog_err(EC_BGP_ES_INVALID,
|
flog_err(EC_BGP_ES_INVALID,
|
||||||
"%u Failed to update EAD-EVI route ESI: %s VNI %u VTEP %s",
|
"%u Failed to update EAD-EVI route ESI: %s VNI %u VTEP %s",
|
||||||
@ -889,11 +894,11 @@ static int bgp_evpn_type1_route_update(struct bgp *bgp,
|
|||||||
/* First, create (or fetch) route node within the ES. */
|
/* First, create (or fetch) route node within the ES. */
|
||||||
/* NOTE: There is no RD here. */
|
/* NOTE: There is no RD here. */
|
||||||
/* XXX: fragment ID must be included as a part of the prefix. */
|
/* XXX: fragment ID must be included as a part of the prefix. */
|
||||||
rn = bgp_node_get(es->route_table, (struct prefix *)p);
|
dest = bgp_node_get(es->route_table, (struct prefix *)p);
|
||||||
|
|
||||||
/* Create or update route entry. */
|
/* Create or update route entry. */
|
||||||
ret = bgp_evpn_mh_route_update(bgp, es, vpn, afi, safi,
|
ret = bgp_evpn_mh_route_update(bgp, es, vpn, afi, safi, dest,
|
||||||
rn, &attr, 1, &pi, &route_changed);
|
&attr, 1, &pi, &route_changed);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
flog_err(EC_BGP_ES_INVALID,
|
flog_err(EC_BGP_ES_INVALID,
|
||||||
"%u ERROR: Failed to updated EAD-EVI route ESI: %s VTEP %s",
|
"%u ERROR: Failed to updated EAD-EVI route ESI: %s VTEP %s",
|
||||||
@ -911,8 +916,8 @@ static int bgp_evpn_type1_route_update(struct bgp *bgp,
|
|||||||
* this is just to set the flags correctly as local route in
|
* this is just to set the flags correctly as local route in
|
||||||
* the ES always wins.
|
* the ES always wins.
|
||||||
*/
|
*/
|
||||||
evpn_route_select_install(bgp, vpn, rn);
|
evpn_route_select_install(bgp, vpn, dest);
|
||||||
bgp_dest_unlock_node(rn);
|
bgp_dest_unlock_node(dest);
|
||||||
|
|
||||||
/* If this is a new route or some attribute has changed, export the
|
/* If this is a new route or some attribute has changed, export the
|
||||||
* route to the global table. The route will be advertised to peers
|
* route to the global table. The route will be advertised to peers
|
||||||
@ -922,14 +927,15 @@ static int bgp_evpn_type1_route_update(struct bgp *bgp,
|
|||||||
if (route_changed) {
|
if (route_changed) {
|
||||||
struct bgp_path_info *global_pi;
|
struct bgp_path_info *global_pi;
|
||||||
|
|
||||||
rn = bgp_global_evpn_node_get(bgp->rib[afi][safi], afi, safi,
|
dest = bgp_global_evpn_node_get(bgp->rib[afi][safi], afi, safi,
|
||||||
p, global_rd);
|
p, global_rd);
|
||||||
bgp_evpn_mh_route_update(bgp, es, vpn, afi, safi,
|
bgp_evpn_mh_route_update(bgp, es, vpn, afi, safi, dest,
|
||||||
rn, attr_new, 1, &global_pi, &route_changed);
|
attr_new, 1, &global_pi,
|
||||||
|
&route_changed);
|
||||||
|
|
||||||
/* Schedule for processing and unlock node. */
|
/* Schedule for processing and unlock node. */
|
||||||
bgp_process(bgp, rn, afi, safi);
|
bgp_process(bgp, dest, afi, safi);
|
||||||
bgp_dest_unlock_node(rn);
|
bgp_dest_unlock_node(dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Unintern temporary. */
|
/* Unintern temporary. */
|
||||||
|
@ -603,11 +603,13 @@ extern void delete_evpn_route_entry(struct bgp *bgp, afi_t afi, safi_t safi,
|
|||||||
struct bgp_path_info **pi);
|
struct bgp_path_info **pi);
|
||||||
int vni_list_cmp(void *p1, void *p2);
|
int vni_list_cmp(void *p1, void *p2);
|
||||||
extern int evpn_route_select_install(struct bgp *bgp, struct bgpevpn *vpn,
|
extern int evpn_route_select_install(struct bgp *bgp, struct bgpevpn *vpn,
|
||||||
struct bgp_node *rn);
|
struct bgp_dest *dest);
|
||||||
extern struct bgp_node *bgp_global_evpn_node_get(
|
extern struct bgp_dest *bgp_global_evpn_node_get(struct bgp_table *table,
|
||||||
struct bgp_table *table, afi_t afi, safi_t safi,
|
afi_t afi, safi_t safi,
|
||||||
const struct prefix_evpn *evp, struct prefix_rd *prd);
|
const struct prefix_evpn *evp,
|
||||||
extern struct bgp_node *bgp_global_evpn_node_lookup(
|
struct prefix_rd *prd);
|
||||||
struct bgp_table *table, afi_t afi, safi_t safi,
|
extern struct bgp_dest *
|
||||||
const struct prefix_evpn *evp, struct prefix_rd *prd);
|
bgp_global_evpn_node_lookup(struct bgp_table *table, afi_t afi, safi_t safi,
|
||||||
|
const struct prefix_evpn *evp,
|
||||||
|
struct prefix_rd *prd);
|
||||||
#endif /* _BGP_EVPN_PRIVATE_H */
|
#endif /* _BGP_EVPN_PRIVATE_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user