Distributed Virtual Router Support
[vpp.git] / src / vnet / ip / ip4.h
index 872b516..af0e6b9 100644 (file)
@@ -44,6 +44,7 @@
 #include <vnet/ip/lookup.h>
 #include <vnet/buffer.h>
 #include <vnet/feature/feature.h>
+#include <vnet/ip/icmp46_packet.h>
 
 typedef struct ip4_mfib_t
 {
@@ -72,6 +73,16 @@ typedef struct
   uword function_opaque;
 } ip4_add_del_interface_address_callback_t;
 
+typedef void (ip4_table_bind_function_t)
+  (struct ip4_main_t * im,
+   uword opaque, u32 sw_if_index, u32 new_fib_index, u32 old_fib_index);
+
+typedef struct
+{
+  ip4_table_bind_function_t *function;
+  uword function_opaque;
+} ip4_table_bind_callback_t;
+
 /**
  * @brief IPv4 main type.
  *
@@ -117,6 +128,9 @@ typedef struct ip4_main_t
     ip4_add_del_interface_address_callback_t
     * add_del_interface_address_callbacks;
 
+  /** Functions to call when interface to table biding changes. */
+  ip4_table_bind_callback_t *table_bind_callbacks;
+
   /** Template used to generate IP4 ARP packets. */
   vlib_packet_template_t ip4_arp_request_packet_template;
 
@@ -329,7 +343,8 @@ u32 ip4_tcp_udp_validate_checksum (vlib_main_t * vm, vlib_buffer_t * p0);
  */
 always_inline void *
 vlib_buffer_push_ip4 (vlib_main_t * vm, vlib_buffer_t * b,
-                     ip4_address_t * src, ip4_address_t * dst, int proto)
+                     ip4_address_t * src, ip4_address_t * dst, int proto,
+                     u8 csum_offload)
 {
   ip4_header_t *ih;
 
@@ -348,7 +363,7 @@ vlib_buffer_push_ip4 (vlib_main_t * vm, vlib_buffer_t * b,
   ih->dst_address.as_u32 = dst->as_u32;
 
   /* Offload ip4 header checksum generation */
-  if (1)
+  if (csum_offload)
     {
       ih->checksum = 0;
       b->flags |= VNET_BUFFER_F_OFFLOAD_IP_CKSUM | VNET_BUFFER_F_IS_IP4;