[OpenWrt-Devel] Default dhcp (client) hostname is unset - Luci implies $(hostname)

Justin Vallon justinvallon at gmail.com
Wed Oct 8 15:07:42 EDT 2014

On 10/8/14 4:47 AM, Christian Schoenebeck wrote:
> Inside [buildroot]/feeds/luci/modules/base/luasrc/model/cbi/admin_network/proto_dhcp.lua
> you find the definition hostname.placeholder = luci.sys.hostname().
> It's not "default" so its never written/used to configuration.
> From the LuCI point of view placeholder is a sample. (light grey)
> If it's a default (also used be the system behind LuCI) then its written into the field as if the user write something into the field.

Now I see what you mean.  It is confusing, though, from a UI because
sometimes the "ghost" values are defaults and sometimes samples.  I
don't think your last statement is accurate, because there are default
values that are not saved in uci.

1) DHCP & DNS / General Settings: DNS forwardings
"/example.org/" is clearly a sample.
2) ... / Advanced Settings: DNS server port "53", but
dhcp. at dnsmasq[0].port is unset.  53 is the default DNS port.  Setting it
causes dhcp.*.port to be set.
3) ... / Advanced Settings : Max concurrent queries "150", but no
dhcp. at dnsmasq[0].* value.  150 is the default value (app default)

The only way to tell the difference between a sample and a default would
be to know whether the value is reasonable.  In the case of DHCP
hostname, the default seems reasonable, so it is confusing when udhcpc
does not send $HOSTNAME.

In <5434F9AC.3050607 at openwrt.org>, Jow said that some dhcp servers choke
on dhcp hostnames.  Then, if >99% of OpenWRT configurations are probably
where the upstream dhcp server is "external", sending a hostname will do
more harm than good.

Then, back to the UI.  Since it is hard to distinguish between "default
value" and "example value" in DHCP client hostname, can it be changed to
empty-string?  I tried the following:

[[[ git://git.openwrt.org/project/luci.git
diff --git a/modules/base/luasrc/model/cbi/admin_network/proto_dhcp.lua
index fe3fec6..62047b5 100644
--- a/modules/base/luasrc/model/cbi/admin_network/proto_dhcp.lua
+++ b/modules/base/luasrc/model/cbi/admin_network/proto_dhcp.lua
@@ -20,7 +20,6 @@ local bcast, defaultroute, peerdns, dns, metric,
clientid, vendorclass
 hostname = section:taboption("general", Value, "hostname",
     translate("Hostname to send when requesting DHCP"))
-hostname.placeholder = luci.sys.hostname()
 hostname.datatype    = "hostname"

JustinVallon at gmail.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4258 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20141008/e781a03c/attachment.p7s>
-------------- next part --------------
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list