map: fix map port calculation for ICMP
[vpp.git] / src / plugins / map / ip6_map_t.c
index 01bf0f9..ce973ea 100644 (file)
@@ -345,7 +345,7 @@ map_ip6_to_ip4_tcp_udp (vlib_main_t * vm, vlib_buffer_t * p,
 
   if (l4_protocol == IP_PROTOCOL_TCP)
     {
-      tcp_header_t *tcp = ip6_next_header (ip6);
+      tcp_header_t *tcp = (tcp_header_t *) u8_ptr_add (ip6, l4_offset);
       if (mm->tcp_mss > 0)
        {
          csum = tcp->checksum;
@@ -356,7 +356,7 @@ map_ip6_to_ip4_tcp_udp (vlib_main_t * vm, vlib_buffer_t * p,
     }
   else
     {
-      udp_header_t *udp = ip6_next_header (ip6);
+      udp_header_t *udp = (udp_header_t *) u8_ptr_add (ip6, l4_offset);
       checksum = &udp->checksum;
     }
 
@@ -603,12 +603,12 @@ ip6_map_t (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
              next0 = IP6_MAPT_NEXT_MAPT_ICMP;
              if (((icmp46_header_t *)
                   u8_ptr_add (ip60,
-                              vnet_buffer (p0)->map_t.v6.l4_offset))->code ==
+                              vnet_buffer (p0)->map_t.v6.l4_offset))->type ==
                  ICMP6_echo_reply
                  || ((icmp46_header_t *)
                      u8_ptr_add (ip60,
                                  vnet_buffer (p0)->map_t.v6.l4_offset))->
-                 code == ICMP6_echo_request)
+                 type == ICMP6_echo_request)
                map_port0 = l4_src_port;
            }
          else