vrfp = vrf_get(VRF_UNKNOWN, vrfname);
- vrf_set_user_cfged(vrfp);
+ SET_FLAG(vrfp->status, VRF_CONFIGURED);
nb_running_set_entry(args->dnode, vrfp);
return NB_OK;
vrfp = nb_running_unset_entry(args->dnode);
/* Clear configured flag and invoke delete. */
- vrf_reset_user_cfged(vrfp);
+ UNSET_FLAG(vrfp->status, VRF_CONFIGURED);
vrf_delete(vrfp);
break;
}
return vrf && CHECK_FLAG(vrf->status, VRF_CONFIGURED);
}
-/* Mark that VRF has user configuration */
-static inline void vrf_set_user_cfged(struct vrf *vrf)
-{
- SET_FLAG(vrf->status, VRF_CONFIGURED);
-}
-
-/* Mark that VRF no longer has any user configuration */
-static inline void vrf_reset_user_cfged(struct vrf *vrf)
-{
- UNSET_FLAG(vrf->status, VRF_CONFIGURED);
-}
-
/*
* Utilities to obtain the user data
*/
rn->info = si;
- /* Mark as having FRR configuration */
- vrf_set_user_cfged(svrf->vrf);
-
return rn;
}
XFREE(MTYPE_STATIC_ROUTE, rn->info);
route_unlock_node(rn);
- /* If no other FRR config for this VRF, mark accordingly. */
- if (!static_vrf_has_config(svrf))
- vrf_reset_user_cfged(svrf->vrf);
}
void static_del_route(struct route_node *rn, safi_t safi,
}
XFREE(MTYPE_STATIC_ROUTE, rn->info);
route_unlock_node(rn);
- /* If no other FRR config for this VRF, mark accordingly. */
- if (!static_vrf_has_config(svrf))
- vrf_reset_user_cfged(svrf->vrf);
}
bool static_add_nexthop_validate(const char *nh_vrf_name, static_types type,
return 0;
}
-int static_vrf_has_config(struct static_vrf *svrf)
-{
- struct route_table *table;
- safi_t safi;
- afi_t afi;
-
- /*
- * NOTE: This is a don't care for the default VRF, but we go through
- * the motions to keep things consistent.
- */
- for (afi = AFI_IP; afi < AFI_MAX; afi++) {
- for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) {
- table = svrf->stable[afi][safi];
- if (!table)
- continue;
- if (route_table_count(table))
- return 1;
- }
- }
-
- return 0;
-}
-
void static_vrf_init(void)
{
vrf_init(static_vrf_new, static_vrf_enable,
struct static_vrf *static_vrf_lookup_by_name(const char *vrf_name);
struct static_vrf *static_vrf_lookup_by_id(vrf_id_t vrf_id);
-int static_vrf_has_config(struct static_vrf *svrf);
-
void static_vrf_init(void);
struct route_table *static_vrf_static_table(afi_t afi, safi_t safi,
return NB_ERR;
}
- /* Mark as having FRR configuration */
- vrf_set_user_cfged(vrf);
-
break;
}
return NB_ERR;
}
- /* If no other FRR config for this VRF, mark accordingly. */
- if (!zebra_vrf_has_config(zvrf))
- vrf_reset_user_cfged(vrf);
-
break;
}
return 0;
}
-
-/* Return if this VRF has any FRR configuration or not.
- * IMPORTANT: This function needs to be updated when additional configuration
- * is added for a VRF.
- */
-int zebra_vrf_has_config(struct zebra_vrf *zvrf)
-{
- /* EVPN L3-VNI? */
- if (zvrf->l3vni)
- return 1;
-
- return 0;
-}
-
/* Lookup the routing table in a VRF based on both VRF-Id and table-id.
* NOTE: Table-id is relevant on two modes:
* - case VRF backend is default : on default VRF only
extern struct zebra_vrf *zebra_vrf_alloc(void);
extern struct route_table *zebra_vrf_table(afi_t, safi_t, vrf_id_t);
-extern int zebra_vrf_has_config(struct zebra_vrf *zvrf);
extern void zebra_vrf_init(void);
extern void zebra_rtable_node_cleanup(struct route_table *table,