--to-source can be followed by just a :port

This commit is contained in:
Jamie Cameron
2015-03-29 21:47:13 -07:00
parent ec4f05ec5f
commit 0a2eb1d520
2 changed files with 3 additions and 2 deletions

View File

@@ -155,7 +155,7 @@ if (($table->{'name'} eq 'nat' && $rule->{'chain'} ne 'PREROUTING' &&
&can_jump("SNAT")) {
if ($rule->{'j'}->[1] eq 'SNAT') {
if ($rule->{'to-source'}->[1] =~
/^([0-9\.]+)(\-([0-9\.]+))?(:(\d+)(\-(\d+))?)?$/) {
/^([0-9\.]+)?(\-([0-9\.]+))?(:(\d+)(\-(\d+))?)?$/) {
$sipfrom = $1;
$sipto = $3;
$spfrom = $5;

View File

@@ -116,7 +116,8 @@ else {
if ($table->{'name'} eq 'nat' && $rule->{'chain'} ne 'PREROUTING' &&
$rule->{'chain'} ne 'OUTPUT') {
if ($rule->{'j'}->[1] eq 'SNAT' && !$in{'snatdef'}) {
&check_ipaddress($in{'sipfrom'}) ||
(!$in{'sipfrom'} && !$in{'sipto'}) ||
&check_ipaddress($in{'sipfrom'}) ||
&error($text{'save_esipfrom'});
!$in{'sipto'} || &check_ipaddress($in{'sipto'}) ||
&error($text{'save_esipto'});