Repository: cloudstack
Updated Branches:
  refs/heads/master c76302cdd -> fce2880b9


CLOUDSTACK-2694: Able to configure duplicate firewall rule with protocol and no 
ports

Signed-off-by: Jayapal <jaya...@apache.org>


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

Branch: refs/heads/master
Commit: fce2880b9f20a372dd0a005c4575ffab526bac0b
Parents: c76302c
Author: namita.chaudhari <namita.chaudh...@sungard.com>
Authored: Tue Aug 5 09:16:29 2014 +0000
Committer: Jayapal <jaya...@apache.org>
Committed: Tue Aug 5 17:57:54 2014 +0530

----------------------------------------------------------------------
 server/src/com/cloud/network/firewall/FirewallManagerImpl.java | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fce2880b/server/src/com/cloud/network/firewall/FirewallManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/firewall/FirewallManagerImpl.java 
b/server/src/com/cloud/network/firewall/FirewallManagerImpl.java
index dd928d8..50ac9d1 100644
--- a/server/src/com/cloud/network/firewall/FirewallManagerImpl.java
+++ b/server/src/com/cloud/network/firewall/FirewallManagerImpl.java
@@ -404,6 +404,12 @@ public class FirewallManagerImpl extends ManagerBase 
implements FirewallService,
 
             boolean notNullPorts =
                 (newRule.getSourcePortStart() != null && 
newRule.getSourcePortEnd() != null && rule.getSourcePortStart() != null && 
rule.getSourcePortEnd() != null);
+            boolean nullPorts =
+                (newRule.getSourcePortStart() == null && 
newRule.getSourcePortEnd() == null && rule.getSourcePortStart() == null && 
rule.getSourcePortEnd() == null);
+            if(nullPorts && duplicatedCidrs && 
(rule.getProtocol().equalsIgnoreCase(newRule.getProtocol())))
+            {
+                throw new NetworkRuleConflictException("There is already a 
firewall rule specified with protocol = " +newRule.getProtocol()+ " and no 
ports");
+            }
             if (!notNullPorts) {
                 continue;
             } else if (!oneOfRulesIsFirewall &&

Reply via email to