Skip to content

Commit

Permalink
[dualtor-aa] Fix arp flux of soc IPs (sonic-net#15266)
Browse files Browse the repository at this point in the history
If the test server is Ubuntu 22.04, SoC IP ARP flux is observed on the
DUTs for dualtor-aa testbed.

Let's enable `arp_filter` to prevent this.

Signed-off-by: Longxiang Lyu <[email protected]>
  • Loading branch information
lolyu authored Nov 4, 2024
1 parent 31112c0 commit 2781540
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ansible/roles/vm_set/library/vm_topology.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,10 @@ def delete_network_namespace(self):
if os.path.exists("/var/run/netns/%s" % self.netns):
VMTopology.cmd("ip netns delete %s" % self.netns)

def enable_arp_filter_netns(self):
"""ENable ARP filter in the netns."""
VMTopology.cmd("ip netns exec %s sysctl -w net.ipv4.conf.all.arp_filter=1" % self.netns)

def add_mgmt_port_to_netns(self, mgmt_bridge, mgmt_ip, mgmt_gw, mgmt_ipv6_addr=None, mgmt_gw_v6=None):
if VMTopology.intf_not_exists(MGMT_PORT_NAME, netns=self.netns):
self.add_br_if_to_netns(
Expand Down Expand Up @@ -1989,6 +1993,9 @@ def main():

if net.netns:
net.add_network_namespace()
# Let's enable arp_filter in the netns
# to prevent arp flux
net.enable_arp_filter_netns()
net.add_mgmt_port_to_netns(
mgmt_bridge, netns_mgmt_ip_addr, ptf_mgmt_ip_gw)
net.enable_netns_loopback()
Expand Down Expand Up @@ -2135,6 +2142,9 @@ def main():

if net.netns:
net.add_network_namespace()
# Let's enable arp_filter in the netns
# to prevent arp flux
net.enable_arp_filter_netns()
net.add_mgmt_port_to_netns(
mgmt_bridge, netns_mgmt_ip_addr, ptf_mgmt_ip_gw)
net.enable_netns_loopback()
Expand Down

0 comments on commit 2781540

Please sign in to comment.