summaryrefslogtreecommitdiffstats
path: root/bgpd/bgpd.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--bgpd/bgpd.c45
1 files changed, 28 insertions, 17 deletions
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index 1a03a06..d6d874b 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -1446,11 +1446,11 @@ int bgp_peer_gr_init(struct peer *peer)
{
/* PEER_GLOBAL_INHERIT Mode */
/* Event-> */ /* PEER_GR_CMD */ /* NO_PEER_GR_CMD */
- { PEER_GR, bgp_peer_gr_action }, { PEER_INVALID, NULL },
+ { PEER_GR, bgp_peer_gr_action }, { PEER_GLOBAL_INHERIT, NULL },
/* Event-> */ /* PEER_DISABLE_CMD */ /* NO_PEER_DISABLE_CMD */
- { PEER_DISABLE, bgp_peer_gr_action}, { PEER_INVALID, NULL },
+ { PEER_DISABLE, bgp_peer_gr_action }, { PEER_GLOBAL_INHERIT, NULL },
/* Event-> */ /* PEER_HELPER_cmd */ /* NO_PEER_HELPER_CMD */
- { PEER_HELPER, bgp_peer_gr_action }, { PEER_INVALID, NULL }
+ { PEER_HELPER, bgp_peer_gr_action }, { PEER_GLOBAL_INHERIT, NULL }
}
};
memcpy(&peer->PEER_GR_FSM, local_Peer_GR_FSM,
@@ -1473,6 +1473,29 @@ static void bgp_srv6_init(struct bgp *bgp)
static void bgp_srv6_cleanup(struct bgp *bgp)
{
+ for (afi_t afi = AFI_IP; afi < AFI_MAX; afi++) {
+ 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);
+ }
+ }
+
+ if (bgp->tovpn_sid_locator != NULL)
+ srv6_locator_chunk_free(&bgp->tovpn_sid_locator);
+ if (bgp->tovpn_zebra_vrf_sid_last_sent != NULL)
+ XFREE(MTYPE_BGP_SRV6_SID, bgp->tovpn_zebra_vrf_sid_last_sent);
+ if (bgp->tovpn_sid != NULL) {
+ sid_unregister(bgp, bgp->tovpn_sid);
+ XFREE(MTYPE_BGP_SRV6_SID, bgp->tovpn_sid);
+ }
+
if (bgp->srv6_locator_chunks)
list_delete(&bgp->srv6_locator_chunks);
if (bgp->srv6_functions)
@@ -1537,10 +1560,10 @@ struct peer *peer_new(struct bgp *bgp)
SET_FLAG(peer->sflags, PEER_STATUS_CAPABILITY_OPEN);
if (CHECK_FLAG(bgp->flags, BGP_FLAG_ENFORCE_FIRST_AS))
- SET_FLAG(peer->flags, PEER_FLAG_ENFORCE_FIRST_AS);
+ peer_flag_set(peer, PEER_FLAG_ENFORCE_FIRST_AS);
if (CHECK_FLAG(bgp->flags, BGP_FLAG_SOFT_VERSION_CAPABILITY))
- SET_FLAG(peer->flags, PEER_FLAG_CAPABILITY_SOFT_VERSION);
+ peer_flag_set(peer, PEER_FLAG_CAPABILITY_SOFT_VERSION);
SET_FLAG(peer->flags_invert, PEER_FLAG_CAPABILITY_FQDN);
SET_FLAG(peer->flags, PEER_FLAG_CAPABILITY_FQDN);
@@ -4097,18 +4120,6 @@ void bgp_free(struct bgp *bgp)
if (bgp->vpn_policy[afi].tovpn_rd_pretty)
XFREE(MTYPE_BGP_NAME,
bgp->vpn_policy[afi].tovpn_rd_pretty);
- 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);
bgp_confederation_id_unset(bgp);