瀏覽代碼

netifd: add support for suppressing the DHCP request hostname by setting it to *

dnsmasq (and probably other DHCP servers as well) does not like to hand out
leases with duplicate host names.
Adding support for skipping the hostname makes it easier to deploy setups
where it is not guaranteed to be unique

Signed-off-by: Felix Fietkau <[email protected]>
Felix Fietkau 6 年之前
父節點
當前提交
fd8ca8deb3
共有 1 個文件被更改,包括 2 次插入0 次删除
  1. 2 0
      package/network/config/netifd/files/lib/netifd/proto/dhcp.sh

+ 2 - 0
package/network/config/netifd/files/lib/netifd/proto/dhcp.sh

@@ -46,6 +46,8 @@ proto_dhcp_setup() {
 	json_for_each_item proto_dhcp_add_sendopts sendopts dhcpopts
 
 	[ -z "$hostname" ] && hostname="$(cat /proc/sys/kernel/hostname)"
+	[ "$hostname" = "*" ] && hostname=
+
 	[ "$defaultreqopts" = 0 ] && defaultreqopts="-o" || defaultreqopts=
 	[ "$broadcast" = 1 ] && broadcast="-B" || broadcast=
 	[ "$release" = 1 ] && release="-R" || release=