. /etc/init.d/functions
+MAX_NICS=3
+
function create_bridge() {
local name=$1
echo "ONBOOT=yes" >> $FILE
echo "BRIDGE=$name" >> $FILE
- COUNT=0
+ COUNT=1
NICS=`ls -1 /sys/class/net/ | grep -v lo | grep -v sit`
# The rest
for NIC in $NICS
COUNT=$(($COUNT+1))
# We only want at max two DHCP interfaces.
# switch and ethX
- if [ $COUNT -ge 1 ]; then
+ if [ $COUNT -ge $MAX_NICS ]; then
break;
fi
done
echo "BOOTPROTO=dhcp" >> $FILE
COUNT=$(($COUNT+1))
# We only want at max two DHCP interfaces.
- if [ $COUNT -ge 2 ]; then
+ if [ $COUNT -ge $MAX_NICS ]; then
break;
fi
done
echo "NM_CONTROLLED=no" >> $FILE
COUNT=$(($COUNT+1))
# We only want at max two interfaces.
- if [ $COUNT -ge 2 ]; then
+ if [ $COUNT -ge $MAX_NICS ]; then
break;
fi
done