You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bf...@apache.org on 2013/02/13 23:04:22 UTC
[12/50] [abbrv] git commit: refs/heads/ui-plugins - CLOUDSTACK-1135:
[EC2 Query API] AuthorizeSecurityGroupIngress and RevokeSecurityGroupIngress
fails when icmp code and type is provided
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/ui-plugins
Commit: c3be0f995d1b3f5ee1355971143234871ad517d9
Parents: 5796984
Author: Prachi Damle <pr...@cloud.com>
Authored: Tue Feb 12 14:45:29 2013 -0800
Committer: Prachi Damle <pr...@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;