[ltp] Question on ifplugd and ACPI suspend

Michael Olbrich linux-thinkpad@linux-thinkpad.org
Thu, 29 Sep 2005 21:25:32 +0200


On Wed, Sep 28, 2005 at 10:32:06AM +0000, Bob Alexander wrote:
> I like ifplugd which monitors my eth0 and brings up/down the interface 
> if its plugged/unplugged.
> 
> There is one case which is not working though.
> 
> 1) Interface is up and running at home with address A
> 2) I suspend
> 3) Plug into my office LAN
> 4) Address remains A
> 
> At this point if I manually unplug the cable and then plug back in 
> ifplugd correctly intervenes and assigns address B to eth0.
> 
> Can I force ifplugd to check things after a suspend (using swsusp2).

First one question: how are you getting the addess?
With dhcp I would allways stop and start the interface. Otherwise you
can easily run into trouble with expired leases etc.
In debian that would probably be:

/etc/init.d/ifplugd stop
ifdown eth0
<suspend>
/etc/init.d/ifplugd start

After all, compared to "suspend to disk" starting an interface is really
fast.
If you don't want to use that, you could use guessnet to check in which
network you are and only restart, when it changes:

OLD=`guessnet eth0`
<suspend>
NEW=`guessnet eth0`
if [ x$OLD != x$NEW ]; then
    /etc/init.d/ifplugd stop
    ifdown eth0
    /etc/init.d/ifplugd start
fi

michael