From 8866ec860a32980a838f7a47815ac33142c56028 Mon Sep 17 00:00:00 2001 From: Guido Trotter <ultrotter@google.com> Date: Thu, 22 Oct 2009 10:52:11 -0400 Subject: [PATCH] KVM netscript: add static routes, with no suffix The /32 suffix is useless, since the kernel already assumes single-host, if no suffix is specified. Moreover we prefer these routes to be "static" so that routing daemons, if present, won't mess with them. Signed-off-by: Guido Trotter <ultrotter@google.com> Reviewed-by: Michael Hanselmann <hansmi@google.com> --- lib/hypervisor/hv_kvm.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/hypervisor/hv_kvm.py b/lib/hypervisor/hv_kvm.py index 25e3d8d65..aada45bc7 100644 --- a/lib/hypervisor/hv_kvm.py +++ b/lib/hypervisor/hv_kvm.py @@ -173,10 +173,11 @@ class KVMHypervisor(hv_base.BaseHypervisor): if nic.nicparams[constants.NIC_LINK]: script.write(" while /sbin/ip rule del dev $INTERFACE; do :; done\n") script.write(" /sbin/ip rule add dev $INTERFACE table $LINK\n") - script.write(" /sbin/ip route replace $IP/32 table $LINK" + script.write(" /sbin/ip route replace $IP table $LINK proto static" " dev $INTERFACE\n") else: - script.write(" /sbin/ip route replace $IP/32 dev $INTERFACE\n") + script.write(" /sbin/ip route replace $IP proto static" + " dev $INTERFACE\n") interface_v4_conf = "/proc/sys/net/ipv4/conf/$INTERFACE" interface_v6_conf = "/proc/sys/net/ipv6/conf/$INTERFACE" script.write(" if [ -d %s ]; then\n" % interface_v4_conf) -- GitLab