Commit 8f00440f authored by Simon Redman's avatar Simon Redman

Enable IPv6 forwarding

The code says the solution is a hack, but I no longer remember why
parent 93fc74a4
......@@ -29,6 +29,21 @@ SYSCTL_LINE_TEMPLATEs as desired
"""
SYSCTL_COMMAND_TEMPLATE = "sudo sysctl {lines}"
SYSCTL_SEG6_LINE_TEMPLATE = "net.ipv6.conf.{iface}.seg6_enabled=1"
SYSCTL_FORWARDING_LINE_TEMPLETE = "net.ipv6.conf.{iface}.forwarding=1"
def build_forwarding_sysctl_command(interfaces: List[str]):
"""
Construct the sysctl command to enable ipv6 forwarding on all of the listed interfaces
:param interfaces: list of interface names
:return: sysctl configuration command
"""
lines = []
for interface in interfaces:
lines.append(SYSCTL_FORWARDING_LINE_TEMPLETE.format(iface=interface))
return SYSCTL_COMMAND_TEMPLATE.format(lines=str.join(" ", lines))
def build_seg6_sysctl_command(interfaces: List[str]):
......@@ -42,6 +57,11 @@ def build_seg6_sysctl_command(interfaces: List[str]):
for interface in interfaces:
lines.append(SYSCTL_SEG6_LINE_TEMPLATE.format(iface=interface))
# Hack - Do this better when in less of a hurry
# Also enable ipv6 forwarding
for interface in interfaces:
lines.append(SYSCTL_FORWARDING_LINE_TEMPLETE.format(iface=interface))
return SYSCTL_COMMAND_TEMPLATE.format(lines=str.join(" ", lines))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment