diff options
-rw-r--r-- | etc/inc/filter.inc | 8 | ||||
-rwxr-xr-x | usr/local/www/firewall_nat_out_edit.php | 11 |
2 files changed, 18 insertions, 1 deletions
diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index ed2ab19..14c190a 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -388,8 +388,14 @@ function filter_nat_rules_generate_if($if, $src = "any", $srcport = "", $dst = " $target = "-> {$tgt}"; } + /* outgoing static-port option, hamachi, Grandstream, VOIP, etc */ + if($staticnatport) + $staticnatport_txt = " static-port"; + else + $staticnatport_txt = ""; + /* Put all the pieces together */ - $natrule = "{$nat} on {$if} from {$src} to {$dst} {$target}\n"; + $natrule = "{$nat} on {$if} from {$src} to {$dst} {$target}{$staticnatport_txt}\n"; return $natrule; } diff --git a/usr/local/www/firewall_nat_out_edit.php b/usr/local/www/firewall_nat_out_edit.php index 3c9fbe0..e26e4dc 100755 --- a/usr/local/www/firewall_nat_out_edit.php +++ b/usr/local/www/firewall_nat_out_edit.php @@ -63,6 +63,7 @@ if (isset($id) && $a_out[$id]) { $pconfig['descr'] = $a_out[$id]['descr']; $pconfig['nonat'] = $a_out[$id]['nonat']; $pconfig['nosync'] = isset($a_out[$id]['nosync']); + $pconfig['staticnatport'] = isset($a_out[$id]['staticnatport']); } else { $pconfig['source_subnet'] = 24; $pconfig['destination'] = "any"; @@ -179,6 +180,12 @@ if ($_POST) { $natent['target'] = $_POST['target']; $natent['interface'] = $_POST['interface']; + /* static-port */ + if(isset($_POST['staticnatport'])) + $natent['staticnatport'] = true; + else + unset($natent['staticnatport']); + /* if user has selected not nat, set it here */ if(isset($_POST['nonat'])) $natent['nonat'] = true; @@ -387,6 +394,10 @@ function sourcesel_change() { <td>Port: </td> <td><input name="natport" type="text" class="formfld" id="natport" size="5" value="<?=htmlspecialchars($pconfig['natport']);?>"></td> </tr> + <tr> + <td>Static-port: </td> + <td><input name="staticnatport" type="text" class="formfld" id="staticnatport" size="5" value="<?=htmlspecialchars($pconfig['staticnatport']);?>"></td> + </tr> <tr><td> </td><td> <span class="vexpl">Enter the source port for the outbound NAT mapping.</span> </td></tr> |