ifupdown-ng / ifupdown-ng

flexible ifup/ifdown implementation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

hostname not set with dhcp in 0.11.0

ncopa opened this issue · comments

On alpine linux edge (aarch64):

this is the /etc/network/interfaces:

auto eth0
iface eth0 inet dhcp
hostname $(hostname)

This is the udhcp line:

28482 root      0:00 /sbin/udhcpc -b -R -p /var/run/udhcpc.eth0.pid -i eth0

note that the -x hostname:$IF_DHCP_HOSTNAME was not set.

This is the environment when /usr/libexec/ifupdown-ng/dhcp is called:

+ env
IF_REQUIRES=MODE=depend METHOD=none IF_USE=dhcp SHLVL=2 IF_ADDRESSES= PHASE=depend IF_HOSTNAME=$(hostname) INTERFACES_FILE=/etc/network/interfaces IFACE=eth0 IF_GATEWAYS= PWD=/root 
MODE=start
METHOD=none
IF_USE=dhcp
SHLVL=2
IF_ADDRESSES=
PHASE=post-up
IF_HOSTNAME=$(hostname)
INTERFACES_FILE=/etc/network/interfaces
IFACE=eth0
IF_GATEWAYS=
PWD=/root

Note that IF_HOSTNAME is set and not IF_DHCP_HOSTNAME.

I suspect that aada427 does not work as intended.

workaround is to use /etc/network/interfaces:

auto eth0
iface eth0 inet dhcp
dhcp-hostname $(hostname)

Strange regression. Investigating.

aada427 was incomplete, the handling for automatic hostname determination needed to be adjusted