diff --git a/firewall/firewall4-lib.pl b/firewall/firewall4-lib.pl index f8cc78747..a9fce3b7f 100755 --- a/firewall/firewall4-lib.pl +++ b/firewall/firewall4-lib.pl @@ -59,5 +59,12 @@ foreach my $w (split(/\s+/, $_[0])) { return 1; } +# check_ipvx_ipaddress(ipv4) +# Validates an IPv4 address +sub check_ipvx_ipaddress +{ +return &check_ipaddress(@_); +} + 1; diff --git a/firewall/firewall6-lib.pl b/firewall/firewall6-lib.pl index dbb2a2a0e..6be744960 100755 --- a/firewall/firewall6-lib.pl +++ b/firewall/firewall6-lib.pl @@ -57,5 +57,12 @@ foreach my $w (split(/,/, $_[0])) { return 1; } +# check_ipvx_ipaddress(ipv6) +# Validates an IPv6 address +sub check_ipvx_ipaddress +{ +return &check_ip6address(@_); +} + 1; diff --git a/firewall/save_rule.cgi b/firewall/save_rule.cgi index 79b3ae948..92755f294 100755 --- a/firewall/save_rule.cgi +++ b/firewall/save_rule.cgi @@ -96,9 +96,9 @@ else { } if ($table->{'name'} eq 'nat' && $rule->{'chain'} ne 'POSTROUTING') { if ($rule->{'j'}->[1] eq 'DNAT' && !$in{'dnatdef'}) { - !$in{'dipfrom'} || &check_ipaddress($in{'dipfrom'}) || + !$in{'dipfrom'} || &check_ipvx_address($in{'dipfrom'})|| &error($text{'save_edipfrom'}); - !$in{'dipto'} || &check_ipaddress($in{'dipto'}) || + !$in{'dipto'} || &check_ipvx_address($in{'dipto'}) || &error($text{'save_edipto'}); local $v = $in{'dipfrom'}; $v .= "-".$in{'dipto'} if ($in{'dipto'}); @@ -124,9 +124,9 @@ else { $rule->{'chain'} ne 'OUTPUT') { if ($rule->{'j'}->[1] eq 'SNAT' && !$in{'snatdef'}) { (!$in{'sipfrom'} && !$in{'sipto'}) || - &check_ipaddress($in{'sipfrom'}) || + &check_ipvx_address($in{'sipfrom'}) || &error($text{'save_esipfrom'}); - !$in{'sipto'} || &check_ipaddress($in{'sipto'}) || + !$in{'sipto'} || &check_ipvx_address($in{'sipto'}) || &error($text{'save_esipto'}); local $v = $in{'sipfrom'}; $v .= "-".$in{'sipto'} if ($in{'sipto'});