[klibc] ipconfig: fix indef loop with multiple interfaces

if ipconfig is run as ipconfig :::::: (i.e. long spec with all fields empty)
and the computer has multiple network interfaces and only one of them is
connected to dhcp managed network, ipconfig ends up in an infinite loop (see
the log bellow).

The following patch solved this for me. According to README, if the <device>
in the long spec is empty, the first interface should be used, but the
program busy wait for all interfaces.

(easily testable on any laptop with 2 interfaces eth0 and wlan0,
 fixed ipconfig no longer loops indefinitely:
 ./src/klibc/usr/kinit/ipconfig/static/ipconfig -d ::::::
IP-Config: eth0 hardware address 00:16:d3:3e:31:5c mtu 1500 DHCP RARP
IP-Config: wlan0 hardware address 00:13:e8:70:59:fb mtu 1500 DHCP RARP
IP-Config: eth0 guessed broadcast address 128.131.48.255
IP-Config: eth0 complete (from 128.131.48.127):
 address: 128.131.48.177   broadcast: 128.131.48.255   netmask: 255.255.255.0
 gateway: 128.131.48.1     dns0     : 128.130.4.3      dns1   : 128.131.4.3
 domain : itp.tuwien.ac.at
 rootserver: 128.131.48.127 rootpath:
 filename  : /pxelinux.0
)

Signed-off-by: maximilian attems <max@stro.at>
1 file changed