@@ -151,6 +151,7 @@ typedef union {
uint64_t l3_chksum_done:1; /**< L3 checksum validation done */
uint64_t l4_chksum_done:1; /**< L4 checksum validation done */
+ uint64_t ipsec_udp:1; /**< UDP-encapsulated IPsec packet */
};
} _odp_packet_input_flags_t;
@@ -472,7 +472,7 @@ static int ipsec_in_esp_post(odp_packet_t pkt,
ipsec_padding, esptrl.pad_len) != 0)
return -1;
- if (udp_encap) {
+ if (_ODP_IPPROTO_UDP == state->ip_next_hdr) {
state->ip_hdr_len -= _ODP_UDPHDR_LEN;
state->in.hdr_len += _ODP_UDPHDR_LEN;
}
@@ -2141,6 +2141,17 @@ static inline void parse_udp(packet_parser_t *prs,
if (odp_unlikely(udplen < sizeof(_odp_udphdr_t)))
prs->error_flags.udp_err = 1;
+ if (odp_cpu_to_be_16(_ODP_UDP_IPSEC_PORT) == udp->dst_port &&
+ udplen > 4) {
+ uint32_t val;
+
+ memcpy(&val, udp + 1, 4);
+ if (val != 0) {
+ prs->input_flags.ipsec = 1;
+ prs->input_flags.ipsec_udp = 1;
+ }
+ }
+
if (offset)
*offset += sizeof(_odp_udphdr_t);
*parseptr += sizeof(_odp_udphdr_t);