aboutsummaryrefslogtreecommitdiffstats
path: root/contrail-agent/scripts/vhost-phys.sh
diff options
context:
space:
mode:
Diffstat (limited to 'contrail-agent/scripts/vhost-phys.sh')
-rwxr-xr-xcontrail-agent/scripts/vhost-phys.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/contrail-agent/scripts/vhost-phys.sh b/contrail-agent/scripts/vhost-phys.sh
new file mode 100755
index 0000000..7177eca
--- /dev/null
+++ b/contrail-agent/scripts/vhost-phys.sh
@@ -0,0 +1,7 @@
+#!/bin/sh -e
+#
+# Script used to determine physical interface of vhost0
+
+iface="$1"
+mac=$(cat /sys/class/net/$iface/address)
+vif --list | awk -v mac=$mac -v iface=$iface 'BEGIN { RS="\n\n" }; $3 != iface && $0 ~ "HWaddr:" mac { print $3; exit 0 }'