finished unifying

This commit is contained in:
Kay Marquardt (Gnadelwartz)
2017-07-01 14:24:02 +02:00
parent 4b898707b4
commit 5a4e9302e8
3 changed files with 11 additions and 43 deletions

View File

@ -1,19 +1,22 @@
# firewall-lib.pl
# Unified functions for iptable4-lib and iptable6-lib
# in iptabel4 and iptable6 need onyl to init and call
# Unified functions for firewall4-lib and firewall6-lib
# has to be included from every perl and cgi script
# cgi scripts has also to include firewall4/6-lib based on result of get_ipvx_version()
BEGIN { push(@INC, ".."); };
use WebminCore;
&init_config();
$config{'perpage'} ||= 50; # a value of 0 can cause problems
# set_ipvx_version(version)
# version can be ipv6 or ipv4,
sub set_ipvx_version
{
$ipvx_save=$iptables_save_file;
$ipvx_lib='firewall4-lib.pl';
$ipv4_link='../firewall/';
$ipv6_link='../firewall6/';
$ipv4_link='index.cgi?version=inet4';
$ipv6_link='index.cgi?version=inet6';
$ipv4_active='active';
$ipvx_icmp="";
$ipvx_arg="inet4";

View File

@ -1,16 +1,7 @@
# firewall4-lib.pl
# Functions for parsing iptables-save format files
# include firewall-lib.pl, init, set IP version
BEGIN { push(@INC, ".."); };
use WebminCore;
&init_config();
# include common functions for ipv4 and ipv6
require './firewall-lib.pl';
# has to be included after firewall-lib from every cgi
# ipv4 initialization
$config{'perpage'} ||= 50; # a value of 0 can cause problems
if ($config{'save_file'}) {
# Force use of a different save file, and webmin's functions
$iptables_save_file = $config{'save_file'};

View File

@ -1,19 +1,10 @@
# firewall6-lib.pl
# Functions for parsing ip6tables-save format files
# - help pages
BEGIN { push(@INC, ".."); };
use WebminCore;
&init_config();
# include common functions for ipv4 and ipv6
require './firewall-lib.pl';
# has to be included after firewall-lib from every cgi
# ipv6 initialization
$config{'perpage'} ||= 50; # a value of 0 can cause problems
if ($config{'save_file'}) {
if ($config{'save_file6'}) {
# Force use of a different save file, and webmin's functions
$ip6tables_save_file = $config{'save_file'};
$ip6tables_save_file = $config{'save6_file'};
}
else {
if (-r "$module_root_directory/$gconfig{'os_type'}-lib.pl") {
@ -66,22 +57,5 @@ foreach my $w (split(/,/, $_[0])) {
return 1;
}
# renamed functions
# pass current args to original
sub get_ip6tables_save
{
&get_iptables_save;
}
sub ip6tables_save
{
&iptables_save;
}
sub by_string_for_ip6tables
{
&by_string_for_iptables;
}
1;