DPDK patches and discussions
 help / color / mirror / Atom feed
From: bugzilla@dpdk.org
To: dev@dpdk.org
Subject: [DPDK/core Bug 1590] rte_ipv6_phdr_cksum users wrong proto
Date: Sun, 01 Dec 2024 19:02:55 +0000	[thread overview]
Message-ID: <bug-1590-3@http.bugs.dpdk.org/> (raw)

[-- Attachment #1: Type: text/plain, Size: 1803 bytes --]

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: maaaah@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.

[-- Attachment #2: Type: text/html, Size: 3750 bytes --]

                 reply	other threads:[~2024-12-01 19:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-1590-3@http.bugs.dpdk.org/ \
    --to=bugzilla@dpdk.org \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).