Fix code which finds the default interface if there are static routes.

The current code will break if there are multiple scope global routes
since the "ip route list default" command doesn't use "default" as a
filter, and will output multiple devices which breaks the rest of the
script.
Also make the vif/xenbr/eth naming consistent, i.e. if your default
network interface is eth1, you get vif1 and xenbr1.

Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
This commit is contained in:
cl349@firebug.cl.cam.ac.uk committed 2006-05-08 10:36:13 +01:00
1 parent fe913cb392
commit 3bd47fb5b6
1 file changed
+1 -2
+1 -2
View File
@@ -59,9 +59,8 @@ dir=$(dirname "$0")
findCommand "$@"
evalVariables "$@"
vifnum=${vifnum:-0}
vifnum=${vifnum:-$(ip route list | awk '/^default / { sub(/eth/,"",$NF); print $NF }')}
bridge=${bridge:-xenbr${vifnum}}
netdev=${netdev:-$(ip route list default scope global| awk '{ print $NF }')}
netdev=${netdev:-eth${vifnum}}
antispoof=${antispoof:-no}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.