Discussion:
[OpenWrt-Devel] Default dhcp (client) hostname is unset - Luci implies $(hostname)
Justin Vallon
2014-10-07 23:02:36 UTC
Permalink
[BB 14.07]

In the Luci section for "Interface / General Setup", the is a parameter
"Hostname to send when requesting DHCP". That input field has a "ghost"
value of $HOSTNAME (meaning to me that its default value is $HOSTNAME).

However, entering the $HOSTNAME in the field changes the behavior. I
can see udhcpc being called with "-H $host" if I give a value, and no -H
if left blank. It appears from command-line options that -H (or newer
-x hostname:$HOST) causes the DHCP Hostname option to be sent, but it is
not sent otherwise.

So either:

1) The dhcp hostname option should be blank to indicate no default value
(maintain current behavior)
2) When udhcpc is invoked, it should pass "-H $(hostname)" in case of
default (make backend behave as Luci implies)

IMO: I find it nice that many hosts pass their hostname automatically,
so that the DHCP active lease list is useful, versus a lot of "?"
entries and ethernet addresses. So, I would vote for 2.

Opinions? Where would this bug get posted? (wiki.openwrt.org is down,
so I cannot check the wiki)
--
-Justin
***@gmail.com
Aaron Z
2014-10-08 00:46:58 UTC
Permalink
Post by Justin Vallon
1) The dhcp hostname option should be blank to indicate no default value
(maintain current behavior)
2) When udhcpc is invoked, it should pass "-H $(hostname)" in case of
default (make backend behave as Luci implies)
IMO: I find it nice that many hosts pass their hostname automatically,
so that the DHCP active lease list is useful, versus a lot of "?"
entries and ethernet addresses. So, I would vote for 2.
Opinions? Where would this bug get posted? (wiki.openwrt.org is down,
so I cannot check the wiki)
The wiki is working for me now... That info is stored on a per
interface basis in /etc/config/network (see Link[1]) and is not set by
default, although it may pull from /etc/config/system (see Link[2]) if
unset in /etc/config/network.
The default value in /etc/config/system is 'OpenWrt'

Link[1]: http://wiki.openwrt.org/doc/uci/network#protocol.dhcp
Link[2]: http://wiki.openwrt.org/doc/uci/system

Aaron Z
A human being should be able to change a diaper, plan an invasion,
butcher a hog, conn a ship, design a building, write a sonnet, balance
accounts, build a wall, set a bone, comfort the dying, take orders,
give orders, cooperate, act alone, solve equations, analyze a new
problem, pitch manure, program a computer, cook a tasty meal, fight
efficiently, die gallantly. Specialization is for insects.
— Robert Heinlein, Time Enough for Love
Justin Vallon
2014-10-08 05:07:01 UTC
Permalink
Post by Aaron Z
Post by Justin Vallon
1) The dhcp hostname option should be blank to indicate no default value
(maintain current behavior)
2) When udhcpc is invoked, it should pass "-H $(hostname)" in case of
default (make backend behave as Luci implies)
IMO: I find it nice that many hosts pass their hostname automatically,
so that the DHCP active lease list is useful, versus a lot of "?"
entries and ethernet addresses. So, I would vote for 2.
Opinions? Where would this bug get posted? (wiki.openwrt.org is down,
so I cannot check the wiki)
The wiki is working for me now... That info is stored on a per
interface basis in /etc/config/network (see Link[1]) and is not set by
default, although it may pull from /etc/config/system (see Link[2]) if
unset in /etc/config/network.
The default value in /etc/config/system is 'OpenWrt'
Link[1]: http://wiki.openwrt.org/doc/uci/network#protocol.dhcp
Link[2]: http://wiki.openwrt.org/doc/uci/system
The docs for uci network.${iface}.hostname say that there is no default
hostname submitted in the DHCP request. However, Luci seems to imply
that the default is $HOSTNAME because it shows $HOSTNAME if the field is
unset. Your guess ("it may pull from ...") appears to be incorrect, and
is/was my confusion as well.

Fixing Luci would seem to be straightforward (default is ""). Fixing
the backend (default is "$HOSTNAME") would be a change of behavior. I
will look into both options.
--
-Justin
***@gmail.com
Jo-Philipp Wich
2014-10-08 08:45:32 UTC
Permalink
Hi,

I think there are two problems which prevented any definitive decision
so far:

1) Some DHCP servers (cable modems, etc.) have problems with clients
sending any hostname

2) As soon as we treat an empty hostname as defaulting to
/proc/sys/kernel/hostname we have no clean way to express "send no
hostname" anymore. Picking values like "none" for that will not work
as these are valid hostnames too.

~ Jow
Christian Schoenebeck
2014-10-08 08:47:30 UTC
Permalink
Post by Justin Vallon
Post by Aaron Z
Post by Justin Vallon
1) The dhcp hostname option should be blank to indicate no default value
(maintain current behavior)
2) When udhcpc is invoked, it should pass "-H $(hostname)" in case of
default (make backend behave as Luci implies)
IMO: I find it nice that many hosts pass their hostname automatically,
so that the DHCP active lease list is useful, versus a lot of "?"
entries and ethernet addresses. So, I would vote for 2.
Opinions? Where would this bug get posted? (wiki.openwrt.org is down,
so I cannot check the wiki)
The wiki is working for me now... That info is stored on a per
interface basis in /etc/config/network (see Link[1]) and is not set by
default, although it may pull from /etc/config/system (see Link[2]) if
unset in /etc/config/network.
The default value in /etc/config/system is 'OpenWrt'
Link[1]: http://wiki.openwrt.org/doc/uci/network#protocol.dhcp
Link[2]: http://wiki.openwrt.org/doc/uci/system
The docs for uci network.${iface}.hostname say that there is no default
hostname submitted in the DHCP request. However, Luci seems to imply
that the default is $HOSTNAME because it shows $HOSTNAME if the field is
unset. Your guess ("it may pull from ...") appears to be incorrect, and
is/was my confusion as well.
Fixing Luci would seem to be straightforward (default is ""). Fixing
the backend (default is "$HOSTNAME") would be a change of behavior. I
will look into both options.
_______________________________________________
openwrt-devel mailing list
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
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.
Justin Vallon
2014-10-08 19:07:42 UTC
Permalink
Post by Christian Schoenebeck
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.
Christian Schoenebeck
2014-10-08 20:06:02 UTC
Permalink
Post by Christian Schoenebeck
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.
Justin Vallon
2014-10-09 23:39:22 UTC
Permalink
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.
Understood. However, if no input is provided, the DHCP client sends no
hostname. In that respect, it is not a default, but a sample value.
Contrast this with "DNS server port" = "53", which means that if no
input is given, the DNS port is 53.

I surveyed the <gray> values in my Luci interface, and most of them use
<gray> to display the default value of a parameter (ala DNS port). The
DHCP & DNS parameter DNS forwardings is a fake default (not really the
default value), as well as Interface / DHCP hostname (again not really
the default value). While it is clear that "/example.org/10.1.2.3" is a
sample value, it is not clear that the default DHCP hostname is unused.

I would suggest that these fields be reexamined, because they are
inconsistent with the behavior of all the other fields:

1) DHCP hostname should be empty, no "gray" value.
2) DNS forwardings should be empty. Help could indicate: "Format is
/domain/server, or server for fallback"

I thought the following were bogus, but they appear to be meaningful,
from a quick check:

1) Domain whitelist = "ihost.netflix.com", which resolves to 127.0.0.1,
so that default appears meaningful
2) Bogus NX Domain Override = "67.215.65.132", which reverse resolves to
hit-nxdomain.opendns.com, so that default appears to be meaningful as well.
--
-Justin
***@gmail.com
Loading...