Allow from IP to be missing in --to-destination option

This commit is contained in:
Jamie Cameron
2014-06-13 14:21:28 -07:00
parent db3afde505
commit 3095e29054
2 changed files with 7 additions and 1 deletions

View File

@@ -132,6 +132,12 @@ if (($table->{'name'} eq 'nat' && $rule->{'chain'} ne 'POSTROUTING') &&
$dpfrom = $5;
$dpto = $7;
}
elsif ($rule->{'to-destination'}->[1] =~ /^(:(\d+)(\-(\d+))?)?$/) {
$dipfrom = "";
$dipto = "";
$dpfrom = $2;
$dpto = $4;
}
}
print &ui_table_row($text{'edit_dnat'},
&ui_radio("dnatdef", $dipfrom eq "" ? 1 : 0,

View File

@@ -89,7 +89,7 @@ else {
}
if ($table->{'name'} eq 'nat' && $rule->{'chain'} ne 'POSTROUTING') {
if ($rule->{'j'}->[1] eq 'DNAT' && !$in{'dnatdef'}) {
&check_ipaddress($in{'dipfrom'}) ||
!$in{'dipfrom'} || &check_ipaddress($in{'dipfrom'}) ||
&error($text{'save_edipfrom'});
!$in{'dipto'} || &check_ipaddress($in{'dipto'}) ||
&error($text{'save_edipto'});