DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH dpdk] net: ipv6 link local compliance with rfc 4291
@ 2025-11-14 10:57 Robin Jarry
  2025-11-14 16:05 ` Stephen Hemminger
  2025-11-14 16:08 ` Stephen Hemminger
  0 siblings, 2 replies; 8+ messages in thread
From: Robin Jarry @ 2025-11-14 10:57 UTC (permalink / raw)
  To: dev, Stephen Hemminger; +Cc: Christophe Fontaine, stable

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-11-14 17:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-14 10:57 [PATCH dpdk] net: ipv6 link local compliance with rfc 4291 Robin Jarry
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

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).