diff options
Diffstat (limited to 'usr/local')
-rwxr-xr-x | usr/local/www/firewall_nat_out.php | 20 | ||||
-rwxr-xr-x | usr/local/www/firewall_nat_out_edit.php | 55 |
2 files changed, 60 insertions, 15 deletions
diff --git a/usr/local/www/firewall_nat_out.php b/usr/local/www/firewall_nat_out.php index a24caa8..38db4fe 100755 --- a/usr/local/www/firewall_nat_out.php +++ b/usr/local/www/firewall_nat_out.php @@ -130,7 +130,9 @@ if ($_GET['act'] == "del") { <tr> <td width="10%" class="listhdrr">Interface</td> <td width="20%" class="listhdrr">Source</td> + <td width="20%" class="listhdrr">Source Port</td> <td width="20%" class="listhdrr">Destination</td> + <td width="20%" class="listhdrr">NAT Port</td> <td width="20%" class="listhdrr">Target</td> <td width="25%" class="listhdr">Description</td> <td width="5%" class="list"></td> @@ -150,6 +152,14 @@ if ($_GET['act'] == "del") { </td> <td class="listr"> <?php + if (!$natent['sourceport']) + echo "*"; + else + echo $natent['sourceport']; + ?> + </td> + <td class="listr"> + <?php if (isset($natent['destination']['any'])) echo "*"; else { @@ -161,6 +171,14 @@ if ($_GET['act'] == "del") { </td> <td class="listr"> <?php + if (!$natent['natport']) + echo "*"; + else + echo $natent['natport']; + ?> + </td> + <td class="listr"> + <?php if (!$natent['target']) echo "*"; else @@ -175,7 +193,7 @@ if ($_GET['act'] == "del") { </tr> <?php $i++; endforeach; ?> <tr> - <td class="list" colspan="5"></td> + <td class="list" colspan="7"></td> <td class="list"> <a href="firewall_nat_out_edit.php"><img src="plus.gif" width="17" height="17" border="0"></a></td> </tr> </table> diff --git a/usr/local/www/firewall_nat_out_edit.php b/usr/local/www/firewall_nat_out_edit.php index bdf0242..2fca182 100755 --- a/usr/local/www/firewall_nat_out_edit.php +++ b/usr/local/www/firewall_nat_out_edit.php @@ -61,8 +61,10 @@ function network_to_pconfig($adr, &$padr, &$pmask, &$pnot) { if (isset($id) && $a_out[$id]) { list($pconfig['source'],$pconfig['source_subnet']) = explode('/', $a_out[$id]['source']['network']); + $pconfig['sourceport'] = $a_out[$id]['sourceport']; network_to_pconfig($a_out[$id]['destination'], $pconfig['destination'], $pconfig['destination_subnet'], $pconfig['destination_not']); + $pconfig['natport'] = $a_out[$id]['natport']; $pconfig['target'] = $a_out[$id]['target']; $pconfig['interface'] = $a_out[$id]['interface']; if (!$pconfig['interface']) @@ -97,6 +99,9 @@ if ($_POST) { if ($_POST['source_subnet'] && !is_numericint($_POST['source_subnet'])) { $input_errors[] = "A valid source bit count must be specified."; } + if ($_POST['sourceport'] && !is_numericint($_POST['sourceport'])) { + $input_errors[] = "A valid source port must be specified."; + } if ($_POST['destination_type'] != "any") { if ($_POST['destination'] && !is_ipaddr($_POST['destination'])) { $input_errors[] = "A valid destination must be specified."; @@ -107,7 +112,10 @@ if ($_POST) { } if ($_POST['destination_type'] != "any") { if ($_POST['destination_not']) - $input_errors[] = "Negating destination address of \"any\" is invalid."; + $input_errors[] = "Negating destination address of \"any\" is invalid."; + } + if ($_POST['natport'] && !is_numericint($_POST['natport'])) { + $input_errors[] = "A valid NAT port must be specified."; } if ($_POST['target'] && !is_ipaddr($_POST['target'])) { @@ -155,6 +163,7 @@ if ($_POST) { if (!$input_errors) { $natent = array(); $natent['source']['network'] = $osn; + $natent['sourceport'] = $_POST['sourceport']; $natent['descr'] = $_POST['descr']; $natent['target'] = $_POST['target']; $natent['interface'] = $_POST['interface']; @@ -164,6 +173,8 @@ if ($_POST) { else $natent['destination']['network'] = $ext; + $natent['natport'] = $_POST['natport']; + if (isset($_POST['destination_not']) && $ext != "any") $natent['destination']['not'] = true; @@ -234,18 +245,30 @@ function typesel_change() { <tr> <td width="22%" valign="top" class="vncellreq">Source</td> <td width="78%" class="vtable"> -<input name="source" type="text" class="formfld" id="source" size="20" value="<?=htmlspecialchars($pconfig['source']);?>"> - - / - <select name="source_subnet" class="formfld" id="source_subnet"> - <?php for ($i = 32; $i >= 0; $i--): ?> - <option value="<?=$i;?>" <?php if ($i == $pconfig['source_subnet']) echo "selected"; ?>> - <?=$i;?> - </option> - <?php endfor; ?> - </select> - <br> - <span class="vexpl">Enter the source network for the outbound NAT mapping.</span></td> + <table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td>Address: </td + <td><input name="source" type="text" class="formfld" id="source" size="20" value="<?=htmlspecialchars($pconfig['source']);?>">/<select name="source_subnet" class="formfld" id="source_subnet"> + <?php for ($i = 32; $i >= 0; $i--): ?> + <option value="<?=$i;?>" <?php if ($i == $pconfig['source_subnet']) echo "selected"; ?>> + <?=$i;?> + </option> + <?php endfor; ?> + </select></td> + </tr> + <tr> + <td> </td> + <td><span class="vexpl">Enter the source network for the outbound NAT mapping.</span></td> + </tr> + <tr> + <td>Port: </td> + <td><input name="sourceport" type="text" class="formfld" id="sourceport" size="5" value="<?=htmlspecialchars($pconfig['sourceport']);?>"></td> + </tr> + <tr> + <td> </td> + <td><span class="vexpl">Enter the source port for the outbound NAT mapping.</span></td> + </tr> + </table></td> </tr> <tr> <td width="22%" valign="top" class="vncellreq">Destination</td> @@ -281,7 +304,11 @@ function typesel_change() { <td><span class="vexpl">Enter the destination network for the outbound NAT mapping.</span></td> </tr> - </table></td> + <tr> + <td>NAT port: </td> + <td><input name="natport" type="text" class="formfld" id="natport" size="5" value="<?=htmlspecialchars($pconfig['natport']);?>"> (leave blank for any)</td> + </tr> + </table> </tr> <tr> <td valign="top" class="vncell">Target</td> |