mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 07:48:07 +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. */
|
/* Install EVPN route into zebra. */
|
||||||
static int evpn_zebra_install(struct bgp *bgp, struct bgpevpn *vpn,
|
static int evpn_zebra_install(struct bgp *bgp, struct bgpevpn *vpn,
|
||||||
struct prefix_evpn *p,
|
struct prefix_evpn *p, struct bgp_path_info *pi)
|
||||||
struct in_addr remote_vtep_ip, uint8_t flags,
|
|
||||||
uint32_t seq)
|
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
uint8_t flags;
|
||||||
|
|
||||||
if (p->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE)
|
if (p->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE) {
|
||||||
ret = bgp_zebra_send_remote_macip(bgp, vpn, p, remote_vtep_ip,
|
flags = 0;
|
||||||
1, flags, seq);
|
if (pi->attr->sticky)
|
||||||
else
|
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);
|
ret = bgp_zebra_send_remote_vtep(bgp, vpn, p, 1);
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
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 *old_select, *new_select;
|
||||||
struct bgp_path_info_pair old_and_new;
|
struct bgp_path_info_pair old_and_new;
|
||||||
struct prefix_evpn *evp;
|
|
||||||
afi_t afi = AFI_L2VPN;
|
afi_t afi = AFI_L2VPN;
|
||||||
safi_t safi = SAFI_EVPN;
|
safi_t safi = SAFI_EVPN;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
uint8_t flags = 0;
|
|
||||||
|
|
||||||
/* Compute the best path. */
|
/* Compute the best path. */
|
||||||
bgp_best_selection(bgp, rn, &bgp->maxpaths[afi][safi], &old_and_new,
|
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;
|
old_select = old_and_new.old;
|
||||||
new_select = old_and_new.new;
|
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
|
/* If the best path hasn't changed - see if there is still something to
|
||||||
* update
|
* update
|
||||||
* to zebra RIB.
|
* 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(rn->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(rn, old_select)) {
|
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);
|
|
||||||
|
|
||||||
ret = evpn_zebra_install(
|
ret = evpn_zebra_install(
|
||||||
bgp, vpn, (struct prefix_evpn *)&rn->p,
|
bgp, vpn, (struct prefix_evpn *)&rn->p,
|
||||||
old_select->attr->nexthop, flags,
|
old_select);
|
||||||
mac_mobility_seqnum(old_select->attr));
|
|
||||||
}
|
|
||||||
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(rn);
|
||||||
return ret;
|
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
|
if (new_select && new_select->type == ZEBRA_ROUTE_BGP
|
||||||
&& new_select->sub_type == BGP_ROUTE_IMPORTED) {
|
&& 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,
|
ret = evpn_zebra_install(bgp, vpn, (struct prefix_evpn *)&rn->p,
|
||||||
new_select->attr->nexthop, flags,
|
new_select);
|
||||||
mac_mobility_seqnum(new_select->attr));
|
|
||||||
/* If an old best existed and it was a "local" route, the only
|
/* If an old best existed and it was a "local" route, the only
|
||||||
* reason
|
* reason
|
||||||
* it would be supplanted is due to MAC mobility procedures. So,
|
* 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 *tmp_pi;
|
||||||
struct bgp_path_info *curr_select = NULL;
|
struct bgp_path_info *curr_select = NULL;
|
||||||
uint8_t flags = 0;
|
|
||||||
char buf[PREFIX_STRLEN];
|
char buf[PREFIX_STRLEN];
|
||||||
|
|
||||||
/* local path was not picked as the winner; kick it out */
|
/* 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 &&
|
if (curr_select &&
|
||||||
curr_select->type == ZEBRA_ROUTE_BGP
|
curr_select->type == ZEBRA_ROUTE_BGP
|
||||||
&& curr_select->sub_type == BGP_ROUTE_IMPORTED) {
|
&& 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);
|
|
||||||
evpn_zebra_install(bgp, vpn, (struct prefix_evpn *)&rn->p,
|
evpn_zebra_install(bgp, vpn, (struct prefix_evpn *)&rn->p,
|
||||||
curr_select->attr->nexthop, flags,
|
curr_select);
|
||||||
mac_mobility_seqnum(curr_select->attr));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user