[ltp] Re: Question on ifplugd and ACPI suspend
km
linux-thinkpad@linux-thinkpad.org
Thu, 29 Sep 2005 19:52:30 +0200
On 28/09, 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).
>
> Thank you,
> Bob
> --
> The linux-thinkpad mailing list home page is at:
> http://mailman.linux-thinkpad.org/mailman/listinfo/linux-thinkpad
I have the included (below) preup() in my /etc/conf.d/net script which checks
for a link on the interface before bringing it up. I've also got DHCP timeout
set to 5 seconds. I dont like waiting. :)
In detail, I lock at 100base-TX, then check, then sets the interface to autoneg
and check again.
And in my suspend script I just cycle the interface with /etc/init.d/net.eth0
restart. I guess You could also go for the solution to just check for a link
in Your suspend script (when waking up) and restart eth0 if needed.
-------------------------------------------------------------------------------
preup()
{
# Start with 100 full
# mii-tool ${IFACE} -r -R
mii-tool ${IFACE} -F 100baseTX-FD
# Test for link on the interface prior to bringing it up.
if mii-tool ${IFACE} 2> /dev/null | grep -q 'no link'; then
mii-tool ${IFACE} -r -R
sleep 1
# Recheck with autoneg if network is from previous millenium
if mii-tool ${IFACE} 2> /dev/null | grep -q 'no link'; then
ewarn "No link on ${IFACE}, aborting configuration"
return 1
fi
fi
return 0
}
-------------------------------------------------------------------------------
-km