mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-27 13:06:51 +00:00
Merge pull request #13329 from Pdoijode/pdoijode/bgp-attr-crash-fix
bgpd: Fix for ain->attr corruption during path update
This commit is contained in:
commit
e2bebeb666
@ -4065,17 +4065,24 @@ void bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
|
|||||||
if (has_valid_label)
|
if (has_valid_label)
|
||||||
assert(label != NULL);
|
assert(label != NULL);
|
||||||
|
|
||||||
/* Update overlay index of the attribute */
|
|
||||||
if (afi == AFI_L2VPN && evpn)
|
|
||||||
memcpy(&attr->evpn_overlay, evpn,
|
|
||||||
sizeof(struct bgp_route_evpn));
|
|
||||||
|
|
||||||
/* When peer's soft reconfiguration enabled. Record input packet in
|
/* When peer's soft reconfiguration enabled. Record input packet in
|
||||||
Adj-RIBs-In. */
|
Adj-RIBs-In. */
|
||||||
if (!soft_reconfig
|
if (!soft_reconfig &&
|
||||||
&& CHECK_FLAG(peer->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG)
|
CHECK_FLAG(peer->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG) &&
|
||||||
&& peer != bgp->peer_self)
|
peer != bgp->peer_self) {
|
||||||
|
/*
|
||||||
|
* If the trigger is not from soft_reconfig and if
|
||||||
|
* PEER_FLAG_SOFT_RECONFIG is enabled for the peer, then attr
|
||||||
|
* will not be interned. In which case, it is ok to update the
|
||||||
|
* attr->evpn_overlay, so that, this can be stored in adj_in.
|
||||||
|
*/
|
||||||
|
if ((afi == AFI_L2VPN) && evpn) {
|
||||||
|
memcpy(&attr->evpn_overlay, evpn,
|
||||||
|
sizeof(struct bgp_route_evpn));
|
||||||
|
}
|
||||||
bgp_adj_in_set(dest, peer, attr, addpath_id);
|
bgp_adj_in_set(dest, peer, attr, addpath_id);
|
||||||
|
}
|
||||||
|
|
||||||
/* Update permitted loop count */
|
/* Update permitted loop count */
|
||||||
if (CHECK_FLAG(peer->af_flags[afi][safi], PEER_FLAG_ALLOWAS_IN))
|
if (CHECK_FLAG(peer->af_flags[afi][safi], PEER_FLAG_ALLOWAS_IN))
|
||||||
@ -4203,6 +4210,15 @@ void bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
new_attr = *attr;
|
new_attr = *attr;
|
||||||
|
/*
|
||||||
|
* If bgp_update is called with soft_reconfig set then
|
||||||
|
* attr is interned. In this case, do not overwrite the
|
||||||
|
* attr->evpn_overlay with evpn directly. Instead memcpy
|
||||||
|
* evpn to new_atr.evpn_overlay before it is interned.
|
||||||
|
*/
|
||||||
|
if (soft_reconfig && (afi == AFI_L2VPN) && evpn)
|
||||||
|
memcpy(&new_attr.evpn_overlay, evpn,
|
||||||
|
sizeof(struct bgp_route_evpn));
|
||||||
|
|
||||||
/* Apply incoming route-map.
|
/* Apply incoming route-map.
|
||||||
* NB: new_attr may now contain newly allocated values from route-map
|
* NB: new_attr may now contain newly allocated values from route-map
|
||||||
|
Loading…
Reference in New Issue
Block a user