MCPcopy Create free account
hub / github.com/F-Stack/f-stack / trs_process_check

Function trs_process_check

dpdk/lib/ipsec/esp_inb.c:457–473  ·  view source on GitHub ↗

* packet checks for transport mode: * - no reported IPsec related failures in ol_flags * - tail and header lengths are valid * - padding bytes are valid * apart from checks, function also updates tail offset (and segment) * by taking into account pad length. */

Source from the content-addressed store, hash-verified

455 * by taking into account pad length.
456 */
457static inline int32_t
458trs_process_check(struct rte_mbuf *mb, struct rte_mbuf **ml,
459 uint32_t *tofs, struct rte_esp_tail espt, uint32_t hlen, uint32_t tlen)
460{
461 if ((mb->ol_flags & RTE_MBUF_F_RX_SEC_OFFLOAD_FAILED) != 0 ||
462 tlen + hlen > mb->pkt_len)
463 return -EBADMSG;
464
465 /* padding bytes are spread over multiple segments */
466 if (tofs[0] < espt.pad_len) {
467 tofs[0] = mb->pkt_len - tlen;
468 ml[0] = mbuf_get_seg_ofs(mb, tofs);
469 } else
470 tofs[0] -= espt.pad_len;
471
472 return check_pad_bytes(ml[0], tofs[0], espt.pad_len);
473}
474
475/*
476 * packet checks for tunnel mode:

Callers 2

tun_process_checkFunction · 0.85
trs_processFunction · 0.85

Calls 2

mbuf_get_seg_ofsFunction · 0.85
check_pad_bytesFunction · 0.85

Tested by

no test coverage detected