From 52901cd427b5b7a8c52e249f834b6deee89dc77f Mon Sep 17 00:00:00 2001
From: Gerhard Gonter <ggonter@gmail.com>
Date: Wed, 7 May 2025 19:48:00 +0200
Subject: [PATCH] missing close(UFW) caused ufw process to hang as zombie;
 added get_ipv4_cidr_hash; parsing comments in ufw listing

---
 modules/util/Util/ufw.pm | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/modules/util/Util/ufw.pm b/modules/util/Util/ufw.pm
index 748d87a..727539f 100644
--- a/modules/util/Util/ufw.pm
+++ b/modules/util/Util/ufw.pm
@@ -106,6 +106,7 @@ sub status
           elsif ($rst == 3)
           {
             if ($t eq '(log)') { $rule{log}= 1; }
+	    elsif ($t eq '#') { $rule{comment}= join(' ', @t); @t= (); }
             else { push (@{$rule{junk}}, $t) }
           }
         }
@@ -117,6 +118,7 @@ sub status
       }
     }
   }
+  close(UFW);
 
   $self;
 }
@@ -142,6 +144,12 @@ sub get_rule
   return ($self->{rules}->[$number-1]);
 }
 
+sub get_ipv4_cidr_hash
+{
+  my $self= shift;
+  return $self->{src_ipv4_cidr};
+}
+
 sub block
 {
   my $self= shift;
-- 
GitLab