mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Add static-port option for outbound NAT
This commit is contained in:
parent
d1d6fdf30b
commit
f6ded420af
@ -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;
|
||||
}
|
||||
|
||||
@ -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>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user