/* 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
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 */
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;
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);
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)
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);