Commit f422613e by Joshua Brunner Committed by Dwight Engen

fix: grep not match interface listed by `ip link list`

Interfaces listed by `ip link list` are prefixed with the index identifier. The pattern "^$BRNAME" does not match. - dependencies to ifconfig and ip removed - wait until interface flagged with IFF_UP Ref: https://github.com/torvalds/linux/blob/master/include/uapi/linux/if.hSigned-off-by: 's avatarJoshua Brunner <j.brunner@nexbyte.com>
parent 2ba5eb93
......@@ -51,28 +51,18 @@ fi
# to start
wait_for_bridge()
{
local BRNAME try flags
[ -f "$sysconfdir"/lxc/default.conf ] || { return 0; }
which ifconfig >/dev/null 2>&1
if [ $? = 0 ]; then
cmd="ifconfig -a"
else
which ip >/dev/null 2>&1
if [ $? = 0 ]; then
cmd="ip link list"
fi
fi
[ -n cmd ] || { return 0; }
BRNAME=`grep '^[ ]*lxc.network.link' "$sysconfdir"/lxc/default.conf | sed 's/^.*=[ ]*//'`
if [ -z "$BRNAME" ]; then
return 0
fi
for try in `seq 1 30`; do
eval $cmd |grep "^$BRNAME" >/dev/null 2>&1
if [ $? = 0 ]; then
return
if [ -r /sys/class/net/$BRNAME/flags ]; then
read flags < /sys/class/net/$BRNAME/flags
[ $((flags & 0x1)) -eq 1 ] && { return 0; }
fi
sleep 1
done
......
Markdown is supported
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