Am 03.12.2014 um 21:37 schrieb Michael Biebl:
 As for the operstate check: I did remove this check, because even with a
> cable plugged in, I got "down"  when running "cat
> /sys/class/net/eth0/operstate" in my test VM, so /etc/init.d/networking
> never configured the interface, so this check proved to be not really
> reliable.
> 
> Andrew, I guess what you want to do here is have some kind of link
> detection? Why is that part of the init script an not ifup itself?

I've been looking into this further and wanted to find out, why
/sys/class/net/eth0/operstate did not report the correct state in my
virtualbox VM.

For that I ran "ip monitor" and unplugged/plugged the cable, but nothing
did show up. Then it dawned to me, that I actually need to up the
interface first, before link detection works.

If I run
# ip link set eth0 up

Then "ip link show" or "cat /sys/class/net/eth0/operstate" reports the
correct link state.

Andrew, I guess if you want to put the operstate check back, you'll also
need to first up the interface via "ip link set <interface> up".

Btw, is there a reason, that this check is only run for allow-hotplug
interfaces?

Armin, does a patch like the attached one fix the issue for you? I.e.,
if the cable is plugged, it correctly configures the network and does
nothing during boot if the cable is unplugged?

-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?
diff --git a/init.d/networking b/init.d/networking
index d98fe1a..cf16927 100755
--- a/init.d/networking
+++ b/init.d/networking
@@ -105,7 +105,9 @@ ifup_hotplug () {
 			    do
 				    link=${iface##:*}
 				    link=${link##.*}
-				    if [ -e "/sys/class/net/$link" ]
+				    ip link set "$iface" up || true
+				    if [ -e "/sys/class/net/$link" ] && [ "$(cat /sys/class/net/$link/oper
+state)" = up ]
 				    then
 					    echo "$iface"
 				    fi

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to