Fix coverity warnings, VPP-486
[vpp.git] / vnet / vnet / ip / ip6_neighbor.c
index 57359f7..97e7e84 100644 (file)
@@ -427,6 +427,17 @@ vnet_set_ip6_ethernet_neighbor (vlib_main_t * vm,
     n->key = k;
     n->adj_index = ADJ_INDEX_INVALID;
   }
+  else
+  {
+    /*
+     * prevent a DoS attack from the data-plane that
+     * spams us with no-op updates to the MAC address
+     */
+    if (0 == memcmp(n->link_layer_address,
+                   link_layer_address,
+                   n_bytes_link_layer_address))
+      return -1;
+  }
 
   /* Update time stamp and ethernet address. */
   clib_memcpy (n->link_layer_address,
@@ -1694,7 +1705,7 @@ ip6_neighbor_sw_interface_add_del (vnet_main_t * vnm,
         a->seed = random_default_seed();
         
         /* for generating random interface ids */
-        a->randomizer = 0x1119194911191949;
+        a->randomizer = 0x1119194911191949ULL;
         a->randomizer = random_u64 ((u32 *)&a->randomizer);
         
         a->initial_adverts_count = MAX_INITIAL_RTR_ADVERTISEMENTS ;