aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk>2005-06-02 12:40:53 +0000
committercl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk>2005-06-02 12:40:53 +0000
commit9ed4cfb2cad4fe16f26e37e9aff13f6d8eb63289 (patch)
tree90d2d2b0e33bb70f71a6fa39a4597adf61a59693
parent47b5bccd2f4a48a2e62bfc78350ad592fb0676dc (diff)
downloadxen-9ed4cfb2cad4fe16f26e37e9aff13f6d8eb63289.tar.gz
xen-9ed4cfb2cad4fe16f26e37e9aff13f6d8eb63289.tar.bz2
xen-9ed4cfb2cad4fe16f26e37e9aff13f6d8eb63289.zip
bitkeeper revision 1.1637 (429efe55wJJIZHFiBeWAvMfzBaNppw)
network: - remove route added by setting addr/netmask on new interface - do exact match on interface names (eth0 matches veth0 otherwise) Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
-rwxr-xr-xtools/examples/network27
1 files changed, 17 insertions, 10 deletions
diff --git a/tools/examples/network b/tools/examples/network
index 4a2cb36249..537bbe3dab 100755
--- a/tools/examples/network
+++ b/tools/examples/network
@@ -72,6 +72,12 @@ s/inet/ip addr add/
s@\([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+/[0-9]\+\)@\1@
s/${src}/dev ${dst}/
" | sh -e
+ # Remove automatic routes on destionation device
+ ip route list | sed -ne "
+/dev ${dst}\( \|$\)/ {
+ s/^/ip route del /
+ p
+}" | sh -e
}
# Usage: del_addrs src
@@ -95,16 +101,17 @@ transfer_routes () {
# List all routes and grep the ones with $src in.
# Stick 'ip route del' on the front to delete.
# Change $src to $dst and use 'ip route add' to add.
- ip route list | grep ${src} | sed -e "
-h
-s/^/ip route del /
-P
-g
-s/${src}/${dst}/
-s/^/ip route add /
-P
-d
-" | sh -e
+ ip route list | sed -ne "
+/dev ${src}\( \|$\)/ {
+ h
+ s/^/ip route del /
+ P
+ g
+ s/${src}/${dst}/
+ s/^/ip route add /
+ P
+ d
+}" | sh -e
}
# Usage: create_bridge bridge