From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6C6E3C0218A for ; Mon, 27 Jan 2025 22:06:21 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 010E1812C8; Mon, 27 Jan 2025 23:06:20 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="l8jK0C1h"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BEA5381727; Mon, 27 Jan 2025 23:06:18 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by phobos.denx.de (Postfix) with ESMTP id 7250A812BB for ; Mon, 27 Jan 2025 23:06:16 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=seanedmond@linux.microsoft.com Received: from LAPTOP-HS0II3UH.corp.microsoft.com (unknown [167.220.26.7]) by linux.microsoft.com (Postfix) with ESMTPSA id 6E64D203716C; Mon, 27 Jan 2025 14:06:15 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 6E64D203716C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1738015575; bh=TvSbca1Kcb8XR25oBXMjWn5KgDTqLUMRfGmfYFBByxU=; h=From:To:Cc:Subject:Date:From; b=l8jK0C1h2uy/0+2StOdJoVHx5TB0WYP/0fzyLOL3CW65bzhVDPj6GXrwR3GQU92An FUnejYmfXyhdok/4zcRrChwoju6ZUyZP91WQcgF+SvOktuHtx7Bm8OANbqVnnL/Fyc zsQPbo9msPtfIuI9bDF1qpfnx/m5ZEeULGrG3uls= From: seanedmond@linux.microsoft.com To: u-boot@lists.denx.de Cc: joe.hershberger@ni.com, rfried.dev@gmail.com, trini@konsulko.com Subject: [PATCH] net: dhcp6: Send DHCPv6 using multicast MAC Date: Mon, 27 Jan 2025 14:06:13 -0800 Message-Id: <20250127220613.11518-1-seanedmond@linux.microsoft.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 From: Sean Edmond In IPv6, the broadcast MAC address is not used. Instead, it should use the multicast address (see RFC RFC2464). Signed-off-by: Sean Edmond --- net/dhcpv6.c | 12 ++++++------ net/dhcpv6.h | 8 +++++++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/net/dhcpv6.c b/net/dhcpv6.c index 54619ee6983..984a64a4ff3 100644 --- a/net/dhcpv6.c +++ b/net/dhcpv6.c @@ -29,6 +29,10 @@ int updated_sol_max_rt_ms = SOL_MAX_RT_MS; /* state machine parameters/variables */ struct dhcp6_sm_params sm_params; +/* DHCPv6 all server IP6 address */ +const struct in6_addr dhcp_mcast_ip6 = DHCP6_MULTICAST_ADDR; +/* IPv6 multicast ethernet address */ +const u8 net_dhcp6_mcast_ethaddr[6] = IPV6_ALL_NODE_ETH_ADDR(dhcp_mcast_ip6); static void dhcp6_state_machine(bool timeout, uchar *rx_pkt, unsigned int len); @@ -171,7 +175,6 @@ static int dhcp6_add_option(int option_id, uchar *pkt) */ static void dhcp6_send_solicit_packet(void) { - struct in6_addr dhcp_bcast_ip6; int len = 0; uchar *pkt; uchar *dhcp_pkt_start_ptr; @@ -200,9 +203,8 @@ static void dhcp6_send_solicit_packet(void) len = pkt - dhcp_pkt_start_ptr; /* send UDP packet to DHCP6 multicast address */ - string_to_ip6(DHCP6_MULTICAST_ADDR, sizeof(DHCP6_MULTICAST_ADDR), &dhcp_bcast_ip6); net_set_udp_handler(dhcp6_handler); - net_send_udp_packet6((uchar *)net_bcast_ethaddr, &dhcp_bcast_ip6, + net_send_udp_packet6((uchar *)net_dhcp6_mcast_ethaddr, (struct in6_addr *)&dhcp_mcast_ip6, PORT_DHCP6_S, PORT_DHCP6_C, len); } @@ -218,7 +220,6 @@ static void dhcp6_send_solicit_packet(void) */ static void dhcp6_send_request_packet(void) { - struct in6_addr dhcp_bcast_ip6; int len = 0; uchar *pkt; uchar *dhcp_pkt_start_ptr; @@ -252,9 +253,8 @@ static void dhcp6_send_request_packet(void) len = pkt - dhcp_pkt_start_ptr; /* send UDP packet to DHCP6 multicast address */ - string_to_ip6(DHCP6_MULTICAST_ADDR, strlen(DHCP6_MULTICAST_ADDR), &dhcp_bcast_ip6); net_set_udp_handler(dhcp6_handler); - net_send_udp_packet6((uchar *)net_bcast_ethaddr, &dhcp_bcast_ip6, + net_send_udp_packet6((uchar *)net_dhcp6_mcast_ethaddr, (struct in6_addr *)&dhcp_mcast_ip6, PORT_DHCP6_S, PORT_DHCP6_C, len); } diff --git a/net/dhcpv6.h b/net/dhcpv6.h index 65c8e4c71d3..d41a3c30615 100644 --- a/net/dhcpv6.h +++ b/net/dhcpv6.h @@ -40,7 +40,13 @@ /* vendor-class-data to send in vendor clas option */ #define DHCP6_VCI_STRING "U-Boot" -#define DHCP6_MULTICAST_ADDR "ff02::1:2" /* DHCP multicast address */ +/* + * All-DHCPv6 server multicast address + */ +#define DHCP6_MULTICAST_ADDR { { { 0xFF, 0x02, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x01, 0x00, 0x02 } } } /* DHCP6 States supported */ enum dhcp6_state { -- 2.34.1