From 0a3c881e27531e219fac8fdcedddccb2c56afdcb Mon Sep 17 00:00:00 2001
From: Guido Trotter <ultrotter@google.com>
Date: Thu, 24 Sep 2009 10:50:59 +0100
Subject: [PATCH] KVM nic script: enable interface forwarding

If forwarding is enabled globally this is a no-op. If instead it's
enabled only for some special interfaces where instance traffic has to
go to/comes from (for example a gre tunnel) then it's useful to
explicitely enable it for the instances interfaces as well.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
---
 lib/hypervisor/hv_kvm.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/hypervisor/hv_kvm.py b/lib/hypervisor/hv_kvm.py
index a2bca1e69..d835945f4 100644
--- a/lib/hypervisor/hv_kvm.py
+++ b/lib/hypervisor/hv_kvm.py
@@ -174,7 +174,9 @@ class KVMHypervisor(hv_base.BaseHypervisor):
       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)
     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