Merge pull request #17716 from ykholod/master-17463

bgpd: Clean address-family config on daemon restart
This commit is contained in:
Donatas Abraitis 2025-01-01 21:16:39 +02:00 committed by GitHub
commit f3daeda935
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 31 additions and 0 deletions

View file

@ -15777,6 +15777,28 @@ static int bgp_distance_unset(struct vty *vty, const char *distance_str,
return CMD_SUCCESS; return CMD_SUCCESS;
} }
void bgp_address_family_distance_delete(void)
{
afi_t afi = AFI_UNSPEC;
safi_t safi = SAFI_UNSPEC;
struct bgp_dest *dest = NULL;
struct bgp_distance *bdistance = NULL;
FOREACH_AFI_SAFI (afi, safi) {
for (dest = bgp_table_top(bgp_distance_table[afi][safi]); dest;
dest = bgp_route_next(dest)) {
if (!bgp_dest_has_bgp_path_info_data(dest))
continue;
bdistance = bgp_dest_get_bgp_distance_info(dest);
XFREE(MTYPE_AS_LIST, bdistance->access_list);
bgp_distance_free(bdistance);
bgp_dest_set_bgp_distance_info(dest, NULL);
bgp_dest_unlock_node(dest);
}
}
}
/* Apply BGP information to distance method. */ /* Apply BGP information to distance method. */
uint8_t bgp_distance_apply(const struct prefix *p, struct bgp_path_info *pinfo, uint8_t bgp_distance_apply(const struct prefix *p, struct bgp_path_info *pinfo,
afi_t afi, safi_t safi, struct bgp *bgp) afi_t afi, safi_t safi, struct bgp *bgp)

View file

@ -831,6 +831,7 @@ extern void bgp_redistribute_withdraw(struct bgp *, afi_t, int, unsigned short);
extern void bgp_static_add(struct bgp *); extern void bgp_static_add(struct bgp *);
extern void bgp_static_delete(struct bgp *); extern void bgp_static_delete(struct bgp *);
extern void bgp_address_family_distance_delete(void);
extern void bgp_static_redo_import_check(struct bgp *); extern void bgp_static_redo_import_check(struct bgp *);
extern void bgp_purge_static_redist_routes(struct bgp *bgp); extern void bgp_purge_static_redist_routes(struct bgp *bgp);
extern void bgp_static_update(struct bgp *bgp, const struct prefix *p, extern void bgp_static_update(struct bgp *bgp, const struct prefix *p,

View file

@ -4240,6 +4240,14 @@ int bgp_delete(struct bgp *bgp)
} }
} }
/* Clean BGP address family parameters */
bgp_mh_info->ead_evi_rx = BGP_EVPN_MH_EAD_EVI_RX_DEF;
bgp_evpn_switch_ead_evi_rx();
bgp_mh_info->ead_evi_tx = BGP_EVPN_MH_EAD_EVI_TX_DEF;
bgp_mh_info->evi_per_es_frag = BGP_EVPN_MAX_EVI_PER_ES_FRAG;
bgp_address_family_distance_delete();
return 0; return 0;
} }