From ec9ff239a7f7b27fafc6258e67b108d3062a5ecf Mon Sep 17 00:00:00 2001 From: Stefan Schantl Date: Sat, 22 Apr 2023 09:45:27 +0200 Subject: [PATCH] rules.pl: Call the customsrvgrp loader in case a set should be loaded. Signed-off-by: Stefan Schantl --- config/firewall/rules.pl | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/config/firewall/rules.pl b/config/firewall/rules.pl index a528a78a2..c122e0d43 100644 --- a/config/firewall/rules.pl +++ b/config/firewall/rules.pl @@ -896,7 +896,24 @@ sub get_protocol_options { } } elsif ($dst_ports_mode eq "cust_srvgrp") { - push(@options, &fwlib::get_srvgrp_port($dst_ports, uc($protocol))); + # Convert the protcol into upper case format. + my $uc_proto = uc($protocol); + + my $portoptions = &fwlib::get_srvgrp_port($dst_ports, $uc_proto); + + # Call function to load the port set. + if($portoptions =~ /-m set/) { + # Generate the set name. + my $setname = "$dst_ports" . "_" . "$uc_proto"; + + # Dynamically register the setloader for the setname. + ®ister_set_loader("load_customsrvgrp", "$setname"); + + # Call functio to load the set. + &load_set($setname); + } + + push(@options, $portoptions); } } } -- 2.39.5