Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DHCP client does not iterate through all interfaces #1986

Closed
Signum opened this issue Nov 28, 2018 · 3 comments
Closed

DHCP client does not iterate through all interfaces #1986

Signum opened this issue Nov 28, 2018 · 3 comments
Assignees
Labels
bug The code does not do what it is meant to do fixed / solved / done
Milestone

Comments

@Signum
Copy link

Signum commented Nov 28, 2018

[ -z "$DEVICE" -a -n "$HWADDR" ] && DEVICE=$(get_device_by_hwaddr $HWADDR)

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 jsmeix self-assigned this Nov 29, 2018
@jsmeix jsmeix added the bug The code does not do what it is meant to do label Nov 29, 2018
@jsmeix jsmeix added this to the ReaR v2.5 milestone Nov 29, 2018
@jsmeix
Copy link
Member

jsmeix commented Nov 29, 2018

@Signum
thank you for analyzing and reporting the issue to us!

@Signum
Copy link
Author

Signum commented Nov 29, 2018

Glad I could at least contribute a tiny bit. REAR rocks. Thanks for your work.

jsmeix added a commit that referenced this issue Dec 5, 2018
Fixed that in the recovery system the DHCP client
did not iterate through all network interfaces.
It incorrectly took only the first found interface.
If the interface that is intended for recovery
was not the first one, automatic recovery had failed,
see #1986
@jsmeix
Copy link
Member

jsmeix commented Dec 5, 2018

With #1987 merged
this issue should be fixed.

@jsmeix jsmeix closed this as completed Dec 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The code does not do what it is meant to do fixed / solved / done
Projects
None yet
Development

No branches or pull requests

2 participants