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

Christian Schoenebeck christian.schoenebeck at gmail.com
Wed Oct 8 16:06:02 EDT 2014

Am 08.10.2014 um 21:07 schrieb Justin Vallon:
> 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
> b/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"
> ]]]
About the need or not of a hostname for dhcp I can't say anything.
Missing knowledge.

About LuCI and the applications/scripts behind I can say that the "default" 
is normally not set in the config because it's done in the scripts/apps as default.
As stated by Jow something like "none" doesn't work.
The placeholder is a good thing to show the user what kind of entry is needed to put in.
It's completely removed (no longer displayed) if you start to edit the field.
The "default" is written to the field and you can edit it as you like because it's a text field.
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list