From 14480c84dcdbdb5d7861fc1e1100900a8cd16e87 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sun, 8 Jun 2025 09:42:27 +0200 Subject: [PATCH 1/2] cmd: remove duplicate DHCPv6 Kconfig definitions Remove duplicate definition of * DHCP6_PXE_CLIENTARCH * DHCP6_PXE_DHCP_OPTION * DHCP6_ENTERPRISE_ID Signed-off-by: Heinrich Schuchardt Fixes: da24eb553279 ("Merge patch series "BOOTP/DHCPv4 enhancements"") Reviewed-by: Tom Rini Reviewed-by: Ilias Apalodimas Fixes: 5eb1b7843811 ("Merge patch series "test/py: enable HTTP testing"") Reviewed-by: Quentin Schulz --- cmd/Kconfig | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/cmd/Kconfig b/cmd/Kconfig index ed741d43cea..c335eceea63 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -2004,23 +2004,6 @@ config BOOTP_RANDOM_XID Selecting this will allow for a random transaction ID to get selected for each BOOTP/DHCPv4 exchange. -if CMD_DHCP6 - -config DHCP6_PXE_CLIENTARCH - hex - default 0x16 if ARM64 - default 0x15 if ARM - default 0xFF - -config DHCP6_PXE_DHCP_OPTION - bool "Request & store 'pxe_configfile' from DHCP6 server" - -config DHCP6_ENTERPRISE_ID - int "Enterprise ID to send in DHCPv6 Vendor Class Option" - default 0 - -endif - config CMD_TFTPPUT bool "tftp put" depends on CMD_TFTPBOOT From 092f0c45f4663d03340e50a4752ad56cfd8994b4 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sun, 8 Jun 2025 09:42:28 +0200 Subject: [PATCH 2/2] net: consolidate PXE processor architecture type Kconfig DHCP and DHCPv6 use the same value defined in https://www.iana.org/assignments/dhcpv6-parameters#processor-architecture to encode the processor architecture type. We should only use a single Kconfig symbol for both protocols. Furthermore we should make the value customizable. This allows for instance to choose between "x86 BIOS" or "x64 UEFI". As "x86 BIOS" is encoded as 0, we should not use this value to switch off transmission of the DHCP option. Use 0xFF instead. Signed-off-by: Heinrich Schuchardt Acked-by: Ilias Apalodimas Reviewed-by: Tom Rini --- cmd/Kconfig | 28 ++++++++++++++++------------ net/bootp.c | 6 +++--- net/dhcpv6.c | 6 +++--- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/cmd/Kconfig b/cmd/Kconfig index c335eceea63..4eb0140c10a 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -1864,12 +1864,6 @@ config CMD_DHCP6 if CMD_DHCP6 -config DHCP6_PXE_CLIENTARCH - hex - default 0x16 if ARM64 - default 0x15 if ARM - default 0xFF - config DHCP6_PXE_DHCP_OPTION bool "Request & store 'pxe_configfile' from DHCP6 server" @@ -1977,12 +1971,22 @@ config BOOTP_PXE help Supported for ARM, ARM64, and x86 for now. -config BOOTP_PXE_CLIENTARCH - hex - depends on BOOTP_PXE - default 0x16 if ARM64 - default 0x15 if ARM - default 0x0 if X86 +config DHCP_PXE_CLIENTARCH + hex "DCHCP client system architecture type" + depends on BOOTP_PXE || CMD_DHCP6 + default 0x16 if ARM64 # arm 64 uboot + default 0x15 if ARM # arm 32 uboot + default 0x0 if X86 # x86 BIOS + default 0xFF # DHCP option not sent + help + DHCP option 93 (defined in RFC4578) or DHCPv6 option 61 (defined in + RFC 5970) is used to transmit the client system architecture type + to the DHCP server. The DHCP server may use this information to + choose the boot file. For a complete list of assigned values see + https://www.iana.org/assignments/dhcpv6-parameters#processor-architecture. + + If the value is set to the reserved value 0xFF, the DHCP option will + not be sent by U-Boot. config BOOTP_PXE_DHCP_OPTION bool "Request & store 'pxe_configfile' from BOOTP/DHCP server" diff --git a/net/bootp.c b/net/bootp.c index f22921ed388..95d906e3b2d 100644 --- a/net/bootp.c +++ b/net/bootp.c @@ -545,14 +545,14 @@ static int dhcp_extended(u8 *e, int message_type, struct in_addr server_ip, } #endif -#ifdef CONFIG_BOOTP_PXE_CLIENTARCH - clientarch = CONFIG_BOOTP_PXE_CLIENTARCH; +#ifdef CONFIG_DHCP_PXE_CLIENTARCH + clientarch = CONFIG_DHCP_PXE_CLIENTARCH; #endif if (env_get("bootp_arch")) clientarch = env_get_ulong("bootp_arch", 16, clientarch); - if (clientarch > 0) { + if (clientarch != 0xff) { *e++ = 93; /* Client System Architecture */ *e++ = 2; *e++ = (clientarch >> 8) & 0xff; diff --git a/net/dhcpv6.c b/net/dhcpv6.c index 0c2de75ba1d..5bf935cb6a3 100644 --- a/net/dhcpv6.c +++ b/net/dhcpv6.c @@ -128,7 +128,7 @@ static int dhcp6_add_option(int option_id, uchar *pkt) break; case DHCP6_OPTION_CLIENT_ARCH_TYPE: client_arch_opt = (struct dhcp6_option_client_arch *)dhcp_option_start; - client_arch_opt->arch_type[num_client_arch++] = htons(CONFIG_DHCP6_PXE_CLIENTARCH); + client_arch_opt->arch_type[num_client_arch++] = htons(CONFIG_DHCP_PXE_CLIENTARCH); opt_len = sizeof(__be16) * num_client_arch; break; @@ -194,7 +194,7 @@ static void dhcp6_send_solicit_packet(void) pkt += dhcp6_add_option(DHCP6_OPTION_ELAPSED_TIME, pkt); pkt += dhcp6_add_option(DHCP6_OPTION_IA_NA, pkt); pkt += dhcp6_add_option(DHCP6_OPTION_ORO, pkt); - if (CONFIG_DHCP6_PXE_CLIENTARCH != 0xFF) + if (CONFIG_DHCP_PXE_CLIENTARCH != 0xFF) pkt += dhcp6_add_option(DHCP6_OPTION_CLIENT_ARCH_TYPE, pkt); pkt += dhcp6_add_option(DHCP6_OPTION_VENDOR_CLASS, pkt); pkt += dhcp6_add_option(DHCP6_OPTION_NII, pkt); @@ -244,7 +244,7 @@ static void dhcp6_send_request_packet(void) memcpy(pkt, sm_params.server_uid.uid_ptr, sm_params.server_uid.uid_size); pkt += sm_params.server_uid.uid_size; } - if (CONFIG_DHCP6_PXE_CLIENTARCH != 0xFF) + if (CONFIG_DHCP_PXE_CLIENTARCH != 0xFF) pkt += dhcp6_add_option(DHCP6_OPTION_CLIENT_ARCH_TYPE, pkt); pkt += dhcp6_add_option(DHCP6_OPTION_VENDOR_CLASS, pkt); pkt += dhcp6_add_option(DHCP6_OPTION_NII, pkt);