map: handle IPv6 extension headers for TCP/UDP 45/25445/2
authorVladimir Isaev <visaev@netgate.com>
Wed, 26 Feb 2020 10:21:35 +0000 (13:21 +0300)
committerOle Trøan <otroan@employees.org>
Wed, 26 Feb 2020 11:54:22 +0000 (11:54 +0000)
Without this patch offset for TCP/UDP headers was not calculated
correctly if there is one or more IPv6 extension headers.

Type: fix
Signed-off-by: Vladimir Isaev <visaev@netgate.com>
Change-Id: I04d6f5e42f8f072987192d6236085afbd74a4420

src/plugins/map/ip6_map_t.c

index 01bf0f9..7d0cd42 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;
     }