DPDK patches and discussions
 help / color / mirror / Atom feed
From: Robin Jarry <rjarry@redhat.com>
To: dev@dpdk.org, Stephen Hemminger <stephen@networkplumber.org>
Cc: Christophe Fontaine <cfontain@redhat.com>, stable@dpdk.org
Subject: [PATCH dpdk] net: ipv6 link local compliance with rfc 4291
Date: Fri, 14 Nov 2025 11:57:53 +0100	[thread overview]
Message-ID: <20251114105751.54802-3-rjarry@redhat.com> (raw)

From: Christophe Fontaine <cfontain@redhat.com>

As specified in RFC 4291 section 2.5.1, link local addresses must be
generated based on a modified EUI-64 interface identifier:

> Modified EUI-64 format interface identifiers are formed by inverting
> the "u" bit (universal/local bit in IEEE EUI-64 terminology) when
> forming the interface identifier from IEEE EUI-64 identifiers.

This translates to 'mac->addr_bytes[0] ^= 0x02'.

Fixes: 3d6d85f58c1c ("net: add utilities for well known IPv6 address types")
Cc: stable@dpdk.org

Signed-off-by: Christophe Fontaine <cfontain@redhat.com>
---
 app/test/test_net_ip6.c | 2 +-
 lib/net/rte_ip6.h       | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/app/test/test_net_ip6.c b/app/test/test_net_ip6.c
index cfc550940306..e4642c9a39d9 100644
--- a/app/test/test_net_ip6.c
+++ b/app/test/test_net_ip6.c
@@ -160,7 +160,7 @@ test_ipv6_llocal_from_ethernet(void)
 {
 	const struct rte_ether_addr local_mac = {{0x04, 0x7b, 0xcb, 0x5c, 0x08, 0x44}};
 	const struct rte_ipv6_addr local_ip =
-		RTE_IPV6(0xfe80, 0, 0, 0, 0x047b, 0xcbff, 0xfe5c, 0x0844);
+		RTE_IPV6(0xfe80, 0, 0, 0, 0x067b, 0xcbff, 0xfe5c, 0x0844);
 	struct rte_ipv6_addr ip;
 
 	rte_ipv6_llocal_from_ethernet(&ip, &local_mac);
diff --git a/lib/net/rte_ip6.h b/lib/net/rte_ip6.h
index 98bcac3f4dff..93e858b803a9 100644
--- a/lib/net/rte_ip6.h
+++ b/lib/net/rte_ip6.h
@@ -393,7 +393,7 @@ rte_ipv6_mc_scope(const struct rte_ipv6_addr *ip)
 
 /*
  * Generate a link-local IPv6 address from an Ethernet address as specified in
- * RFC 2464, section 5.
+ * RFC 4291, section 2.5.1.
  *
  * @param[out] ip
  *   The link-local IPv6 address to generate.
@@ -406,7 +406,7 @@ rte_ipv6_llocal_from_ethernet(struct rte_ipv6_addr *ip, const struct rte_ether_a
 	ip->a[0] = 0xfe;
 	ip->a[1] = 0x80;
 	memset(&ip->a[2], 0, 6);
-	ip->a[8] = mac->addr_bytes[0];
+	ip->a[8] = mac->addr_bytes[0] ^ 0x02;
 	ip->a[9] = mac->addr_bytes[1];
 	ip->a[10] = mac->addr_bytes[2];
 	ip->a[11] = 0xff;
-- 
2.51.1


             reply	other threads:[~2025-11-14 10:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-14 10:57 Robin Jarry [this message]
2025-11-14 16:05 ` Stephen Hemminger
2025-11-14 16:08   ` Robin Jarry
2025-11-14 16:14   ` Morten Brørup
2025-11-14 16:46     ` Robin Jarry
2025-11-14 17:03       ` Stephen Hemminger
2025-11-14 16:48     ` Stephen Hemminger
2025-11-14 16:08 ` Stephen Hemminger

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=20251114105751.54802-3-rjarry@redhat.com \
    --to=rjarry@redhat.com \
    --cc=cfontain@redhat.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    --cc=stephen@networkplumber.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).