[LEDE-DEV] [PATCH] netifd: always send DHCPv4 hostname

Arjen de Korte arjen+lede at de-korte.org
Fri Dec 8 12:32:01 PST 2017


Citeren Mathias Kresin <dev at kresin.me>:

> udhcpc doesn't send a hostname by default. Use the system hostname if
> nothing else is specified, to always send a hostname.

Be aware that this might mean that some DHCP servers may assign a  
different IP in this case. If I switch to odhcpc, I *will* get a  
different IP address, despite the MAC address staying the same.

> It syncs the behaviour to odhcpc, which always sends a hostname.

As someone else already commented, I'd too would prefer if this  
changed functionality is optional and default to the existing behavior  
of not sending the hostname.

> Signed-off-by: Mathias Kresin <dev at kresin.me>
> ---
>  package/network/config/netifd/files/lib/netifd/proto/dhcp.sh | 1 +
>  1 file changed, 1 insertion(+)
>
> 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 ea02d68..143e445 100755
> --- a/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh
> +++ b/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh
> @@ -40,6 +40,7 @@ proto_dhcp_setup() {
>  		append dhcpopts "-x $opt"
>  	done
>
> +	[ -z "$hostname" ] && hostname="$(cat /proc/sys/kernel/hostname)"
>  	[ "$broadcast" = 1 ] && broadcast="-B" || broadcast=
>  	[ "$release" = 1 ] && release="-R" || release=
>  	[ -n "$clientid" ] && clientid="-x 0x3d:${clientid//:/}" || clientid="-C"






More information about the Lede-dev mailing list