From patchwork Wed May 10 16:59:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dmitrii Merkurev X-Patchwork-Id: 1779643 X-Patchwork-Delegate: rfried.dev@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20221208 header.b=q0gwAjbU; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QGhBg3rRSz214S for ; Thu, 11 May 2023 03:01:31 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 312FE8607F; Wed, 10 May 2023 19:00:30 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="q0gwAjbU"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 745FD84765; Wed, 10 May 2023 19:00:21 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x54a.google.com (mail-ed1-x54a.google.com [IPv6:2a00:1450:4864:20::54a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6D2EA86076 for ; Wed, 10 May 2023 19:00:16 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=3oM1bZAkKBtM27BDG7CCN5DD5A3.1DBJ-0DDIA7HIH.23CM.23@flex--dimorinny.bounces.google.com Received: by mail-ed1-x54a.google.com with SMTP id 4fb4d7f45d1cf-50daa85e940so4417350a12.0 for ; Wed, 10 May 2023 10:00:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1683738016; x=1686330016; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:from:to:cc:subject:date:message-id :reply-to; bh=85zcOFBjdKh3uQkTCEWFrH+Wzy6sNdZ9/otnJ507tyk=; b=q0gwAjbUfTNLO9+tNl2m0RLUvzk2iLAaYT1q0EBIfs53GTSEC1MBNeMmcE29984aip tkv2zotnQj4coSGecYPDJbiAZL2Bspa6upSSZQgy6Pf516jA52Kyf9V4l/xnKbc+Ylid rAzvCTDquJV1s7oAzF+HSVYFP43blQls+vLj9keveUKCcI8PKrywuQQstgm8lJWeT7jo aHX2qcfdrtwSqEsx3i/98tZWL0fYndWJtcfVlruSKhv0z+tMBdia/Jmm1M4xioH5GlaL DkKmZ1yPoB4+VQmvlp7ifL/K0gqVrMRELGYuZZbLwgfEzgfYpJmgU+/dnlDQ2FKnC+gP wpPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683738016; x=1686330016; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=85zcOFBjdKh3uQkTCEWFrH+Wzy6sNdZ9/otnJ507tyk=; b=jcWanYA901VShd8fYU5eH7WbJ8trK9aUO9AUbqCxaSceqXGKlxopwQuQZrqettULhB HmBk7x8gFSmm7r7LF/WieNtwGKDwk5I9d7KisPydizxSybrUWtjA49eG5AjP1OlgJvKT O+Wt8S2u7wB1YD84CuoalWTjh4+PmUEm61gzEiosCM6oJ31d63n1Gh0lT46wW9XxyMZ6 PHhBcqGh+jfp0ReGS6ztNGJ+gFojpdp05d8XYGwSiDcHSMDPhFN17r7RKgm7EdCE8VMC w7qFp6NZqiRDRLcGmZ9d3udprTKwaJCuSW+zKXEPpJVKWLf2xl7/0A5cm/A54fUZo0th qJmA== X-Gm-Message-State: AC+VfDx3U6pjLAsrVKn9yzikNWsJLnz12q3JarLdI9gJTIzGhl9IyF0g 7Vsz/aXdlNtHmZ16dL+bUBjgI6Z6Lw/xwo8WAhVm+++WOObnDWOnfGXvZaYUxWxM/fo6oowrtFO toyB5axW+FccVjWPTi+nxxLj8+N/TA25snxHnRhBhbfhq1CRnPvdmxL9eaHUkkbZn8sU= X-Google-Smtp-Source: ACHHUZ56D259tR4wKEtFlXlorCfAb7Ckfv6AuSATtu6TjnVq5POD1KZPS/5T3CbtGb7HWuGb+CUYhkAm8N8Vw7A= X-Received: from dimorinny0.lon.corp.google.com ([2a00:79e0:d:209:8054:7d60:263c:94b9]) (user=dimorinny job=sendgmr) by 2002:a50:d09d:0:b0:50b:9f77:74b4 with SMTP id v29-20020a50d09d000000b0050b9f7774b4mr6681705edd.6.1683738016037; Wed, 10 May 2023 10:00:16 -0700 (PDT) Date: Wed, 10 May 2023 17:59:59 +0100 In-Reply-To: <20230510165959.2228978-1-dimorinny@google.com> Mime-Version: 1.0 References: <20230510165959.2228978-1-dimorinny@google.com> X-Mailer: git-send-email 2.40.1.606.ga4b1b128d6-goog Message-ID: <20230510165959.2228978-6-dimorinny@google.com> Subject: [PATCH v2 6/6] net: update net_ip6 from link_local address when eth device is changed From: Dmitrii Merkurev To: u-boot@lists.denx.de Cc: rammuthiah@google.com, rfried.dev@gmail.com, Dmitrii Merkurev , Ying-Chun Liu , Simon Glass X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean 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 Cc: Ying-Chun Liu (PaulLiu) Cc: Simon Glass Сс: Joe Hershberger Сс: Ramon Fried Reviewed-by: Simon Glass --- net/net.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/net/net.c b/net/net.c index 9ef290dc41..0f14f29de8 100644 --- a/net/net.c +++ b/net/net.c @@ -359,10 +359,10 @@ static int net_init_loop(void) if (IS_ENABLED(CONFIG_IPV6)) { 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); + } } } else