mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-14 19:16:28 +00:00
bgpd: modify bmp_get_peer_distinguisher to support AFI_UNSPEC
If a given L3VRF instance requests a peer distinguisher for a peer up/down message, the AFI_UNSPEC afi parameter will be used; no RD is chosen for this AFI. Fix this by priorizing the AFI_IP value before the AFI_IP6 value. For instance, a router with both RD set for each address-family, peer up/down messages will be sent with the RD set to the one for AFI_IP. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
This commit is contained in:
parent
d55a5864dd
commit
b7059a8fd9
@ -279,6 +279,8 @@ static inline int bmp_get_peer_distinguisher(struct bmp *bmp, afi_t afi,
|
|||||||
uint8_t peer_type,
|
uint8_t peer_type,
|
||||||
uint64_t *result_ref)
|
uint64_t *result_ref)
|
||||||
{
|
{
|
||||||
|
/* use RD if set in VRF config */
|
||||||
|
struct prefix_rd *prd;
|
||||||
|
|
||||||
/* remove this check when the other peer types get correct peer dist.
|
/* remove this check when the other peer types get correct peer dist.
|
||||||
*(RFC7854) impl.
|
*(RFC7854) impl.
|
||||||
@ -294,11 +296,16 @@ static inline int bmp_get_peer_distinguisher(struct bmp *bmp, afi_t afi,
|
|||||||
if (bgp->inst_type == VRF_DEFAULT)
|
if (bgp->inst_type == VRF_DEFAULT)
|
||||||
return (*result_ref = 0);
|
return (*result_ref = 0);
|
||||||
|
|
||||||
/* use RD if set in VRF config for this AFI */
|
prd = &bgp->vpn_policy[AFI_IP].tovpn_rd;
|
||||||
struct prefix_rd *prd = &bgp->vpn_policy[afi].tovpn_rd;
|
if ((afi == AFI_IP || afi == AFI_UNSPEC) &&
|
||||||
|
CHECK_FLAG(bgp->vpn_policy[AFI_IP].flags, BGP_VPN_POLICY_TOVPN_RD_SET)) {
|
||||||
|
memcpy(result_ref, prd->val, sizeof(prd->val));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (CHECK_FLAG(bgp->vpn_policy[afi].flags,
|
prd = &bgp->vpn_policy[AFI_IP6].tovpn_rd;
|
||||||
BGP_VPN_POLICY_TOVPN_RD_SET)) {
|
if ((afi == AFI_IP6 || afi == AFI_UNSPEC) &&
|
||||||
|
CHECK_FLAG(bgp->vpn_policy[AFI_IP6].flags, BGP_VPN_POLICY_TOVPN_RD_SET)) {
|
||||||
memcpy(result_ref, prd->val, sizeof(prd->val));
|
memcpy(result_ref, prd->val, sizeof(prd->val));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user