public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH] Fix neighbor discovery ethernet address saving
@ 2024-04-29 18:51 seanedmond
  2024-05-05  9:40 ` Vyacheslav V. Mitrofanov
  2025-01-01 20:41 ` Tom Rini
  0 siblings, 2 replies; 5+ messages in thread
From: seanedmond @ 2024-04-29 18:51 UTC (permalink / raw)
  To: u-boot
  Cc: joe.hershberger, rfried.dev, trini, v.v.mitrofanov, saproj,
	Sean Edmond

From: Sean Edmond <seanedmond@microsoft.com>

When a successful neighbor advertisement is received, the ethernet
address should be saved for later use to avoid having to redo the
neighbor discovery process.

For example, with TFTP the address should get saved into
"net_server_ethaddr".  This is being done correctly with ARP for IPv4,
but not for neighbor discovery with IPv6.

Signed-off-by: Sean Edmond <seanedmond@microsoft.com>
---
 net/ndisc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ndisc.c b/net/ndisc.c
index d1cec0601c8..505515f2d95 100644
--- a/net/ndisc.c
+++ b/net/ndisc.c
@@ -461,8 +461,8 @@ int ndisc_receive(struct ethernet_hdr *et, struct ip6_hdr *ip6, int len)
 			ndisc_extract_enetaddr(ndisc, neigh_eth_addr);
 
 			/* save address for later use */
-			if (!net_nd_packet_mac)
-				net_nd_packet_mac = neigh_eth_addr;
+			if (net_nd_packet_mac)
+				memcpy(net_nd_packet_mac, neigh_eth_addr, 6);
 
 			/* modify header, and transmit it */
 			memcpy(((struct ethernet_hdr *)net_nd_tx_packet)->et_dest,
-- 
2.42.0


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

end of thread, other threads:[~2025-01-01 20:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-29 18:51 [PATCH] Fix neighbor discovery ethernet address saving seanedmond
2024-05-05  9:40 ` Vyacheslav V. Mitrofanov
2024-05-08  5:16   ` Sean Edmond
2024-05-13  6:55     ` Vyacheslav V. Mitrofanov
2025-01-01 20:41 ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox