From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 23A501FF142 for ; Fri, 19 Jun 2026 17:40:32 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 6C84E117C6; Fri, 19 Jun 2026 17:40:29 +0200 (CEST) From: Lukas Sichert To: pve-devel@lists.proxmox.com Subject: [PATCH network v3 2/5] sdn: simple: enable force_forwarding for ipv6 forwarding to subnets Date: Fri, 19 Jun 2026 17:40:02 +0200 Message-ID: <20260619154017.167720-3-l.sichert@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260619154017.167720-1-l.sichert@proxmox.com> References: <20260619154017.167720-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: 1781883619496 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.243 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment 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: FOL3JXGS4THOG5KA5V67SVVL4HQKTWKX X-Message-ID-Hash: FOL3JXGS4THOG5KA5V67SVVL4HQKTWKX 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. Track interfaces that already received 'force_forwarding' commands to avoid duplicates when multiple subnets share the same outgoing path. Update the expected SDN interface output in the zone tests accordingly. Signed-off-by: Lukas Sichert --- src/PVE/Network/SDN/Zones/SimplePlugin.pm | 16 ++++++++++++++-- .../zones/simple/ipv4v6/expected_sdn_interfaces | 4 ++++ .../simple/ipv6snat/expected_sdn_interfaces | 4 ++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/PVE/Network/SDN/Zones/SimplePlugin.pm b/src/PVE/Network/SDN/Zones/SimplePlugin.pm index f5cd18e..47ed170 100644 --- a/src/PVE/Network/SDN/Zones/SimplePlugin.pm +++ b/src/PVE/Network/SDN/Zones/SimplePlugin.pm @@ -140,7 +140,20 @@ 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"; + + #find outgoing ipv6 interface + my ($outip, $outiface) = + PVE::Network::SDN::Zones::Plugin::get_local_route_ip('2001:4860:4860::8888'); + + 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 @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"; + } push @{ $config->{$vnetid} }, @iface_config; @@ -168,4 +181,3 @@ sub get_mtu { } 1; - diff --git a/src/test/zones/simple/ipv4v6/expected_sdn_interfaces b/src/test/zones/simple/ipv4v6/expected_sdn_interfaces index 34ed5db..54e5664 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/vmbr0/force_forwarding + post-down echo 0 > /proc/sys/net/ipv6/conf/vmbr0/force_forwarding + post-up echo 1 > /proc/sys/net/ipv6/conf/myvnet/force_forwarding + post-down echo 0 > /proc/sys/net/ipv6/conf/myvnet/force_forwarding diff --git a/src/test/zones/simple/ipv6snat/expected_sdn_interfaces b/src/test/zones/simple/ipv6snat/expected_sdn_interfaces index 5f6d40b..46f2441 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/vmbr0/force_forwarding + post-down echo 0 > /proc/sys/net/ipv6/conf/vmbr0/force_forwarding + post-up echo 1 > /proc/sys/net/ipv6/conf/myvnet/force_forwarding + post-down echo 0 > /proc/sys/net/ipv6/conf/myvnet/force_forwarding -- 2.47.3