From 470ffcb65244a10c53e8da848a32dbb4f54f86ab Mon Sep 17 00:00:00 2001 From: Naredula Janardhana Reddy Date: Wed, 24 Aug 2011 13:01:56 +0530 Subject: [PATCH] bug 11191: Added global config to enable/disable rp_filter for domR. previous commit: d966906374d4a0cb8fa57326a1f7625c871f64fd Test Case-1 : 1) Set network.disable.rpfilter global config to true 2) Restart the domR 3) check the settings reflected in proc filesystem - for public interface like eth2,eth3 : /proc/sys/net/ipv4/conf/eth2/rp_filter should have 0 , and rest other interfaces should have value of 1 Test Case-2 : 1) set network.disable.rpfilter global config to false 2) Restart the domR 3) check the settings reflected in proc filesystem - for public interface like eth2,eth3 : /proc/sys/net/ipv4/conf/eth2/rp_filter should have 1 , and rest other interfaces should also have value of 1 --- .../systemvm/debian/config/etc/init.d/cloud-early-config | 4 ++-- .../router/VirtualNetworkApplianceManagerImpl.java | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/patches/systemvm/debian/config/etc/init.d/cloud-early-config b/patches/systemvm/debian/config/etc/init.d/cloud-early-config index a2bb16527f3..680875213d7 100755 --- a/patches/systemvm/debian/config/etc/init.d/cloud-early-config +++ b/patches/systemvm/debian/config/etc/init.d/cloud-early-config @@ -186,10 +186,10 @@ disable_rpfilter() { disable_rpfilter_domR() { log_it "cloud: disable rp_filter" log_it "disable rpfilter" - sed -i "s/net.ipv4.conf.default.rp_filter.*$/net.ipv4.conf.default.rp_filter = 0/" /etc/sysctl.conf if [ "$DISABLE_RP_FILTER" == "true" ] then - log_it "cloud: disable rp_filter : updating proc" + log_it "cloud: disable rp_filter on public interfaces" +#FIXME : currently public interfaces are assumed as eth2 and eth3. sed -i "s/net.ipv4.conf.eth2.rp_filter.*$/net.ipv4.conf.eth2.rp_filter = 0/" /etc/sysctl.conf sed -i "s/net.ipv4.conf.eth3.rp_filter.*$/net.ipv4.conf.eth3.rp_filter = 0/" /etc/sysctl.conf echo "0" > /proc/sys/net/ipv4/conf/eth2/rp_filter diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java index 15dafc1f439..6ddf387cc1b 100755 --- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java +++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java @@ -1226,7 +1226,15 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian dhcpRange = NetUtils.getDhcpRange(cidr); } } + + String rpValue = _configDao.getValue(Config.NetworkRouterRpFilter.key()); + if (rpValue != null && rpValue.equalsIgnoreCase("true")) { + _disable_rp_filter = true; + }else + { + _disable_rp_filter = false; + } if (router.getRole() == Role.DHCP_USERDATA) { type = "dhcpsrvr"; } else {