netifd: always send DHCPv4 hostname
authorMathias Kresin <dev@kresin.me>
Fri, 8 Dec 2017 08:35:26 +0000 (09:35 +0100)
committerMathias Kresin <dev@kresin.me>
Fri, 8 Dec 2017 20:00:26 +0000 (21:00 +0100)
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.

Signed-off-by: Mathias Kresin <dev@kresin.me>
Acked-by: Stijn Tintel <stijn@linux-ipv6.be>
Acked-by: Hans Dedecker <dedeckeh@gmail.com>
package/network/config/netifd/files/lib/netifd/proto/dhcp.sh

index ea02d68bb4fb00a2365c4f9bfd68ea1c3b7d34ba..143e4451b6648ac2048b782989f7bb1c50f800d8 100755 (executable)
@@ -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"