Browse code

a more proper default nic selection criteria

look at all interfaces that ip link shows as being up, then filter
them for ^e or ^p devices. Should hold even after the bridges get
built.

Change-Id: If6b1e623f9d146c2430dc8a4a007997290b90846

Sean Dague authored on 2014/06/06 08:06:05
Showing 1 changed files
... ...
@@ -81,7 +81,12 @@ FLAT_NETWORK_BRIDGE_DEFAULT=br100
81 81
 # the new p* interfaces, then basically picks the first
82 82
 # alphabetically. It's probably wrong, however it's less wrong than
83 83
 # always using 'eth0' which doesn't exist on new Linux distros at all.
84
-GUEST_INTERFACE_DEFAULT=$(route -n | awk '{print $8}' | grep ^[ep] | sort | head -1)
84
+GUEST_INTERFACE_DEFAULT=$(ip link \
85
+    | grep 'state UP' \
86
+    | awk '{print $2}' \
87
+    | sed 's/://' \
88
+    | grep ^[ep] \
89
+    | head -1)
85 90
 
86 91
 # Get hypervisor configuration
87 92
 # ----------------------------