nat: ICMP handling fixes
[vpp.git] / src / plugins / nat / nat44-ed / nat44_ed_out2in.c
index e8cf7c9..995260a 100644 (file)
@@ -614,8 +614,8 @@ create_bypass_for_fwd (snat_main_t *sm, vlib_buffer_t *b, snat_session_t *s,
 
   if (ip->protocol == IP_PROTOCOL_ICMP)
     {
-      if (nat_get_icmp_session_lookup_values (b, ip, &lookup_saddr,
-                                             &lookup_sport, &lookup_daddr,
+      if (nat_get_icmp_session_lookup_values (b, ip, &lookup_daddr,
+                                             &lookup_sport, &lookup_saddr,
                                              &lookup_dport, &lookup_protocol))
        return;
     }
@@ -933,6 +933,8 @@ nat44_ed_out2in_fast_path_node_fn_inline (vlib_main_t * vm,
                           ed_value_get_session_index (&value0));
     skip_lookup:
 
+      ASSERT (thread_index == s0->thread_index);
+
       if (PREDICT_FALSE (per_vrf_sessions_is_expired (s0, thread_index)))
        {
          // session is closed, go slow path
@@ -1024,7 +1026,7 @@ nat44_ed_out2in_fast_path_node_fn_inline (vlib_main_t * vm,
        }
 
       if (NAT_ED_TRNSL_ERR_SUCCESS !=
-         (translation_error = nat_6t_flow_buf_translate (
+         (translation_error = nat_6t_flow_buf_translate_o2i (
             sm, b0, ip0, f, proto0, 0 /* is_output_feature */)))
        {
          next[0] = NAT_NEXT_DROP;
@@ -1178,9 +1180,9 @@ nat44_ed_out2in_slow_path_node_fn_inline (vlib_main_t * vm,
              if (!s0)
                next[0] = NAT_NEXT_DROP;
            }
-         if (NAT_NEXT_DROP != next[0] &&
+         if (NAT_NEXT_DROP != next[0] && s0 &&
              NAT_ED_TRNSL_ERR_SUCCESS !=
-               (translation_error = nat_6t_flow_buf_translate (
+               (translation_error = nat_6t_flow_buf_translate_o2i (
                   sm, b0, ip0, &s0->o2i, proto0, 0 /* is_output_feature */)))
            {
              goto trace0;
@@ -1199,7 +1201,7 @@ nat44_ed_out2in_slow_path_node_fn_inline (vlib_main_t * vm,
 
          if (NAT_NEXT_DROP != next[0] && s0 &&
              NAT_ED_TRNSL_ERR_SUCCESS !=
-               (translation_error = nat_6t_flow_buf_translate (
+               (translation_error = nat_6t_flow_buf_translate_o2i (
                   sm, b0, ip0, &s0->o2i, proto0, 0 /* is_output_feature */)))
            {
              goto trace0;
@@ -1309,7 +1311,7 @@ nat44_ed_out2in_slow_path_node_fn_inline (vlib_main_t * vm,
        }
 
       if (NAT_ED_TRNSL_ERR_SUCCESS !=
-         (translation_error = nat_6t_flow_buf_translate (
+         (translation_error = nat_6t_flow_buf_translate_o2i (
             sm, b0, ip0, &s0->o2i, proto0, 0 /* is_output_feature */)))
        {
          next[0] = NAT_NEXT_DROP;