diff mbox series

[API-NEXT,v20,4/10] linux-gen: packet: add support for IP-in-IP (RFC 2003) encap

Message ID 1508335223-15608-5-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [API-NEXT,v20,1/10] test: validation: add IPsec API testsuite | expand

Commit Message

Github ODP bot Oct. 18, 2017, 2 p.m. UTC
From: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>


Don't barf on IP-in-IP packets parsing, just ignore L4 (=L3) header.

Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>

---
/** Email created from pull request 81 (lumag:ipsec-packet-impl-2)
 ** https://github.com/Linaro/odp/pull/81
 ** Patch: https://github.com/Linaro/odp/pull/81.patch
 ** Base sha: edca8cd1e55898826f79383b689c2c4bd2c28b3a
 ** Merge commit sha: 750318196a0c07a634c4755e4da9131a9f11f6f1
 **/
 platform/linux-generic/include/protocols/ip.h | 1 +
 platform/linux-generic/odp_packet.c           | 4 ++++
 2 files changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/platform/linux-generic/include/protocols/ip.h b/platform/linux-generic/include/protocols/ip.h
index 2b34a753f..0fc391abe 100644
--- a/platform/linux-generic/include/protocols/ip.h
+++ b/platform/linux-generic/include/protocols/ip.h
@@ -158,6 +158,7 @@  typedef struct ODP_PACKED {
  * @{*/
 #define _ODP_IPPROTO_HOPOPTS 0x00 /**< IPv6 hop-by-hop options */
 #define _ODP_IPPROTO_ICMPv4  0x01 /**< Internet Control Message Protocol (1) */
+#define _ODP_IPPROTO_IPIP    0x04 /**< IP Encapsulation within IP (4) */
 #define _ODP_IPPROTO_TCP     0x06 /**< Transmission Control Protocol (6) */
 #define _ODP_IPPROTO_UDP     0x11 /**< User Datagram Protocol (17) */
 #define _ODP_IPPROTO_ROUTE   0x2B /**< IPv6 Routing header (43) */
diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c
index d94718dd7..0f6e1b79d 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -2034,6 +2034,10 @@  int packet_parse_common_l3_l4(packet_parser_t *prs, const uint8_t *parseptr,
 		prs->input_flags.icmp = 1;
 		break;
 
+	case _ODP_IPPROTO_IPIP:
+		/* Do nothing */
+		break;
+
 	case _ODP_IPPROTO_TCP:
 		if (odp_unlikely(offset + _ODP_TCPHDR_LEN > seg_len))
 			return -1;