VPP-100: Fix IP4 local handling of TCP/IP fragmented packet 00/1400/1
authorJohn Lo <loj@cisco.com>
Sat, 4 Jun 2016 00:48:31 +0000 (20:48 -0400)
committerJohn Lo <loj@cisco.com>
Sat, 4 Jun 2016 00:48:31 +0000 (20:48 -0400)
Fix previous change that does not work on little endian machines.
Use inline call ip4_is_fragment() which is endian neutral.

Change-Id: I5a35d89d936650ab6c628dfc388b8c992a74a589
Signed-off-by: John Lo <loj@cisco.com>
vnet/vnet/ip/ip4_forward.c

index 353cb76..cb29d30 100644 (file)
@@ -1775,8 +1775,8 @@ ip4_local (vlib_main_t * vm,
 
          /* Treat IP frag packets as "experimental" protocol for now
             until support of IP frag reassembly is implemented */
-         proto0 = (ip0->flags_and_fragment_offset << 2) ? 0xfe : ip0->protocol;
-         proto1 = (ip1->flags_and_fragment_offset << 2) ? 0xfe : ip1->protocol;
+         proto0 = ip4_is_fragment(ip0) ? 0xfe : ip0->protocol;
+         proto1 = ip4_is_fragment(ip1) ? 0xfe : ip1->protocol;
          is_udp0 = proto0 == IP_PROTOCOL_UDP;
          is_udp1 = proto1 == IP_PROTOCOL_UDP;
          is_tcp_udp0 = is_udp0 || proto0 == IP_PROTOCOL_TCP;
@@ -1970,7 +1970,7 @@ ip4_local (vlib_main_t * vm,
 
          /* Treat IP frag packets as "experimental" protocol for now
             until support of IP frag reassembly is implemented */
-         proto0 = (ip0->flags_and_fragment_offset << 2) ? 0xfe : ip0->protocol;
+         proto0 = ip4_is_fragment(ip0) ? 0xfe : ip0->protocol;
          is_udp0 = proto0 == IP_PROTOCOL_UDP;
          is_tcp_udp0 = is_udp0 || proto0 == IP_PROTOCOL_TCP;