View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 971 | RackTables | IPv4/IPv6/SLB | public | 2013-07-30 11:44 | 2019-01-08 11:48 |
| Reporter | TimWilkes | Assigned To | MWilkinson | ||
| Priority | normal | Severity | tweak | Reproducibility | have not tried |
| Status | closed | Resolution | fixed | ||
| Product Version | 0.20.5 | ||||
| Target Version | 0.20.7 | Fixed in Version | 0.20.7 | ||
| Summary | 971: Patch to IPv4Nat to allow static natting. | ||||
| Description | The attached patch adds static nat translations to racktables. The localport and remote port are set to 0. Also fixes inconsistency in the validation. Requires the database be modified using: alter table IPv4NAT change proto proto enum('TCP','UDP','ALL'); | ||||
| Tags | No tags attached. | ||||
| Attached Files | RackTablesStaticNat.patch (3,477 bytes)
diff -Naur RackTables-0.20.5-base/wwwroot/inc/database.php RackTables-0.20.5-dev/wwwroot/inc/database.php
--- RackTables-0.20.5-base/wwwroot/inc/database.php 2013-06-23 22:50:37.000000000 +0100
+++ RackTables-0.20.5-dev/wwwroot/inc/database.php 2013-07-30 09:51:57.794775524 +0100
@@ -4211,11 +4211,15 @@
throw new InvalidArgException ('localip_bin', $localip_bin, "Non-existant ip");
if (NULL === getIPv4AddressNetworkId ($remoteip_bin))
throw new InvalidArgException ('remoteip_bin', $remoteip_bin, "Non-existant ip");
- if ( ($localport <= 0) or ($localport >= 65536) )
- throw new InvalidArgException ('localport', $localport, "invaild port");
- if ( ($remoteport <= 0) or ($remoteport >= 65536) )
- throw new InvalidArgException ('remoteport', $remoteport, "invaild port");
-
+ if ( ($proto == "ALL") ) {
+ $localport =0;
+ $remoteport=0;
+ } else {
+ if ( ($localport <= 0) or ($localport >= 65536) )
+ throw new InvalidArgException ('localport', $localport, "invaild port");
+ if ( ($remoteport <= 0) or ($remoteport >= 65536) )
+ throw new InvalidArgException ('remoteport', $remoteport, "invaild port");
+ }
return usePreparedInsertBlade
(
'IPv4NAT',
diff -Naur RackTables-0.20.5-base/wwwroot/inc/interface.php RackTables-0.20.5-dev/wwwroot/inc/interface.php
--- RackTables-0.20.5-base/wwwroot/inc/interface.php 2013-06-23 22:50:37.000000000 +0100
+++ RackTables-0.20.5-dev/wwwroot/inc/interface.php 2013-07-11 14:51:34.854774817 +0100
@@ -3056,7 +3104,7 @@
echo "<tr align='center'><td>";
printImageHREF ('add', 'Add new NAT rule', TRUE);
echo '</td><td>';
- printSelect (array ('TCP' => 'TCP', 'UDP' => 'UDP'), array ('name' => 'proto'));
+ printSelect (array ('TCP' => 'TCP', 'UDP' => 'UDP','ALL' => 'ALL'), array ('name' => 'proto'));
echo "<select name='localip' tabindex=1>";
foreach ($alloclist as $ip_bin => $alloc)
diff -Naur RackTables-0.20.5-base/wwwroot/inc/ophandlers.php RackTables-0.20.5-dev/wwwroot/inc/ophandlers.php
--- RackTables-0.20.5-base/wwwroot/inc/ophandlers.php 2013-06-23 22:50:37.000000000 +0100
+++ RackTables-0.20.5-dev/wwwroot/inc/ophandlers.php 2013-07-30 10:00:55.114778670 +0100
@@ -646,7 +646,10 @@
assertUIntArg ('object_id');
$localip_bin = assertIPv4Arg ('localip');
$remoteip_bin = assertIPv4Arg ('remoteip');
- assertUIntArg ('localport');
+ if ($_REQUEST['proto'] != "ALL") {
+ assertUIntArg ('localport');
+ assertUIntArg ('remoteport'); // Originally missing
+ }
assertStringArg ('proto');
assertStringArg ('description', TRUE);
$remoteport = isset ($_REQUEST['remoteport']) ? $_REQUEST['remoteport'] : '';
@@ -673,8 +676,10 @@
assertUIntArg ('object_id');
$localip_bin = assertIPv4Arg ('localip');
$remoteip_bin = assertIPv4Arg ('remoteip');
- assertUIntArg ('localport');
- assertUIntArg ('remoteport');
+ if ($_REQUEST['proto'] != "ALL") {
+ assertUIntArg ('localport');
+ assertUIntArg ('remoteport');
+ }
assertStringArg ('proto');
deletePortForwarding
@@ -695,10 +700,12 @@
assertUIntArg ('object_id');
$localip_bin = assertIPv4Arg ('localip');
$remoteip_bin = assertIPv4Arg ('remoteip');
- assertUIntArg ('localport');
- assertUIntArg ('remoteport');
+ if ($_REQUEST['proto'] != "ALL") {
+ assertUIntArg ('localport');
+ assertUIntArg ('remoteport');
+ }
assertStringArg ('proto');
- assertStringArg ('description');
+ assertStringArg ('description', TRUE); // Updated to allow empty strings when updating.
updatePortForwarding
(
| ||||
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2013-07-30 11:44 | TimWilkes | New Issue | |
| 2013-07-30 11:44 | TimWilkes | Status | new => assigned |
| 2013-07-30 11:44 | TimWilkes | Assigned To | => andriyanov |
| 2013-07-30 11:44 | TimWilkes | File Added: Racktables-20.5-staticnat.patch | |
| 2013-07-30 11:48 | TimWilkes | File Added: RackTablesStaticNat.patch | |
| 2013-07-30 11:48 | TimWilkes | Note Added: 0001661 | |
| 2013-07-31 11:17 | TimWilkes | File Deleted: Racktables-20.5-staticnat.patch | |
| 2013-11-20 17:06 | infrastation | Note Added: 0001957 | |
| 2013-11-20 17:06 | infrastation | Assigned To | andriyanov => MWilkinson |
| 2013-11-25 15:23 | infrastation | Target Version | => 0.20.7 |
| 2014-01-04 19:34 | adoom42 | Status | assigned => closed |
| 2014-01-04 19:34 | adoom42 | Resolution | open => fixed |
| 2014-01-04 19:34 | adoom42 | Fixed in Version | => 0.20.7 |
| 2019-01-08 11:48 | MWilkinson | Source_changeset_attached | => RackTables master 9067c07f |