commit: 41b7cec34068d42fce55e40091637eea90cc00b1
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Wed Feb 24 19:54:10 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Wed Feb 24 19:54:10 2016 +0000
URL: https://gitweb.gentoo.org/proj/kvm-tools.git/commit/?id=41b7cec3
Migrate from ifconfig commands to ip commands
Some systems may have the ifconfig compatibility scripts diabled.
This uses all ip commands instead.
app-emulation/qemu-init-scripts/files/qtap-manipulate | 9 +++++----
1 file 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 ))