diff --git a/firewall/firewall-lib.pl b/firewall/firewall-lib.pl index 1cb4511e6..208e07afa 100755 --- a/firewall/firewall-lib.pl +++ b/firewall/firewall-lib.pl @@ -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"; diff --git a/firewall/firewall4-lib.pl b/firewall/firewall4-lib.pl index c4becc425..19873cd40 100755 --- a/firewall/firewall4-lib.pl +++ b/firewall/firewall4-lib.pl @@ -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'}; diff --git a/firewall/firewall6-lib.pl b/firewall/firewall6-lib.pl index 188e20f99..8f54b3119 100755 --- a/firewall/firewall6-lib.pl +++ b/firewall/firewall6-lib.pl @@ -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;