incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edi...@apache.org
Subject [9/10] git commit: Port ranges for PF rules: public port start should be equal to ending port start; the same applies to end ports
Date Fri, 28 Sep 2012 00:24:19 GMT
Port ranges for PF rules: public port start should be equal to ending port start; the same
applies to end ports


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/aa8048aa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/aa8048aa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/aa8048aa

Branch: refs/heads/4.0
Commit: aa8048aa049c0c282f6d1be35ce6873d85eb6c0b
Parents: 2392f65
Author: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Authored: Fri Sep 14 11:38:07 2012 -0700
Committer: Edison Su <sudison@gmail.com>
Committed: Thu Sep 27 17:21:08 2012 -0700

----------------------------------------------------------------------
 .../api/commands/CreatePortForwardingRuleCmd.java  |    1 -
 .../com/cloud/network/rules/RulesManagerImpl.java  |    9 +++++++++
 2 files changed, 9 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/aa8048aa/api/src/com/cloud/api/commands/CreatePortForwardingRuleCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/CreatePortForwardingRuleCmd.java b/api/src/com/cloud/api/commands/CreatePortForwardingRuleCmd.java
index 55f0b23..3f3915a 100644
--- a/api/src/com/cloud/api/commands/CreatePortForwardingRuleCmd.java
+++ b/api/src/com/cloud/api/commands/CreatePortForwardingRuleCmd.java
@@ -66,7 +66,6 @@ public class CreatePortForwardingRuleCmd extends BaseAsyncCreateCmd implements
P
     @Parameter(name = ApiConstants.PRIVATE_END_PORT, type = CommandType.INTEGER, required
= false, description = "the ending port of port forwarding rule's private port range")
     private Integer privateEndPort;
 
-
     @Parameter(name = ApiConstants.PUBLIC_START_PORT, type = CommandType.INTEGER, required
= true, 
             description = "the starting port of port forwarding rule's public port range")
     private Integer publicStartPort;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/aa8048aa/server/src/com/cloud/network/rules/RulesManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/rules/RulesManagerImpl.java b/server/src/com/cloud/network/rules/RulesManagerImpl.java
index 6e57009..3a61db9 100755
--- a/server/src/com/cloud/network/rules/RulesManagerImpl.java
+++ b/server/src/com/cloud/network/rules/RulesManagerImpl.java
@@ -244,6 +244,15 @@ public class RulesManagerImpl implements RulesManager, RulesService,
Manager {
             } else {
                 dstIp = new Ip(guestNic.getIp4Address());
             }
+            
+            //source start port and source dest port should be the same. The same applies
to dest ports
+            if (rule.getSourcePortStart().intValue() != rule.getDestinationPortStart()) {
+                throw new InvalidParameterValueException("Private port start should be equal
to public port start", null);
+            }
+            
+            if (rule.getSourcePortEnd().intValue() != rule.getDestinationPortEnd()) {
+                throw new InvalidParameterValueException("Private port end should be equal
to public port end", null);
+            }
 
             Transaction txn = Transaction.currentTxn();
             txn.start();


Mime
View raw message