incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prachida...@apache.org
Subject git commit: refs/heads/master - CLOUDSTACK-1135: [EC2 Query API] AuthorizeSecurityGroupIngress and RevokeSecurityGroupIngress fails when icmp code and type is provided
Date Tue, 12 Feb 2013 22:47:16 GMT
Updated Branches:
  refs/heads/master 57969843d -> c3be0f995


CLOUDSTACK-1135: [EC2 Query API] AuthorizeSecurityGroupIngress and RevokeSecurityGroupIngress
fails when icmp code and type is provided

For AuthorizeSecurityGroupIngress RevokeSecurityGroupIngress query calls parse and set the
icmp code and type


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

Branch: refs/heads/master
Commit: c3be0f995d1b3f5ee1355971143234871ad517d9
Parents: 5796984
Author: Prachi Damle <prachi@cloud.com>
Authored: Tue Feb 12 14:45:29 2013 -0800
Committer: Prachi Damle <prachi@cloud.com>
Committed: Tue Feb 12 14:45:29 2013 -0800

----------------------------------------------------------------------
 .../com/cloud/bridge/service/EC2RestServlet.java   |   32 +++++++++++----
 1 files changed, 24 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c3be0f99/awsapi/src/com/cloud/bridge/service/EC2RestServlet.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/service/EC2RestServlet.java b/awsapi/src/com/cloud/bridge/service/EC2RestServlet.java
index e209662..29a002c 100644
--- a/awsapi/src/com/cloud/bridge/service/EC2RestServlet.java
+++ b/awsapi/src/com/cloud/bridge/service/EC2RestServlet.java
@@ -707,12 +707,20 @@ public class EC2RestServlet extends HttpServlet {
             else break;
 
             String[] fromPort = request.getParameterValues( "IpPermissions." + nCount + ".FromPort"
);
-            if ( null != fromPort && 0 < fromPort.length)
-                perm.setFromPort( Integer.parseInt( fromPort[0]));
+            if ( null != fromPort && 0 < fromPort.length ) {
+                if ( protocol[0].equalsIgnoreCase("icmp") )
+                    perm.setIcmpType( fromPort[0] ) ;
+                else
+                    perm.setFromPort( Integer.parseInt( fromPort[0]) );
+            }
 
             String[] toPort = request.getParameterValues( "IpPermissions." + nCount + ".ToPort"
);
-            if ( null != toPort && 0 < toPort.length)
-                perm.setToPort( Integer.parseInt( toPort[0]));
+            if ( null != toPort && 0 < toPort.length ) {
+                if ( protocol[0].equalsIgnoreCase("icmp") )
+                    perm.setIcmpCode( toPort[0] );
+                else
+                    perm.setToPort( Integer.parseInt( toPort[0]) );
+            }
 
             // -> list: IpPermissions.n.IpRanges.m.CidrIp
             mCount = 1;
@@ -780,12 +788,20 @@ public class EC2RestServlet extends HttpServlet {
         else break;
 
         String[] fromPort = request.getParameterValues( "IpPermissions." + nCount + ".FromPort"
);
-            if ( null != fromPort && 0 < fromPort.length)
-                perm.setFromPort( Integer.parseInt( fromPort[0]));
+            if ( null != fromPort && 0 < fromPort.length ) {
+                if ( protocol[0].equalsIgnoreCase("icmp") )
+                    perm.setIcmpType( fromPort[0] ) ;
+                else
+                    perm.setFromPort( Integer.parseInt( fromPort[0]) );
+            }
 
         String[] toPort = request.getParameterValues( "IpPermissions." + nCount + ".ToPort"
);
-            if ( null != toPort && 0 < toPort.length)
-                perm.setToPort( Integer.parseInt( toPort[0]));
+            if ( null != toPort && 0 < toPort.length ) {
+                if ( protocol[0].equalsIgnoreCase("icmp") )
+                    perm.setIcmpCode( toPort[0] );
+                else
+                    perm.setToPort( Integer.parseInt( toPort[0]) );
+            }
 
         // -> list: IpPermissions.n.IpRanges.m.CidrIp
         int mCount = 1;


Mime
View raw message