From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 040D31FF0ED for ; Mon, 27 Jul 2026 15:55:56 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id B9587214EF; Mon, 27 Jul 2026 15:55:50 +0200 (CEST) From: Lukas Sichert To: pve-devel@lists.proxmox.com Subject: [PATCH network v4 2/6] sdn: simple: enable force_forwarding for ipv6 forwarding to subnets Date: Mon, 27 Jul 2026 15:55:03 +0200 Message-ID: <20260727135509.14588-3-l.sichert@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260727135509.14588-1-l.sichert@proxmox.com> References: <20260727135509.14588-1-l.sichert@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1785160482268 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.083 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_LOW -0.7 Sender listed at https://www.dnswl.org/, low trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: EM27IP2BWITPP5UMXCI7RPSSZPOVV5W2 X-Message-ID-Hash: EM27IP2BWITPP5UMXCI7RPSSZPOVV5W2 X-MailFrom: l.sichert@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Lukas Sichert X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Simple zones can route ipv6 subnet traffic through a VNet bridge. Until now, this depended on global ipv6 forwarding state, which also changes Router Advertisement handling for the whole host. Use the per-interface 'force_forwarding' setting instead. For ipv6 subnets that need forwarding, generate post-up/post-down commands for both the VNet interface and the outgoing interface. Update the expected SDN interface output in the zone tests accordingly. Signed-off-by: Lukas Sichert --- src/PVE/Network/SDN/Zones/SimplePlugin.pm | 25 ++++++++++++++++++- .../simple/ipv4v6/expected_sdn_interfaces | 4 +++ .../simple/ipv6snat/expected_sdn_interfaces | 4 +++ 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/PVE/Network/SDN/Zones/SimplePlugin.pm b/src/PVE/Network/SDN/Zones/SimplePlugin.pm index 347eee9..854a761 100644 --- a/src/PVE/Network/SDN/Zones/SimplePlugin.pm +++ b/src/PVE/Network/SDN/Zones/SimplePlugin.pm @@ -149,7 +149,30 @@ sub generate_sdn_config { push @iface_config, "mtu $mtu" if $mtu; push @iface_config, "alias $alias" if $alias; push @iface_config, "ip-forward on" if $enable_forward_v4; - push @iface_config, "ip6-forward on" if $enable_forward_v6; + + if ($enable_forward_v6) { + push @iface_config, "ip6-forward on"; + + push @iface_config, "post-up echo 1 > /proc/sys/net/ipv6/conf/$vnetid/force_forwarding"; + push @iface_config, "post-down echo 0 > /proc/sys/net/ipv6/conf/$vnetid/force_forwarding"; + + #find outgoing ipv6 interface + my ($outip, $outiface); + eval { + ($outip, $outiface) = + PVE::Network::SDN::Zones::Plugin::get_local_route_ip('2001:4860:4860::8888'); + }; + if ($@) { + my $msg = "interface for IPv6 forwarding could not be resolved: $@"; + log_warn($msg); + } elsif ($outiface) { + push @iface_config, + "post-up echo 1 > /proc/sys/net/ipv6/conf/$outiface/force_forwarding"; + push @iface_config, + "post-down echo 0 > /proc/sys/net/ipv6/conf/$outiface/force_forwarding"; + } + + } push @{ $config->{$vnetid} }, @iface_config; diff --git a/src/test/zones/simple/ipv4v6/expected_sdn_interfaces b/src/test/zones/simple/ipv4v6/expected_sdn_interfaces index 34ed5db..61b7258 100644 --- a/src/test/zones/simple/ipv4v6/expected_sdn_interfaces +++ b/src/test/zones/simple/ipv4v6/expected_sdn_interfaces @@ -9,3 +9,7 @@ iface myvnet bridge_fd 0 ip-forward on ip6-forward on + post-up echo 1 > /proc/sys/net/ipv6/conf/myvnet/force_forwarding + post-down echo 0 > /proc/sys/net/ipv6/conf/myvnet/force_forwarding + post-up echo 1 > /proc/sys/net/ipv6/conf/vmbr0/force_forwarding + post-down echo 0 > /proc/sys/net/ipv6/conf/vmbr0/force_forwarding diff --git a/src/test/zones/simple/ipv6snat/expected_sdn_interfaces b/src/test/zones/simple/ipv6snat/expected_sdn_interfaces index 5f6d40b..4df3371 100644 --- a/src/test/zones/simple/ipv6snat/expected_sdn_interfaces +++ b/src/test/zones/simple/ipv6snat/expected_sdn_interfaces @@ -11,3 +11,7 @@ iface myvnet bridge_stp off bridge_fd 0 ip6-forward on + post-up echo 1 > /proc/sys/net/ipv6/conf/myvnet/force_forwarding + post-down echo 0 > /proc/sys/net/ipv6/conf/myvnet/force_forwarding + post-up echo 1 > /proc/sys/net/ipv6/conf/vmbr0/force_forwarding + post-down echo 0 > /proc/sys/net/ipv6/conf/vmbr0/force_forwarding -- 2.47.3