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 1/1] fix #5925: vnet: add parsing logic for log_level_forward
Date: Mon, 25 Nov 2024 15:30:42 +0100	[thread overview]
Message-ID: <20241125143042.136616-1-s.hanreich@proxmox.com> (raw)

We currently don't parse the log_level_forward option from the vnet
configuration, which leads to the value not being returned from the
API and always showing up as the default nolog value.

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

diff --git a/src/PVE/Firewall.pm b/src/PVE/Firewall.pm
index 1db6c51..533f2a2 100644
--- a/src/PVE/Firewall.pm
+++ b/src/PVE/Firewall.pm
@@ -3053,12 +3053,17 @@ sub parse_vnetfw_option {
 
     my ($opt, $value);
 
+    my $loglevels = "emerg|alert|crit|err|warning|notice|info|debug|nolog";
+
     if ($line =~ m/^(enable):\s*(\d+)\s*$/i) {
 	$opt = lc($1);
 	$value = int($2);
     } elsif ($line =~ m/^(policy_forward):\s*(ACCEPT|DROP)\s*$/i) {
 	$opt = lc($1);
 	$value = uc($2);
+    } elsif ($line =~ m/^(log_level_forward):\s*($loglevels)\s*$/i) {
+	$opt = lc($1);
+	$value = lc($2);
     } else {
 	die "can't parse option '$line'\n"
     }
-- 
2.39.5


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


             reply	other threads:[~2024-11-25 14:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-25 14:30 Stefan Hanreich [this message]
2024-11-25 20:58 ` [pve-devel] applied: " 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=20241125143042.136616-1-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