mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-12 14:27:36 +00:00
BGP: Fix interface list upon instance creation/deletion
The BGP instance cleanup was deleting interfaces in that instance after prior fixes, but this ended up deleting the interface list header which was not being re-created. Added code to re-create this at the time an instance is created. Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com> Ticket: CM-9466 Reviewed By: CCR-4164 Testing Done: Manual and verified failed test
This commit is contained in:
parent
02ba10e595
commit
b33adb7c40
23
bgpd/bgpd.c
23
bgpd/bgpd.c
@ -80,6 +80,9 @@ struct bgp_master *bm;
|
||||
/* BGP community-list. */
|
||||
struct community_list_handler *bgp_clist;
|
||||
|
||||
static void bgp_if_init (struct bgp *bgp);
|
||||
static void bgp_if_finish (struct bgp *bgp);
|
||||
|
||||
extern struct zclient *zclient;
|
||||
|
||||
void
|
||||
@ -2915,7 +2918,10 @@ bgp_get (struct bgp **bgp_val, as_t *as, const char *name,
|
||||
|
||||
vrf = bgp_vrf_lookup_by_instance_type (bgp);
|
||||
if (vrf)
|
||||
bgp_vrf_link (bgp, vrf);
|
||||
{
|
||||
bgp_vrf_link (bgp, vrf);
|
||||
bgp_if_init (bgp);
|
||||
}
|
||||
}
|
||||
|
||||
/* Register with Zebra, if needed */
|
||||
@ -7160,11 +7166,24 @@ bgp_master_init (void)
|
||||
bgp_process_queue_init();
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize interface list for instance, if needed. Invoked upon
|
||||
* instance create.
|
||||
*/
|
||||
static void
|
||||
bgp_if_init (struct bgp *bgp)
|
||||
{
|
||||
if (bgp->inst_type == BGP_INSTANCE_TYPE_VIEW)
|
||||
return;
|
||||
|
||||
vrf_iflist_create (bgp->vrf_id);
|
||||
}
|
||||
|
||||
/*
|
||||
* Free up connected routes and interfaces for a BGP instance. Invoked upon
|
||||
* instance delete (non-default only) or BGP exit.
|
||||
*/
|
||||
void
|
||||
static void
|
||||
bgp_if_finish (struct bgp *bgp)
|
||||
{
|
||||
struct listnode *ifnode, *ifnnode;
|
||||
|
@ -1174,7 +1174,6 @@ extern char *peer_uptime (time_t, char *, size_t, u_char, json_object *);
|
||||
extern int bgp_config_write (struct vty *);
|
||||
extern void bgp_config_write_family_header (struct vty *, afi_t, safi_t, int *);
|
||||
|
||||
extern void bgp_if_finish (struct bgp *);
|
||||
extern void bgp_master_init (void);
|
||||
|
||||
extern void bgp_init (void);
|
||||
|
@ -495,6 +495,15 @@ vrf_iflist_get (vrf_id_t vrf_id)
|
||||
return vrf->iflist;
|
||||
}
|
||||
|
||||
/* Create the interface list for the specified VRF, if needed. */
|
||||
void
|
||||
vrf_iflist_create (vrf_id_t vrf_id)
|
||||
{
|
||||
struct vrf * vrf = vrf_lookup (vrf_id);
|
||||
if (vrf && !vrf->iflist)
|
||||
if_init (vrf_id, &vrf->iflist);
|
||||
}
|
||||
|
||||
/* Free the interface list of the specified VRF. */
|
||||
void
|
||||
vrf_iflist_terminate (vrf_id_t vrf_id)
|
||||
|
@ -180,6 +180,8 @@ extern void *vrf_info_lookup (vrf_id_t);
|
||||
extern struct list *vrf_iflist (vrf_id_t);
|
||||
/* Get the interface list of the specified VRF. Create one if not find. */
|
||||
extern struct list *vrf_iflist_get (vrf_id_t);
|
||||
/* Create the interface list for the specified VRF, if needed. */
|
||||
extern void vrf_iflist_create (vrf_id_t vrf_id);
|
||||
/* Free the interface list of the specified VRF. */
|
||||
extern void vrf_iflist_terminate (vrf_id_t vrf_id);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user