Skip to content

Commit

Permalink
Fix rp_filter for WIndows (works with the previous sysctls) (#278)
Browse files Browse the repository at this point in the history
  • Loading branch information
Skazza94 committed Mar 25, 2024
1 parent a57bc9f commit 7907143
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/Kathara/manager/docker/DockerMachine.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,17 @@ def create(self, machine: Machine) -> None:
machine.add_meta("bridge_connected", True)

# Sysctl params to pass to the container creation
#sysctl_parameters = {RP_FILTER_NAMESPACE % x: 0 for x in ["all", "default", "lo"]}
sysctl_parameters = {RP_FILTER_NAMESPACE % "default": 0}
def rp_filter_default_only() -> dict:
return {RP_FILTER_NAMESPACE % "default": 0}

#if first_machine_iface:
# sysctl_parameters[RP_FILTER_NAMESPACE % "eth0"] = 0
def rp_filter_all() -> dict:
sysctls = {RP_FILTER_NAMESPACE % x: 0 for x in ["all", "default", "lo"]}
if first_machine_iface:
sysctls[RP_FILTER_NAMESPACE % "eth0"] = 0

return sysctls

sysctl_parameters = utils.exec_by_platform(rp_filter_default_only, rp_filter_all, rp_filter_default_only)

sysctl_parameters["net.ipv4.ip_forward"] = 1
sysctl_parameters["net.ipv4.icmp_ratelimit"] = 0
Expand Down

0 comments on commit 7907143

Please sign in to comment.