mirror of
https://github.com/webmin/webmin.git
synced 2026-03-20 08:40:24 +00:00
In IPv6 mode, check for the correct kind of IP for NAT https://sourceforge.net/p/webadmin/bugs/5451/
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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'});
|
||||
|
||||
Reference in New Issue
Block a user