network: introduce per-interface IP forwarding settings

This deprecates IPForward= setting, which unconditionally controled
the global setting, even though it is a setting in .network file.

Instead, this introduces new IPv4Forwarding= and IPv6Forwarding=
settings both in .network and networkd.conf.
If these settings are specified in a .network file, then the
per-interface forwarding setting will be configured.
If specified in networkd.conf, then the global IP forwarding setting will
be configured.

Closes #30648.
This commit is contained in:
Yu Watanabe
2024-02-22 19:24:12 +00:00
committed by Luca Boccassi
parent 755fdfffa0
commit 3976c43092
24 changed files with 197 additions and 125 deletions
@@ -5,7 +5,7 @@ Name=client-peer
[Network]
Address=192.168.6.2/24
DHCPServer=yes
IPForward=ipv4
IPv4Forwarding=yes
IPv6AcceptRA=no
[DHCPServer]
@@ -4,5 +4,5 @@ Name=client
[Network]
DHCP=yes
IPForward=ipv4
IPv4Forwarding=yes
IPv6AcceptRA=no
@@ -4,5 +4,5 @@ Name=server-peer
[Network]
Address=192.168.5.2/24
IPForward=ipv4
IPv4Forwarding=yes
IPv6AcceptRA=no
@@ -4,7 +4,7 @@ Name=server
[Network]
Address=192.168.5.1/24
IPForward=ipv4
IPv4Forwarding=yes
DHCPServer=yes
IPv6AcceptRA=no
@@ -9,7 +9,6 @@ IPv6ProxyNDPAddress=2607:5300:203:5215:3::1
IPv6ProxyNDPAddress=2607:5300:203:5215:2::1
IPv6ProxyNDPAddress=2607:5300:203:5215:1::1
IPv6AcceptRA=no
IPForward=yes
Address=66.70.129.136/32
Address=66.70.129.142/32
Address=66.70.129.143/32
+2 -1
View File
@@ -3,7 +3,8 @@
Name=dummy98
[Network]
IPForward=yes
IPv4Forwarding=yes
IPv6Forwarding=yes
IPv6DuplicateAddressDetection=3
IPv6HopLimit=5
IPv4ProxyARP=yes
@@ -4,7 +4,6 @@ Name=bridge99
[Network]
VLAN=vlan99
IPForward=yes
ConfigureWithoutCarrier=yes
LLDP=yes
IPv6AcceptRA=false
@@ -4,7 +4,6 @@ Name=test1
[Network]
IPv6AcceptRA=no
IPForward=yes
Bridge=bridge99
LinkLocalAddressing=no
EmitLLDP=nearest-bridge
@@ -5223,6 +5223,9 @@ class NetworkdRATests(unittest.TestCase, Utilities):
start_networkd()
self.wait_online('veth99:routable', 'veth-peer:degraded')
# IPv6SendRA=yes implies IPv6Forwarding.
self.check_ipv6_sysctl_attr('veth-peer', 'forwarding', '1')
output = resolvectl('dns', 'veth99')
print(output)
self.assertRegex(output, 'fe80::')