summaryrefslogtreecommitdiff
path: root/lib/vrf.h
diff options
context:
space:
mode:
authorvivek <vivek@cumulusnetworks.com>2017-12-06 15:19:11 -0800
committermitesh <mitesh@cumulusnetworks.com>2018-01-23 18:49:40 -0800
commit22bd3e94979d0c42e9318d96bced01e807b1b7ce (patch)
treed70053b630e651cba0e8bbbac4a0c62630142d61 /lib/vrf.h
parent317f1fe02fa8a6fea0fe9530078edf54335f3228 (diff)
*: Refine the notion of a configured VRF in FRR
Refine the notion of what FRR considers as "configured" VRF. It is no longer based on user just typing "vrf FOO" but when something is actually configured against that VRF. Right now, in zebra, the only configuration against a VRF are static IP routes and EVPN L3 VNI. Whenever a configuration is removed, check and clear the "configured" flag if there is no other configuration for this VRF. When user attempts to configure a static route and the VRF doesn't exist, a VRF is created; the VRF is only active when also defined in the kernel. Updates: 8b73ea7bd479030418ca06eef59d0648d913b620 Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Don Slice <dslice@cumulusnetworks.com> Ticket: CM-10139, CM-18553 Reviewed By: CCR-7019 Testing Done: 1. Manual testing for L3 VNI and static routes - FRR restart, networking restart etc. 2. 'vrf' smoke <DETAILED DESCRIPTION (REPLACE)>
Diffstat (limited to 'lib/vrf.h')
-rw-r--r--lib/vrf.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/vrf.h b/lib/vrf.h
index 89d2316354..99c048c702 100644
--- a/lib/vrf.h
+++ b/lib/vrf.h
@@ -76,7 +76,7 @@ struct vrf {
/* Zebra internal VRF status */
u_char status;
#define VRF_ACTIVE (1 << 0) /* VRF is up in kernel */
-#define VRF_CONFIGURED (1 << 1) /* VRF is configured by user in frr */
+#define VRF_CONFIGURED (1 << 1) /* VRF has some FRR configuration */
/* Interfaces belonging to this VRF */
struct if_name_head ifaces_by_name;
@@ -134,6 +134,18 @@ static inline int vrf_is_user_cfged(struct vrf *vrf)
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
*/