From: Stéphane Graber Date: Mon, 9 Mar 2015 16:14:29 +0000 (-0400) Subject: Prefer iproute over ifconfig X-Git-Tag: lxc-2.0.0.beta1~348 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=50066f4f7e8d53fe7b7a3acb039c7db5573f42dc;p=thirdparty%2Flxc.git Prefer iproute over ifconfig Signed-off-by: Stéphane Graber Acked-by: Serge E. Hallyn --- diff --git a/config/init/common/lxc-net.in b/config/init/common/lxc-net.in index dcbe15565..988d2f907 100644 --- a/config/init/common/lxc-net.in +++ b/config/init/common/lxc-net.in @@ -35,29 +35,31 @@ _netmask2cidr () } ifdown() { - which ifconfig >/dev/null 2>&1 - if [ $? = 0 ]; then - ifconfig $1 down - return - fi which ip >/dev/null 2>&1 if [ $? = 0 ]; then ip link set dev $1 down + return fi -} - -ifup() { which ifconfig >/dev/null 2>&1 if [ $? = 0 ]; then - ifconfig $1 $2 netmask $3 up + ifconfig $1 down return fi +} + +ifup() { which ip >/dev/null 2>&1 if [ $? = 0 ]; then MASK=`_netmask2cidr ${LXC_NETMASK}` CIDR_ADDR="${LXC_ADDR}/${MASK}" ip addr add ${CIDR_ADDR} dev $1 ip link set dev $1 up + return + fi + which ifconfig >/dev/null 2>&1 + if [ $? = 0 ]; then + ifconfig $1 $2 netmask $3 up + return fi } diff --git a/src/lxc/lxc-restore-net b/src/lxc/lxc-restore-net index 1725dc3a9..6ae3c1988 100755 --- a/src/lxc/lxc-restore-net +++ b/src/lxc/lxc-restore-net @@ -17,7 +17,7 @@ while true; do if [ "$CRTOOLS_SCRIPT_ACTION" = "network-unlock" ]; then brctl addif $bridge $veth - ifconfig $veth 0.0.0.0 up + ip link set dev $veth up fi i=$((i+1))