https://bugs.dpdk.org/show_bug.cgi?id=1590

            Bug ID: 1590
           Summary: rte_ipv6_phdr_cksum users wrong proto
           Product: DPDK
           Version: 20.11
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: Normal
         Component: core
          Assignee: dev@dpdk.org
          Reporter: maa...@mail.ru
  Target Milestone: ---

It seems rte_ipv6_phdr_cksum implementation uses wrong proto field for
pseudo-header during calculating checksum:

static inline uint16_t
rte_ipv6_phdr_cksum(const struct rte_ipv6_hdr *ipv6_hdr, uint64_t ol_flags)
{
        uint32_t sum;
        struct {
                rte_be32_t len;   /* L4 length. */
                rte_be32_t proto; /* L4 protocol - top 3 bytes must be zero */
        } psd_hdr;

        psd_hdr.proto = (uint32_t)(ipv6_hdr->proto << 24);
        if (ol_flags & PKT_TX_TCP_SEG) {
                psd_hdr.len = 0;
        } else {
                psd_hdr.len = ipv6_hdr->payload_len;
        }

        sum = __rte_raw_cksum(ipv6_hdr->src_addr,
                sizeof(ipv6_hdr->src_addr) + sizeof(ipv6_hdr->dst_addr),
                0);
        sum = __rte_raw_cksum(&psd_hdr, sizeof(psd_hdr), sum);
        return __rte_raw_cksum_reduce(sum);
}

proto is taken directly from the header while RFC 8200 clearly states:

The Next Header value in the pseudo-header identifies the upper-layer protocol
(e.g., 6 for TCP or 17 for UDP).  It will differ from the Next Header value in
the IPv6 header if there are extension headers between the IPv6 header and the
upper-layer header.

see https://www.rfc-editor.org/rfc/rfc8200

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to