Enforce Bridge Domain ID range to match 24-bit VNI range
[vpp.git] / src / vpp / api / api.c
index f1b6877..7e4c341 100644 (file)
@@ -53,7 +53,7 @@
 #include <vnet/ip/ip6.h>
 #include <vnet/ip/ip6_neighbor.h>
 #if WITH_LIBSSL > 0
-#include <vnet/sr/sr.h>
+#include <vnet/srv6/sr.h>
 #endif
 #include <vlib/vlib.h>
 #include <vlib/unix/unix.h>
@@ -419,6 +419,7 @@ static void
 
   if (mp->enable)
     {
+      VALIDATE_BD_ID (mp);
       u32 bd_id = ntohl (mp->bd_id);
       u32 bd_index = bd_find_or_add_bd_index (bdm, bd_id);
       u32 bvi = mp->bvi;
@@ -432,6 +433,7 @@ static void
     }
 
   BAD_RX_SW_IF_INDEX_LABEL;
+  BAD_BD_ID_LABEL;
 
   REPLY_MACRO (VL_API_SW_INTERFACE_SET_L2_BRIDGE_REPLY);
 }
@@ -446,6 +448,12 @@ vl_api_bd_ip_mac_add_del_t_handler (vl_api_bd_ip_mac_add_del_t * mp)
   u32 bd_index;
   uword *p;
 
+  if (bd_id == 0)
+    {
+      rv = VNET_API_ERROR_BD_NOT_MODIFIABLE;
+      goto out;
+    }
+
   p = hash_get (bdm->bd_index_by_bd_id, bd_id);
   if (p == 0)
     {
@@ -971,6 +979,9 @@ ip6_reset_fib_t_handler (vl_api_reset_fib_t * mp)
 
     vec_reset_length (sw_if_indices_to_shut);
 
+    /* Set the flow hash for this fib to the default */
+    vnet_set_ip6_flow_hash (fib->table_id, IP_FLOW_HASH_DEFAULT);
+
     /* Shut down interfaces in this FIB / clean out intfc routes */
     pool_foreach (si, im->sw_interfaces,
     ({