Skip to content
Snippets Groups Projects
Commit 162fb24e authored by Alessandro Rubini's avatar Alessandro Rubini
Browse files

userspace: run dhcpc in background forever, not through auto means


Running "ifup eth0" if eth0 is configured for dhcp would make the
client try a little while and then give up. Thus, if the dhcp server
is currently down we end up without IP address. This happens after a
power failure, if the switch reboots faster than the dhcp server.

Also, avoid ifplugd, that won't help in this case (the link is up,
so no "link up" will happen later.

This new configuration works in all cases:
     - eth0 is configured with a static address in /etc/network/interfaces
     - dhcp-driven, and link goes down and then up
     - dhcp-driven, and server not ready at boot time
     - dhcp-driven and all fine since boot time

Signed-off-by: default avatarAlessandro Rubini <rubini@gnudd.com>
parent bb1c0bad
No related merge requests found
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
set -e set -e
## NOTE: wr-switch-sw doesn't run ifplugd by default any more
if [ -z "$1" ] || [ -z "$2" ] ; then if [ -z "$1" ] || [ -z "$2" ] ; then
echo "Wrong arguments" > /dev/stderr echo "Wrong arguments" > /dev/stderr
exit 1 exit 1
......
...@@ -3,17 +3,15 @@ ...@@ -3,17 +3,15 @@
# Start the network.... # Start the network....
# #
#MAC=`/wr/bin/get_board_mac`
#echo "Management port MAC address: $MAC"
#ifconfig eth0 hw ether $MAC
#ifplugd -i eth0
#udhcpc -n
if grep -q '/ nfs' /proc/mounts; then if grep -q '/ nfs' /proc/mounts; then
echo "Running via NFS, no ifplugd." echo "Running via NFS: leaving eth0 config alone"
exit 0
fi
if grep -v '#' /etc/network/interfaces | grep -q 'eth0.*dhcp'; then
# run dhcp client in background, as ifup would run in one-shot mode
udhcpc -b -i eth0
else else
echo "Starting ifplugd..." # ifup to use static parameters from /etc/netwrok/interfaces
/usr/sbin/ifplugd -I -f -i eth0 ifup eth0
#Pull up the interface (check static/dynamic config in /etc/network/interfaces)
ifup eth0
fi fi
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment