[PATCH v3 6/6] net: update net_ip6 from link_local address when eth device is changed

Dmitrii Merkurev dimorinny at google.com
Tue Jul 25 23:56:57 CEST 2023

Current active eth device may be changed (due to ethprime), so make
sure current net_ip6 is updated as a reaction.

Signed-off-by: Dmitrii Merkurev <dimorinny at google.com>
Cc: Ying-Chun Liu (PaulLiu) <paul.liu at linaro.org>
Cc: Simon Glass <sjg at chromium.org>
Сс: Joe Hershberger <joe.hershberger at ni.com>
Сс: Ramon Fried <rfried.dev at gmail.com>
Reviewed-by: Ying-Chun Liu (PaulLiu) <paul.liu at linaro.org>
Reviewed-by: Simon Glass <sjg at chromium.org>
 net/net.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/net.c b/net/net.c
index 468f7d924f..ae7e6cdccc 100644
--- a/net/net.c
+++ b/net/net.c
@@ -359,10 +359,10 @@ static int net_init_loop(void)
 			ip6_make_lladdr(&net_link_local_ip6, net_ethaddr);
-			if (!memcmp(&net_ip6, &net_null_addr_ip6,
-				    sizeof(struct in6_addr)))
-				memcpy(&net_ip6, &net_link_local_ip6,
-				       sizeof(struct in6_addr));
+			if (memcmp(&net_link_local_ip6, &net_null_addr_ip6,
+				   sizeof(struct in6_addr))) {
+				net_copy_ip6(&net_ip6, &net_link_local_ip6);
+			}

More information about the U-Boot mailing list