From ba5c63cc0cbbacd952a5c2cfd873439bf5adc86a Mon Sep 17 00:00:00 2001 From: Tanya Singh Date: Thu, 18 Sep 2025 13:21:38 +0800 Subject: [PATCH] netifd: Support DHCP option 138 and DHCP option 224 --- .../netifd/files/lib/netifd/dhcp.script | 10 ++++++++++ .../patches/601-dhcp_opt138_opt224.patch | 20 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 package/utils/busybox/patches/601-dhcp_opt138_opt224.patch diff --git a/package/network/config/netifd/files/lib/netifd/dhcp.script b/package/network/config/netifd/files/lib/netifd/dhcp.script index 6fcf139beb..9c4366f48b 100755 --- a/package/network/config/netifd/files/lib/netifd/dhcp.script +++ b/package/network/config/netifd/files/lib/netifd/dhcp.script @@ -4,6 +4,8 @@ . /lib/functions.sh . /lib/netifd/netifd-proto.sh +rm -rf /tmp/dhcp-option-* + set_classless_routes() { local max=128 while [ -n "$1" -a -n "$2" -a $max -gt 0 ]; do @@ -111,6 +113,14 @@ case "$1" in ;; esac +if [ -n "${opt138}" ]; then + echo -n "${opt138}" > /tmp/dhcp-option-138 +fi + +if [ -n "${opt224}" ]; then + echo -n "${opt224}" > /tmp/dhcp-option-224 +fi + # user rules [ -f /etc/udhcpc.user ] && . /etc/udhcpc.user "$@" for f in /etc/udhcpc.user.d/*; do diff --git a/package/utils/busybox/patches/601-dhcp_opt138_opt224.patch b/package/utils/busybox/patches/601-dhcp_opt138_opt224.patch new file mode 100644 index 0000000000..38e53be78c --- /dev/null +++ b/package/utils/busybox/patches/601-dhcp_opt138_opt224.patch @@ -0,0 +1,20 @@ +--- a/networking/udhcp/common.c 2025-09-18 13:15:38.313248300 +0800 ++++ b/networking/udhcp/common.c 2025-09-18 13:17:50.078418978 +0800 +@@ -55,6 +55,8 @@ const struct dhcp_optflag dhcp_optflags[ + { OPTION_STRING , 0x43 }, /* DHCP_BOOT_FILE */ + //TODO: not a string, but a set of LASCII strings: + // { OPTION_STRING , 0x4D }, /* DHCP_USER_CLASS */ ++ { OPTION_IP , 0x8A }, /* DHCP_OPT138 */ ++ { OPTION_STRING , 0xE0 }, /* DHCP_OPT224 */ + { OPTION_STRING , 0x64 }, /* DHCP_PCODE */ + { OPTION_STRING , 0x65 }, /* DHCP_TCODE */ + #if ENABLE_FEATURE_UDHCP_RFC3397 +@@ -124,6 +126,8 @@ const char dhcp_option_strings[] ALIGN1 + "tftp" "\0" /* DHCP_TFTP_SERVER_NAME*/ + "bootfile" "\0" /* DHCP_BOOT_FILE */ + // "userclass" "\0" /* DHCP_USER_CLASS */ ++ "opt138" "\0" /* DHCP_OPT138 */ ++ "opt224" "\0" /* DHCP_OPT224 */ + "tzstr" "\0" /* DHCP_PCODE */ + "tzdbstr" "\0" /* DHCP_TCODE */ + #if ENABLE_FEATURE_UDHCP_RFC3397 -- 2.34.1