Merge pull request #13999 from opensourcerouting/fix/backport_cfc5c101602482f987a1e57a579e0686b81b91c9_to_8.5

bgpd: free bgp vpn policy
This commit is contained in:
Donald Sharp 2023-07-13 09:34:16 -04:00 committed by GitHub
commit e1ca52e80a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 2 deletions

View File

@ -608,7 +608,7 @@ static void sid_register(struct bgp *bgp, const struct in6_addr *sid,
listnode_add(bgp->srv6_functions, func);
}
static void sid_unregister(struct bgp *bgp, const struct in6_addr *sid)
void sid_unregister(struct bgp *bgp, const struct in6_addr *sid)
{
struct listnode *node, *nnode;
struct bgp_srv6_function *func;

View File

@ -336,5 +336,6 @@ extern void vpn_handle_router_id_update(struct bgp *bgp, bool withdraw,
bool is_config);
extern void bgp_vpn_leak_unimport(struct bgp *from_bgp);
extern void bgp_vpn_leak_export(struct bgp *from_bgp);
extern void sid_unregister(struct bgp *bgp, const struct in6_addr *sid);
#endif /* _QUAGGA_BGP_MPLSVPN_H */

View File

@ -3926,7 +3926,6 @@ void bgp_free(struct bgp *bgp)
bgp_evpn_cleanup(bgp);
bgp_pbr_cleanup(bgp);
bgp_srv6_cleanup(bgp);
XFREE(MTYPE_BGP_EVPN_INFO, bgp->evpn_info);
for (afi = AFI_IP; afi < AFI_MAX; afi++) {
@ -3943,8 +3942,22 @@ void bgp_free(struct bgp *bgp)
dir = BGP_VPN_POLICY_DIR_TOVPN;
if (bgp->vpn_policy[afi].rtlist[dir])
ecommunity_free(&bgp->vpn_policy[afi].rtlist[dir]);
if (bgp->vpn_policy[afi].tovpn_sid_locator != NULL)
srv6_locator_chunk_free(
&bgp->vpn_policy[afi].tovpn_sid_locator);
if (bgp->vpn_policy[afi].tovpn_zebra_vrf_sid_last_sent != NULL)
XFREE(MTYPE_BGP_SRV6_SID,
bgp->vpn_policy[afi]
.tovpn_zebra_vrf_sid_last_sent);
if (bgp->vpn_policy[afi].tovpn_sid != NULL) {
sid_unregister(bgp, bgp->vpn_policy[afi].tovpn_sid);
XFREE(MTYPE_BGP_SRV6_SID,
bgp->vpn_policy[afi].tovpn_sid);
}
}
bgp_srv6_cleanup(bgp);
XFREE(MTYPE_BGP, bgp->name);
XFREE(MTYPE_BGP, bgp->name_pretty);
XFREE(MTYPE_BGP, bgp->snmp_stats);