public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH manager/network v3 0/7] fix #5066: make generated snat rules flushable
@ 2026-11-26 15:28 Lukas Sichert
  2026-11-26 15:28 ` [PATCH network v3 1/7] style: zones: use fully qualified JSONSchema calls for standard options Lukas Sichert
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Lukas Sichert @ 2026-11-26 15:28 UTC (permalink / raw)
  To: pve-devel; +Cc: Lukas Sichert

Disabling SNAT for an existing subnet can leave its iptables rule
active. This happens because 'ifreload -a' does not execute down hooks
when reloading an existing interface [1].

Move generated Simple (including dedicated VRF) and EVPN SNAT rules from
POSTROUTING into a dedicated chain. Post-up hooks prepare the complete
new ruleset in PROXMOX-SDN-NEW while the existing PROXMOX-SDN chain
remains active. After ifreload, replace the old chain with the prepared
one. This removes stale rules without affecting unrelated POSTROUTING
rules or leaving a window during which SNAT does not work.

At boot, networking.service prepares the temporary chain directly with
the post-up commands in /etc/network/interfaces.d/sdn. Therefore, also
activate it from pve-sdn-commit when no SDN changes are pending.

Maintainer Note:
This series requires a version bump of pve-network and a dependency bump
on it in pve-manager, as that calls the new apply_new_snat_rules().

Notes:
- Rules generated by an older version sit directly in POSTROUTING and
  cannot be told apart from user-set rules, so they are not flushed with
  the new chain and are only gone after a reboot.
- A manual ifreload populates PROXMOX-SDN-NEW without switching it over.
  This may leave stale rules, which are cleaned up with the next SDN
  apply or reboot.

[1] https://manpages.debian.org/testing/ifupdown2/ifreload.8.en.html
Link: https://bugzilla.proxmox.com/show_bug.cgi?id=5066

changes from v2 to v3 (thanks @Stefan):
- prepare rules in a temporary chain before replacing the active chain,
  avoiding an interruption of SNAT
- share SNAT rule generation between Simple and EVPN zones
- activate rules generated during boot
- also handle zones with a dedicated VRF, which masquerade on their
  uplinks

changes from v1 to v2 (thanks @Stefan):
- rebase on top of master
- create chain only when '$is_evpn_gateway' is true
- add Links to commits


network:

Lukas Sichert (6):
  style: zones: use fully qualified JSONSchema calls for standard
    options
  fix #5066: zones: factor out SNAT rule generation
  fix #5066: zones: add helper to activate prepared SNAT rules
  fix #5066: evpn: prepare SNAT rules in temporary chain
  fix #5066: simple zone: prepare SNAT rules in temporary chain
  fix #5066: zones: add test for generating and applying SNAT rules

 src/PVE/Network/SDN/Zones.pm                  |  39 +++-
 src/PVE/Network/SDN/Zones/EvpnPlugin.pm       |  31 +--
 src/PVE/Network/SDN/Zones/Plugin.pm           |  58 ++++-
 src/PVE/Network/SDN/Zones/SimplePlugin.pm     |  44 +---
 src/test/Makefile                             |   5 +-
 src/test/run_test_apply_snat.pl               | 209 ++++++++++++++++++
 .../exitnode_snat/expected_sdn_interfaces     |  16 +-
 .../simple/ipv4snat/expected_sdn_interfaces   |   8 +-
 .../simple/ipv6snat/expected_sdn_interfaces   |   8 +-
 .../simple/vrf_snat/expected_sdn_interfaces   |  35 ++-
 10 files changed, 348 insertions(+), 105 deletions(-)
 create mode 100755 src/test/run_test_apply_snat.pl


manager:

Lukas Sichert (1):
  fix #5066: network: activate prepared SDN SNAT rules

 PVE/API2/Network.pm | 1 +
 bin/pve-sdn-commit  | 6 ++++++
 2 files changed, 7 insertions(+)


Summary over all repositories:
  12 files changed, 355 insertions(+), 105 deletions(-)

-- 
Generated by murpp 0.12.0




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-11-26 15:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-26 15:28 [PATCH manager/network v3 0/7] fix #5066: make generated snat rules flushable Lukas Sichert
2026-11-26 15:28 ` [PATCH network v3 1/7] style: zones: use fully qualified JSONSchema calls for standard options Lukas Sichert
2026-11-26 15:29 ` [PATCH network v3 2/7] fix #5066: zones: factor out SNAT rule generation Lukas Sichert
2026-11-26 15:29 ` [PATCH network v3 3/7] fix #5066: zones: add helper to activate prepared SNAT rules Lukas Sichert
2026-11-26 15:29 ` [PATCH network v3 4/7] fix #5066: evpn: prepare SNAT rules in temporary chain Lukas Sichert
2026-11-26 15:29 ` [PATCH network v3 5/7] fix #5066: simple zone: " Lukas Sichert
2026-11-26 15:29 ` [PATCH network v3 6/7] fix #5066: zones: add test for generating and applying SNAT rules Lukas Sichert
2026-11-26 15:29 ` [PATCH manager v3 7/7] fix #5066: network: activate prepared SDN " Lukas Sichert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal