ip: Router ID included in flow hash
[vpp.git] / src / plugins / map / ip4_map.c
index f2a0090..1ab5cc2 100644 (file)
@@ -78,20 +78,6 @@ ip4_map_vtcfl (ip4_header_t * ip4, vlib_buffer_t * p)
   return (clib_host_to_net_u32 (vtcfl));
 }
 
-static_always_inline bool
-ip4_map_ip6_lookup_bypass (vlib_buffer_t * p0, ip4_header_t * ip)
-{
-#ifdef MAP_SKIP_IP6_LOOKUP
-  if (FIB_NODE_INDEX_INVALID != pre_resolved[FIB_PROTOCOL_IP6].fei)
-    {
-      vnet_buffer (p0)->ip.adj_index[VLIB_TX] =
-       pre_resolved[FIB_PROTOCOL_IP6].dpo.dpoi_index;
-      return (true);
-    }
-#endif
-  return (false);
-}
-
 /*
  * ip4_map_ttl
  */
@@ -111,7 +97,7 @@ ip4_map_decrement_ttl (ip4_header_t * ip, u8 * error)
   *error = ttl <= 0 ? IP4_ERROR_TIME_EXPIRED : *error;
 
   /* Verify checksum. */
-  ASSERT (ip->checksum == ip4_header_checksum (ip));
+  ASSERT (ip4_header_checksum_is_valid (ip));
 }
 
 static u32
@@ -209,6 +195,20 @@ ip4_map (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
           */
          port0 = ip4_map_port_and_security_check (d0, p0, &error0);
 
+         /*
+          * Clamp TCP MSS value.
+          */
+         if (ip40->protocol == IP_PROTOCOL_TCP)
+           {
+             tcp_header_t *tcp = ip4_next_header (ip40);
+             if (mm->tcp_mss > 0 && tcp_syn (tcp))
+               {
+                 ip_csum_t csum = tcp->checksum;
+                 map_mss_clamping (tcp, &csum, mm->tcp_mss);
+                 tcp->checksum = ip_csum_fold (csum);
+               }
+           }
+
          /* Decrement IPv4 TTL */
          ip4_map_decrement_ttl (ip40, &error0);
          bool df0 =
@@ -325,13 +325,6 @@ ip4_map (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
   return frame->n_vectors;
 }
 
-static char *map_error_strings[] = {
-#define _(sym,string) string,
-  foreach_map_error
-#undef _
-};
-
-
 /* *INDENT-OFF* */
 VNET_FEATURE_INIT (ip4_map_feature, static) =
 {
@@ -349,7 +342,7 @@ VLIB_REGISTER_NODE(ip4_map_node) = {
   .type = VLIB_NODE_TYPE_INTERNAL,
 
   .n_errors = MAP_N_ERROR,
-  .error_strings = map_error_strings,
+  .error_counters = map_error_counters,
 
   .n_next_nodes = IP4_MAP_N_NEXT,
   .next_nodes = {