mirror of
https://github.com/webmin/webmin.git
synced 2025-08-16 14:51:18 +00:00
finished unifying
This commit is contained in:
@ -1,19 +1,22 @@
|
|||||||
# firewall-lib.pl
|
# firewall-lib.pl
|
||||||
# Unified functions for iptable4-lib and iptable6-lib
|
# Unified functions for firewall4-lib and firewall6-lib
|
||||||
# in iptabel4 and iptable6 need onyl to init and call
|
# 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, ".."); };
|
BEGIN { push(@INC, ".."); };
|
||||||
use WebminCore;
|
use WebminCore;
|
||||||
&init_config();
|
&init_config();
|
||||||
|
|
||||||
|
$config{'perpage'} ||= 50; # a value of 0 can cause problems
|
||||||
|
|
||||||
# set_ipvx_version(version)
|
# set_ipvx_version(version)
|
||||||
# version can be ipv6 or ipv4,
|
# version can be ipv6 or ipv4,
|
||||||
sub set_ipvx_version
|
sub set_ipvx_version
|
||||||
{
|
{
|
||||||
$ipvx_save=$iptables_save_file;
|
$ipvx_save=$iptables_save_file;
|
||||||
$ipvx_lib='firewall4-lib.pl';
|
$ipvx_lib='firewall4-lib.pl';
|
||||||
$ipv4_link='../firewall/';
|
$ipv4_link='index.cgi?version=inet4';
|
||||||
$ipv6_link='../firewall6/';
|
$ipv6_link='index.cgi?version=inet6';
|
||||||
$ipv4_active='active';
|
$ipv4_active='active';
|
||||||
$ipvx_icmp="";
|
$ipvx_icmp="";
|
||||||
$ipvx_arg="inet4";
|
$ipvx_arg="inet4";
|
||||||
|
@ -1,16 +1,7 @@
|
|||||||
# firewall4-lib.pl
|
# firewall4-lib.pl
|
||||||
# Functions for parsing iptables-save format files
|
# has to be included after firewall-lib from every cgi
|
||||||
# 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';
|
|
||||||
|
|
||||||
# ipv4 initialization
|
# ipv4 initialization
|
||||||
$config{'perpage'} ||= 50; # a value of 0 can cause problems
|
|
||||||
if ($config{'save_file'}) {
|
if ($config{'save_file'}) {
|
||||||
# Force use of a different save file, and webmin's functions
|
# Force use of a different save file, and webmin's functions
|
||||||
$iptables_save_file = $config{'save_file'};
|
$iptables_save_file = $config{'save_file'};
|
||||||
|
@ -1,19 +1,10 @@
|
|||||||
# firewall6-lib.pl
|
# firewall6-lib.pl
|
||||||
# Functions for parsing ip6tables-save format files
|
# has to be included after firewall-lib from every cgi
|
||||||
# - help pages
|
|
||||||
|
|
||||||
BEGIN { push(@INC, ".."); };
|
|
||||||
use WebminCore;
|
|
||||||
&init_config();
|
|
||||||
|
|
||||||
# include common functions for ipv4 and ipv6
|
|
||||||
require './firewall-lib.pl';
|
|
||||||
|
|
||||||
# ipv6 initialization
|
# ipv6 initialization
|
||||||
$config{'perpage'} ||= 50; # a value of 0 can cause problems
|
if ($config{'save_file6'}) {
|
||||||
if ($config{'save_file'}) {
|
|
||||||
# Force use of a different save file, and webmin's functions
|
# Force use of a different save file, and webmin's functions
|
||||||
$ip6tables_save_file = $config{'save_file'};
|
$ip6tables_save_file = $config{'save6_file'};
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (-r "$module_root_directory/$gconfig{'os_type'}-lib.pl") {
|
if (-r "$module_root_directory/$gconfig{'os_type'}-lib.pl") {
|
||||||
@ -66,22 +57,5 @@ foreach my $w (split(/,/, $_[0])) {
|
|||||||
return 1;
|
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;
|
1;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user