[openwrt/openwrt] netifd: dhcp: suppress udhcpc default vendor class if specified in sendopts

LEDE Commits lede-commits at lists.infradead.org
Sat Jan 10 11:40:48 PST 2026


noltari pushed a commit to openwrt/openwrt.git, branch openwrt-25.12:
https://git.openwrt.org/46e4aa32836cf8d3ec4741c067470862af19b073

commit 46e4aa32836cf8d3ec4741c067470862af19b073
Author: JINLIANG GU <ihipop at gmail.com>
AuthorDate: Sat Jan 10 09:45:58 2026 +0800

    netifd: dhcp: suppress udhcpc default vendor class if specified in sendopts
    
    When DHCP Option 60 is specified via sendopts (hex, decimal, or named
    formats), udhcpc sends its default "udhcp <version>" string alongside
    the custom value, which causes authentication failures with some ISPs.
    
    This fix detects Option 60 in sendopts and automatically passes -V ""
    to udhcpc to suppress the default version string while allowing
    multiple user-defined vendor classes.
    
    Supported formats:
    - Hexadecimal: 0x3c
    - Decimal: 60
    - Named: vendor
    
    (cherry picked from commit 89d982d723f027a5650d9e55726c87a1ba46b4dd)
    Fixes: #21242
    Signed-off-by: JINLIANG GU <ihipop at gmail.com>
    Link: https://github.com/openwrt/openwrt/pull/21450
    Signed-off-by: Álvaro Fernández Rojas <noltari at gmail.com>
---
 package/network/config/netifd/Makefile                      |  2 +-
 .../network/config/netifd/files/lib/netifd/proto/dhcp.sh    | 13 ++++++++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile
index 0e8dd7d52b..2c550ef554 100644
--- a/package/network/config/netifd/Makefile
+++ b/package/network/config/netifd/Makefile
@@ -1,7 +1,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=netifd
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git
diff --git a/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh b/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh
index f6e0690884..1c0f720f4a 100755
--- a/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh
+++ b/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh
@@ -66,6 +66,7 @@ proto_dhcp_setup() {
 	[ "$norelease" = 1 ] && norelease="" || norelease="-R"
 	[ -z "$clientid" ] && clientid="$(proto_dhcp_get_default_clientid "$iface")"
 	[ -n "$clientid" ] && clientid="-x 0x3d:${clientid//:/}"
+	[ -n "$vendorid" ] && append dhcpopts "-x 0x3c:$(echo -n "$vendorid" | hexdump -ve '1/1 "%02x"')"
 	[ -n "$iface6rd" ] && proto_export "IFACE6RD=$iface6rd"
 	[ "$iface6rd" != 0 -a -f /lib/netifd/proto/6rd.sh ] && append dhcpopts "-O 212"
 	[ -n "$zone6rd" ] && proto_export "ZONE6RD=$zone6rd"
@@ -76,6 +77,16 @@ proto_dhcp_setup() {
 	# Request classless route option (see RFC 3442) by default
 	[ "$classlessroute" = "0" ] || append dhcpopts "-O 121"
 
+	# Avoid sending duplicate Option 60 values
+	local emptyvendorid
+	case "$dhcpopts" in
+		*"-x 0"[xX]*"3"[cC]":"* |\
+		*"-x 60:"* |\
+		*"-x vendor:"*)
+			emptyvendorid=1
+			;;
+	esac
+
 	proto_export "INTERFACE=$config"
 	proto_run_command "$config" udhcpc \
 		-p /var/run/udhcpc-$iface.pid \
@@ -83,7 +94,7 @@ proto_dhcp_setup() {
 		-f -t 0 -i "$iface" \
 		${ipaddr:+-r ${ipaddr/\/*/}} \
 		${hostname:+-x "hostname:$hostname"} \
-		${vendorid:+-V "$vendorid"} \
+		${emptyvendorid:+-V ""} \
 		$clientid $defaultreqopts $broadcast $norelease $dhcpopts
 }
 




More information about the lede-commits mailing list