From 63c00fa78fd96ee2807a0299844aaa4228245cb1 Mon Sep 17 00:00:00 2001 From: Andrewmatilde Date: Thu, 28 Jul 2022 13:54:09 +0800 Subject: [PATCH] fix bug on arp_filter (#55) Signed-off-by: andrewmatilde --- Cargo.lock | 6 +++--- chaos-tproxy-controller/src/proxy/net/bridge.rs | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 07f26c9..6d5113b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -128,7 +128,7 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chaos-tproxy" -version = "0.5.2" +version = "0.5.3" dependencies = [ "anyhow", "arp-toolkit", @@ -177,7 +177,7 @@ dependencies = [ [[package]] name = "chaos-tproxy-controller" -version = "0.5.2" +version = "0.5.3" dependencies = [ "anyhow", "arp-toolkit", @@ -226,7 +226,7 @@ dependencies = [ [[package]] name = "chaos-tproxy-proxy" -version = "0.5.2" +version = "0.5.3" dependencies = [ "anyhow", "arp-toolkit", diff --git a/chaos-tproxy-controller/src/proxy/net/bridge.rs b/chaos-tproxy-controller/src/proxy/net/bridge.rs index c521915..d332c84 100644 --- a/chaos-tproxy-controller/src/proxy/net/bridge.rs +++ b/chaos-tproxy-controller/src/proxy/net/bridge.rs @@ -90,6 +90,8 @@ impl NetEnv { let rp_filter_v2 = format!("net.ipv4.conf.{}.rp_filter=0", &self.veth2); let rp_filter_v3 = format!("net.ipv4.conf.{}.rp_filter=0", &self.veth3); let arp_filter_br1 = format!("net.ipv4.conf.{}.arp_filter=1", &self.bridge1); + let arp_filter_v1 = format!("net.ipv4.conf.{}.arp_filter=1", &self.veth1); + let arp_filter_dev = format!("net.ipv4.conf.{}.arp_filter=1", &self.device); let cmdvv = vec![ bash_c(save_dns), ip_netns_add(&self.netns), @@ -99,6 +101,8 @@ impl NetEnv { ip_link_add_veth_peer(&self.veth4, None, &self.veth3, Some(&self.netns)), ip_link_set_up(&self.bridge1), vec!["sysctl", "-w", &arp_filter_br1], + vec!["sysctl", "-w", &arp_filter_v1], + vec!["sysctl", "-w", &arp_filter_dev], ip_link_set_up(&self.veth1), ip_netns(&self.netns, ip_link_set_up(&self.veth2)), ip_netns(&self.netns, ip_link_set_up(&self.bridge2)),