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

Daniel Golle daniel at makrotopia.org
Fri Dec 8 12:14:06 PST 2017


Hi Mathias,

On Fri, Dec 08, 2017 at 09:35:26AM +0100, Mathias Kresin wrote:
> udhcpc doesn't send a hostname by default. Use the system hostname if
> nothing else is specified, to always send a hostname.
> 
> It syncs the behaviour to odhcpc, which always sends a hostname.

Could we somehow allow to deliberately not send any hostname?
ISC dhcpcd allows setting it to 'null' or 'localhost' for that
purpose.
There are two possible uses for not sending the hostname in the DHCP
request:
 i) expecting the hostname to be assigned by the DHCP server
ii) minimizing the amount of identifyable bits being sent, e.g.
    when connecting to public networks

Cheers


Daniel


> 
> 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"
> -- 
> 2.7.4
> 
> 
> _______________________________________________
> Lede-dev mailing list
> Lede-dev at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/lede-dev



More information about the Lede-dev mailing list