public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Robert Obkircher <r.obkircher@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH proxmox-ve-rs 1/1] firewall: parse preserve_comments host firewall option
Date: Mon, 15 Dec 2025 16:08:48 +0100	[thread overview]
Message-ID: <20251215150906.257151-5-r.obkircher@proxmox.com> (raw)
In-Reply-To: <20251215150906.257151-1-r.obkircher@proxmox.com>

Signed-off-by: Robert Obkircher <r.obkircher@proxmox.com>
---
 proxmox-ve-config/src/firewall/host.rs | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/proxmox-ve-config/src/firewall/host.rs b/proxmox-ve-config/src/firewall/host.rs
index d749442..01ffca2 100644
--- a/proxmox-ve-config/src/firewall/host.rs
+++ b/proxmox-ve-config/src/firewall/host.rs
@@ -34,6 +34,8 @@ pub const HOST_BLOCK_INVALID_TCP_DEFAULT: bool = false;
 pub const HOST_BLOCK_INVALID_CONNTRACK: bool = false;
 /// default setting for logging of invalid conntrack entries
 pub const HOST_LOG_INVALID_CONNTRACK: bool = false;
+/// default setting for preserve_comments
+pub const HOST_PRESERVE_COMMENTS_DEFAULT: bool = false;
 
 #[derive(Debug, Default, Deserialize)]
 #[cfg_attr(test, derive(Eq, PartialEq))]
@@ -82,6 +84,9 @@ pub struct Options {
 
     #[serde(default, deserialize_with = "proxmox_serde::perl::deserialize_bool")]
     tcpflags: Option<bool>,
+
+    #[serde(default, deserialize_with = "proxmox_serde::perl::deserialize_bool")]
+    preserve_comments: Option<bool>,
 }
 
 #[derive(Debug, Default)]
@@ -274,6 +279,13 @@ impl Config {
             Direction::Forward => self.config.options.log_level_forward.unwrap_or_default(),
         }
     }
+
+    pub fn preserve_comments(&self) -> bool {
+        self.config
+            .options
+            .preserve_comments
+            .unwrap_or(HOST_PRESERVE_COMMENTS_DEFAULT)
+    }
 }
 
 #[cfg(test)]
@@ -309,6 +321,7 @@ protection_synflood_rate: 300
 smurf_log_level: notice
 tcp_flags_log_level: nolog
 tcpflags: yes
+preserve_comments: 1
 
 [RULES]
 
@@ -342,6 +355,7 @@ IN ACCEPT -p udp -dport 33 -sport 22 -log warning
                 smurf_log_level: Some(LogLevel::Notice),
                 tcp_flags_log_level: Some(LogLevel::Nolog),
                 tcpflags: Some(true),
+                preserve_comments: Some(true),
             }
         );
 
-- 
2.47.3



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


  parent reply	other threads:[~2025-12-15 15:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-15 15:08 [pve-devel] [PATCH firewall/manager/proxmox{-ve-rs, -firewall} 0/5] fix #7068: show rule comments in iptables and nftables Robert Obkircher
2025-12-15 15:08 ` [pve-devel] [PATCH pve-firewall 1/2] api: firewall: add option to preserve comments Robert Obkircher
2025-12-15 15:08 ` [pve-devel] [PATCH pve-firewall 2/2] fix #7068: show rule comments in iptables output Robert Obkircher
2025-12-15 15:08 ` [pve-devel] [PATCH pve-manager 1/1] ui: firewall: add preserve comments option Robert Obkircher
2025-12-15 15:08 ` Robert Obkircher [this message]
2025-12-15 15:08 ` [pve-devel] [PATCH proxmox-firewall 1/2] fix #7068: show rule comments in nftables output Robert Obkircher
2025-12-15 15:08 ` [pve-devel] [PATCH proxmox-firewall 2/2] firewall: add rule comments to snapshot tests Robert Obkircher

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=20251215150906.257151-5-r.obkircher@proxmox.com \
    --to=r.obkircher@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