From e014f1d0e6f5188b2827c549a40b4bddacbc50cd Mon Sep 17 00:00:00 2001 From: Guido Trotter <ultrotter@google.com> Date: Wed, 21 Oct 2009 18:44:07 -0400 Subject: [PATCH] KVMHypervisor: configure v6 parameters on nic In routing mode we are tweaking a few parameters on the interface. With this patch we'll tweak both the v4 and v6 ones. Signed-off-by: Guido Trotter <ultrotter@google.com> Reviewed-by: Michael Hanselmann <hansmi@google.com> --- lib/hypervisor/hv_kvm.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/hypervisor/hv_kvm.py b/lib/hypervisor/hv_kvm.py index a8439bb7e..25e3d8d65 100644 --- a/lib/hypervisor/hv_kvm.py +++ b/lib/hypervisor/hv_kvm.py @@ -177,10 +177,16 @@ class KVMHypervisor(hv_base.BaseHypervisor): " dev $INTERFACE\n") else: script.write(" /sbin/ip route replace $IP/32 dev $INTERFACE\n") - interface_proxy_arp = "/proc/sys/net/ipv4/conf/$INTERFACE/proxy_arp" - interface_forwarding = "/proc/sys/net/ipv4/conf/$INTERFACE/forwarding" - script.write(" /bin/echo 1 > %s\n" % interface_proxy_arp) - script.write(" /bin/echo 1 > %s\n" % interface_forwarding) + 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) + script.write(" echo 1 > %s/proxy_arp\n" % interface_v4_conf) + script.write(" echo 1 > %s/forwarding\n" % interface_v4_conf) + script.write(" fi\n") + script.write(" if [ -d %s ]; then\n" % interface_v6_conf) + script.write(" echo 1 > %s/proxy_ndp\n" % interface_v6_conf) + script.write(" echo 1 > %s/forwarding\n" % interface_v6_conf) + script.write(" fi\n") script.write("fi\n\n") # As much as we'd like to put this in our _ROOT_DIR, that will happen to be # mounted noexec sometimes, so we'll have to find another place. -- GitLab