summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Dolbec <dolsen@gentoo.org>2016-02-24 11:54:10 -0800
committerBrian Dolbec <dolsen@gentoo.org>2016-02-24 11:54:10 -0800
commit41b7cec34068d42fce55e40091637eea90cc00b1 (patch)
tree9aaf641f84ac5c180cf45ba377273e8f90ee708a
parenttypo (diff)
downloadkvm-tools-41b7cec34068d42fce55e40091637eea90cc00b1.tar.gz
kvm-tools-41b7cec34068d42fce55e40091637eea90cc00b1.tar.bz2
kvm-tools-41b7cec34068d42fce55e40091637eea90cc00b1.zip
Migrate from ifconfig commands to ip commands
Some systems may have the ifconfig compatibility scripts diabled. This uses all ip commands instead.
-rw-r--r--app-emulation/qemu-init-scripts/files/qtap-manipulate9
1 files changed, 5 insertions, 4 deletions
diff --git a/app-emulation/qemu-init-scripts/files/qtap-manipulate b/app-emulation/qemu-init-scripts/files/qtap-manipulate
index 41ab0ca..bf89dcb 100644
--- a/app-emulation/qemu-init-scripts/files/qtap-manipulate
+++ b/app-emulation/qemu-init-scripts/files/qtap-manipulate
@@ -12,9 +12,9 @@ has() {
}
find_available_node() {
- local val=$(ifconfig -a | grep -i ^qtap | cut -d: -f1)
+ local val=$(ip addr | grep -i '.*: qtap' | cut -d: -f2)
local pos=0
- while has qtap${pos} $val; do
+ while has qtap${pos} ${val##*()}; do
pos=$(( $pos + 1 ))
done
echo qtap${pos}
@@ -25,12 +25,13 @@ create_node() {
shift
tunctl -b -t "${qtap}" "$@" > /dev/null || die "tunctl failed"
brctl addif br0 "${qtap}" || die "brctl failed"
- ifconfig "${qtap}" up 0.0.0.0 promisc || die "ifconfig failed"
+ ip link set "${qtap}" up || die "ip link set ${qtap} failed"
+ ip link set "${qtap}" promisc on || die "ip link set ${qtap} promiscuos mode failed"
}
destroy_node() {
issue=
- ifconfig ${1} down || { echo "ifconfig failed";issue=1; }
+ ip link set ${1} down || { echo "ip link set ${1} down failed";issue=1; }
brctl delif br0 ${1} || { echo "brctl failed";issue=2; }
tunctl -d ${1} > /dev/null || { echo "tunctl failed";issue=3;}
[ -n "${issue}" ] && exit $(( $issue ))