Punt: socket register for exception dispatched/punted packets based on reason
[vpp.git] / src / vnet / ip / ip.h
index 747b438..7a82dcf 100644 (file)
 #include <vnet/ip/icmp6.h>
 #include <vnet/classify/vnet_classify.h>
 
+typedef enum ip_address_family_t_
+{
+  AF_IP4,
+  AF_IP6,
+} ip_address_family_t;
+
+extern uword unformat_ip_address_family (unformat_input_t * input,
+                                        va_list * args);
+extern u8 *format_ip_address_family (u8 * s, va_list * args);
+
+#define FOR_EACH_IP_ADDRESS_FAMILY(_af) \
+  for (_af = AF_IP4; _af <= AF_IP6; _af++)
+
+#define u8_ptr_add(ptr, index) (((u8 *)ptr) + index)
+#define u16_net_add(u, val) clib_host_to_net_u16(clib_net_to_host_u16(u) + (val))
+
 /* Per protocol info. */
 typedef struct
 {
@@ -159,7 +175,7 @@ ip_incremental_checksum_buffer (vlib_main_t * vm,
   void *h;
   u32 n;
 
-  n = clib_min (n_bytes_left, b->current_length);
+  n = clib_min (n_bytes_left, b->current_length - first_buffer_offset);
   h = vlib_buffer_get_current (b) + first_buffer_offset;
   sum = ip_incremental_checksum (sum, h, n);
   if (PREDICT_FALSE (b->flags & VLIB_BUFFER_NEXT_PRESENT))