mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-03 06:32:33 +00:00
bgpd: fill the zebra mac-ip route via a common api
Move the info filling for zebra mac-ip install (sent by bgpd) to a
common place.
The commit also fixes missing ROUTER flag for one of the cases
added in a code branch that doesn't have the ROUTER changes -
[
6d8c603a
bgpd: use IP address as tie breaker if the MM seq number is the same
]
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
This commit is contained in:
parent
ce6c1c923b
commit
d594a14cad
@ -887,17 +887,26 @@ static void add_mac_mobility_to_attr(uint32_t seq_num, struct attr *attr)
|
||||
|
||||
/* Install EVPN route into zebra. */
|
||||
static int evpn_zebra_install(struct bgp *bgp, struct bgpevpn *vpn,
|
||||
struct prefix_evpn *p,
|
||||
struct in_addr remote_vtep_ip, uint8_t flags,
|
||||
uint32_t seq)
|
||||
struct prefix_evpn *p, struct bgp_path_info *pi)
|
||||
{
|
||||
int ret;
|
||||
uint8_t flags;
|
||||
|
||||
if (p->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE)
|
||||
ret = bgp_zebra_send_remote_macip(bgp, vpn, p, remote_vtep_ip,
|
||||
1, flags, seq);
|
||||
else
|
||||
if (p->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE) {
|
||||
flags = 0;
|
||||
if (pi->attr->sticky)
|
||||
SET_FLAG(flags, ZEBRA_MACIP_TYPE_STICKY);
|
||||
if (pi->attr->default_gw)
|
||||
SET_FLAG(flags, ZEBRA_MACIP_TYPE_GW);
|
||||
if (is_evpn_prefix_ipaddr_v6(p) &&
|
||||
pi->attr->router_flag)
|
||||
SET_FLAG(flags, ZEBRA_MACIP_TYPE_ROUTER_FLAG);
|
||||
ret = bgp_zebra_send_remote_macip(
|
||||
bgp, vpn, p, pi->attr->nexthop, 1, flags,
|
||||
mac_mobility_seqnum(pi->attr));
|
||||
} else {
|
||||
ret = bgp_zebra_send_remote_vtep(bgp, vpn, p, 1);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -1121,11 +1130,9 @@ static int evpn_route_select_install(struct bgp *bgp, struct bgpevpn *vpn,
|
||||
{
|
||||
struct bgp_path_info *old_select, *new_select;
|
||||
struct bgp_path_info_pair old_and_new;
|
||||
struct prefix_evpn *evp;
|
||||
afi_t afi = AFI_L2VPN;
|
||||
safi_t safi = SAFI_EVPN;
|
||||
int ret = 0;
|
||||
uint8_t flags = 0;
|
||||
|
||||
/* Compute the best path. */
|
||||
bgp_best_selection(bgp, rn, &bgp->maxpaths[afi][safi], &old_and_new,
|
||||
@ -1133,7 +1140,6 @@ static int evpn_route_select_install(struct bgp *bgp, struct bgpevpn *vpn,
|
||||
old_select = old_and_new.old;
|
||||
new_select = old_and_new.new;
|
||||
|
||||
evp = (struct prefix_evpn *)&rn->p;
|
||||
/* If the best path hasn't changed - see if there is still something to
|
||||
* update
|
||||
* to zebra RIB.
|
||||
@ -1144,20 +1150,10 @@ static int evpn_route_select_install(struct bgp *bgp, struct bgpevpn *vpn,
|
||||
&& !CHECK_FLAG(rn->flags, BGP_NODE_USER_CLEAR)
|
||||
&& !CHECK_FLAG(old_select->flags, BGP_PATH_ATTR_CHANGED)
|
||||
&& !bgp_addpath_is_addpath_used(&bgp->tx_addpath, afi, safi)) {
|
||||
if (bgp_zebra_has_route_changed(rn, old_select)) {
|
||||
if (old_select->attr->sticky)
|
||||
SET_FLAG(flags, ZEBRA_MACIP_TYPE_STICKY);
|
||||
if (old_select->attr->default_gw)
|
||||
SET_FLAG(flags, ZEBRA_MACIP_TYPE_GW);
|
||||
if (is_evpn_prefix_ipaddr_v6(evp) &&
|
||||
old_select->attr->router_flag)
|
||||
SET_FLAG(flags, ZEBRA_MACIP_TYPE_ROUTER_FLAG);
|
||||
|
||||
if (bgp_zebra_has_route_changed(rn, old_select))
|
||||
ret = evpn_zebra_install(
|
||||
bgp, vpn, (struct prefix_evpn *)&rn->p,
|
||||
old_select->attr->nexthop, flags,
|
||||
mac_mobility_seqnum(old_select->attr));
|
||||
}
|
||||
old_select);
|
||||
UNSET_FLAG(old_select->flags, BGP_PATH_MULTIPATH_CHG);
|
||||
bgp_zebra_clear_route_change_flags(rn);
|
||||
return ret;
|
||||
@ -1182,18 +1178,9 @@ static int evpn_route_select_install(struct bgp *bgp, struct bgpevpn *vpn,
|
||||
|
||||
if (new_select && new_select->type == ZEBRA_ROUTE_BGP
|
||||
&& new_select->sub_type == BGP_ROUTE_IMPORTED) {
|
||||
flags = 0;
|
||||
if (new_select->attr->sticky)
|
||||
SET_FLAG(flags, ZEBRA_MACIP_TYPE_STICKY);
|
||||
if (new_select->attr->default_gw)
|
||||
SET_FLAG(flags, ZEBRA_MACIP_TYPE_GW);
|
||||
if (is_evpn_prefix_ipaddr_v6(evp) &&
|
||||
new_select->attr->router_flag)
|
||||
SET_FLAG(flags, ZEBRA_MACIP_TYPE_ROUTER_FLAG);
|
||||
|
||||
ret = evpn_zebra_install(bgp, vpn, (struct prefix_evpn *)&rn->p,
|
||||
new_select->attr->nexthop, flags,
|
||||
mac_mobility_seqnum(new_select->attr));
|
||||
new_select);
|
||||
|
||||
/* If an old best existed and it was a "local" route, the only
|
||||
* reason
|
||||
* it would be supplanted is due to MAC mobility procedures. So,
|
||||
@ -1719,7 +1706,6 @@ static void evpn_cleanup_local_non_best_route(struct bgp *bgp,
|
||||
{
|
||||
struct bgp_path_info *tmp_pi;
|
||||
struct bgp_path_info *curr_select = NULL;
|
||||
uint8_t flags = 0;
|
||||
char buf[PREFIX_STRLEN];
|
||||
|
||||
/* local path was not picked as the winner; kick it out */
|
||||
@ -1740,15 +1726,9 @@ static void evpn_cleanup_local_non_best_route(struct bgp *bgp,
|
||||
}
|
||||
if (curr_select &&
|
||||
curr_select->type == ZEBRA_ROUTE_BGP
|
||||
&& curr_select->sub_type == BGP_ROUTE_IMPORTED) {
|
||||
if (curr_select->attr->sticky)
|
||||
SET_FLAG(flags, ZEBRA_MACIP_TYPE_STICKY);
|
||||
if (curr_select->attr->default_gw)
|
||||
SET_FLAG(flags, ZEBRA_MACIP_TYPE_GW);
|
||||
&& curr_select->sub_type == BGP_ROUTE_IMPORTED)
|
||||
evpn_zebra_install(bgp, vpn, (struct prefix_evpn *)&rn->p,
|
||||
curr_select->attr->nexthop, flags,
|
||||
mac_mobility_seqnum(curr_select->attr));
|
||||
}
|
||||
curr_select);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user