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/10.1.2.3" is clearly a sample.
2) ... / Advanced Settings: DNS server port "53", but
dhcp.@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.@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 <[email protected]>, 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"
 
 
]]]

-- 
-Justin
[email protected]


Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to