#1986 Issue closed
: DHCP client does not iterate through all interfaces¶
Labels: bug
, fixed / solved / done
Signum opened issue at 2018-11-28 15:50:¶
There is a bug in the DHCP interface discovery. The for loop…
for dev in `get_device_by_hwaddr` ; do
…correctly iterates over all relevant interfaces. But the $DEVICE variable is only set the first time of the loop. In subsequent loop iterations this line will prevent $DEVICE from taking on the new interface name:
[ -z "$DEVICE" -a -n "$HWADDR" ] && DEVICE=$(get_device_by_hwaddr $HWADDR)
$DEVICE is still present from the previous run so the test for an empty string ([ -z $DEVICE]) will always fail.
This bug will not appear if the first interface found is the interface which you want to use for a recovery. But in my case the first interface was a Wifi interface (wlan0) and the second was my connected ethernet interface (eth0). However the 'dhclient' kept trying to get an IP address on wlan0.
I will send a pull request in a minute to fix this issue. I have already tested it on my system.
In addition it may be better to ask the user which interface to use for DHCP if there are multiple of them.
jsmeix commented at 2018-11-29 08:54:¶
@Signum
thank you for analyzing and reporting the issue to us!
Signum commented at 2018-11-29 09:13:¶
Glad I could at least contribute a tiny bit. REAR rocks. Thanks for your work.
jsmeix commented at 2018-12-05 13:13:¶
With
https://github.com/rear/rear/pull/1987
merged
this issue should be fixed.
[Export of Github issue for rear/rear.]