[Resent as v2 as former patch didn't apply anymore]

Currently, the hostname is sent in a DHCP request only if configured 
explicitely.

Changing this behaviour so that the hostname is sent per default has the 
advantage
that e.g. a Fritz!Box (acting as DHCP server) shows the device running OpenWRT
with it's hostname in the network overview.

To prevent sending a hostname at all (and to be backwards compatible) the
configuration option can be set to "none".

Signed-off-by: Michael Heimpold <m...@heimpold.de>

Index: package/base-files/files/lib/network/config.sh
===================================================================
--- package/base-files/files/lib/network/config.sh      (revision 27292)
+++ package/base-files/files/lib/network/config.sh      (working copy)
@@ -363,6 +363,11 @@
                        [ -z "$ipaddr" ] || \
                                $DEBUG ifconfig "$iface" "$ipaddr" 
${netmask:+netmask "$netmask"}
 
+                       # send system's hostname to upstream by default if not 
explicitly configured;
+                       # but suppress if special hostname 'none' is given
+                       [ -n "$hostname" ] || hostname=$(uci -q get 
system.@system[0].hostname)
+                       [ "$hostname" = "none" ] && hostname=""
+
                        # additional request options
                        local opt dhcpopts
                        for opt in $reqopts; do
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to