aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/interface_funcs.h
diff options
context:
space:
mode:
authorEyal Bari <ebari@cisco.com>2017-03-06 11:47:50 +0200
committerJohn Lo <loj@cisco.com>2017-03-07 20:44:56 +0000
commit3212c57087069c5137abe4919ac1336e79fa93e9 (patch)
tree9d4ad4a3c43825aa0aafa8ef26baa7ee84eeaeb1 /src/vnet/interface_funcs.h
parent1b563527c143903b6e7e79b5978af5310372f605 (diff)
CLI: hide deleted interfaces
Added a new interface flag - HIDDEN Indicates that the interface does not appear in CLI/API. Added three new interface functions: vnet_sw_interface_is_api_visible - indicates if the sw_if_index should be displayed vnet_swif_is_api_visible - variant for sw_interface vnet_sw_interface_is_api_valid - tests if the given if_index exists and is visible for future use by api functions Changed the unformat function to only accept visible interfaces Changed vxlan to add the HIDDEN flag to deleted interfaces This is the first part in a series to hide deleted interfaces from the API Change-Id: Ib43cc5cf1c450856560faf4e84126eb3671038e2 Signed-off-by: Eyal Bari <ebari@cisco.com>
Diffstat (limited to 'src/vnet/interface_funcs.h')
-rw-r--r--src/vnet/interface_funcs.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/vnet/interface_funcs.h b/src/vnet/interface_funcs.h
index ab808dfa545..b3aca2fdd28 100644
--- a/src/vnet/interface_funcs.h
+++ b/src/vnet/interface_funcs.h
@@ -183,6 +183,26 @@ vnet_sw_interface_is_admin_up (vnet_main_t * vnm, u32 sw_if_index)
}
always_inline uword
+vnet_swif_is_api_visible (vnet_sw_interface_t * si)
+{
+ return !(si->flags & VNET_SW_INTERFACE_FLAG_HIDDEN);
+}
+
+always_inline uword
+vnet_sw_interface_is_api_visible (vnet_main_t * vnm, u32 sw_if_index)
+{
+ vnet_sw_interface_t *si = vnet_get_sw_interface (vnm, sw_if_index);
+ return vnet_swif_is_api_visible (si);
+}
+
+always_inline uword
+vnet_sw_interface_is_api_valid (vnet_main_t * vnm, u32 sw_if_index)
+{
+ return !pool_is_free_index (vnm->interface_main.sw_interfaces, sw_if_index)
+ && vnet_sw_interface_is_api_visible (vnm, sw_if_index);
+}
+
+always_inline uword
vnet_hw_interface_get_flags (vnet_main_t * vnm, u32 hw_if_index)
{
vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, hw_if_index);