public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Stefan Hanreich <s.hanreich@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH pve-firewall v8 3/5] sdn: always include SDN configuration
Date: Tue, 19 Nov 2024 16:36:08 +0100	[thread overview]
Message-ID: <20241119153610.228658-4-s.hanreich@proxmox.com> (raw)
In-Reply-To: <20241119153610.228658-1-s.hanreich@proxmox.com>

If the cluster configuration does not exist, but in other firewall
configuration files there are rules referencing SDN IPsets, validation
for those rules fails, because the cluster configuration does not
contain the SDN IPSets. This is because generic_fw_config_parser
returns an empty hash when there is no cluster configuration file.

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
---
 src/PVE/Firewall.pm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/PVE/Firewall.pm b/src/PVE/Firewall.pm
index 6437db0..7636798 100644
--- a/src/PVE/Firewall.pm
+++ b/src/PVE/Firewall.pm
@@ -3658,6 +3658,9 @@ sub load_clusterfw_conf {
     my ($filename) = @_;
 
     $filename = $clusterfw_conf_filename if !defined($filename);
+
+    my $sdn_conf = load_sdn_conf();
+
     my $empty_conf = {
 	rules => [],
 	options => {},
@@ -3666,12 +3669,16 @@ sub load_clusterfw_conf {
 	group_comments => {},
 	ipset => {} ,
 	ipset_comments => {},
-	sdn => load_sdn_conf(),
+	sdn => $sdn_conf,
     };
 
     my $cluster_conf = generic_fw_config_parser($filename, $empty_conf, $empty_conf, 'cluster');
     $set_global_log_ratelimit->($cluster_conf->{options});
 
+    if (!$cluster_conf->{sdn}) {
+	$cluster_conf->{sdn} = $sdn_conf;
+    }
+
     return $cluster_conf;
 }
 
-- 
2.39.5


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


  parent reply	other threads:[~2024-11-19 15:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-19 15:36 [pve-devel] [PATCH docs/firewall/manager v8 0/5] autogenerate ipsets for sdn objects Stefan Hanreich
2024-11-19 15:36 ` [pve-devel] [PATCH pve-firewall v8 1/5] add support for loading sdn firewall configuration Stefan Hanreich
2024-11-19 15:36 ` [pve-devel] [PATCH pve-firewall v8 2/5] ipsets: return sdn ipsets from api Stefan Hanreich
2024-11-19 15:36 ` Stefan Hanreich [this message]
2024-11-19 15:36 ` [pve-devel] [PATCH pve-manager v8 4/5] firewall: add sdn scope to IPRefSelector Stefan Hanreich
2024-11-19 15:36 ` [pve-devel] [PATCH pve-docs v8 5/5] sdn: add documentation for firewall integration Stefan Hanreich
2024-11-19 16:00 ` [pve-devel] applied-series: [PATCH docs/firewall/manager v8 0/5] autogenerate ipsets for sdn objects Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241119153610.228658-4-s.hanreich@proxmox.com \
    --to=s.hanreich@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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