cloudstack-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF subversion and git services (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CLOUDSTACK-6020) createPortForwardingRule failes for vmguestip above 127.255.255.255
Date Wed, 26 Nov 2014 13:22:13 GMT

    [ https://issues.apache.org/jira/browse/CLOUDSTACK-6020?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14226168#comment-14226168
] 

ASF subversion and git services commented on CLOUDSTACK-6020:
-------------------------------------------------------------

Commit 2b264e6b57b90d6eb5d202c4fe72e64d867b3f9b in cloudstack's branch refs/heads/4.3 from
[~dahn]
[ https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;h=2b264e6 ]

CLOUDSTACK-6020 ipv4 address can be a larger number then
Interger.MAX_VALUE
(cherry picked from commit b3829e54d6b7af426f797ffb9fa54b4cd2abffc0)

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>


> createPortForwardingRule failes for vmguestip above 127.255.255.255
> -------------------------------------------------------------------
>
>                 Key: CLOUDSTACK-6020
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-6020
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the default.) 
>          Components: API
>    Affects Versions: pre-4.0.0, 4.0.0, 4.0.1, 4.0.2, 4.1.0, 4.1.1, 4.2.0, Future, 4.2.1,
4.1.2, 4.3.0, 4.4.0
>            Reporter: Joris van Lieshout
>            Assignee: Daan Hoogland
>             Fix For: 4.4.0
>
>
> command=createPortForwardingRule&response=json&sessionkey=FmHQb9oGmgKlM4ihB%2Fb2ik7p35E%3D&ipaddressid=d29bebfe-edc1-406f-b4ed-7a49c6e7ee1f&privateport=80&privateendport=80&publicport=80&publicendport=80&protocol=tcp&virtualmachineid=cc5c9dc4-3eeb-4533-994a-0e2636a48a60&openfirewall=false&vmguestip=192.168.1.30&networkid=5e56227c-83c0-4b85-8a27-53343e806d12&_=1391510423905
> vmguestip=192.168.1.30
> api/src/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java
> @Parameter(name = ApiConstants.VM_GUEST_IP, type = CommandType.STRING, required = false,
>     description = "VM guest nic Secondary ip address for the port forwarding rule")
>     private String vmSecondaryIp;
> @Override
>     public void create() {
>         // cidr list parameter is deprecated
>         if (cidrlist != null) {
>             throw new InvalidParameterValueException("Parameter cidrList is deprecated;
if you need to open firewall rule for the specific cidr, please refer to createFirewallRule
command");
>         }
>         Ip privateIp = getVmSecondaryIp();
>         if (privateIp != null) {
>             if ( !privateIp.isIp4()) {
>                 throw new InvalidParameterValueException("Invalid vm ip address");
>             }
>         }
>         try {
>             PortForwardingRule result = _rulesService.createPortForwardingRule(this,
virtualMachineId, privateIp, getOpenFirewall());
>             setEntityId(result.getId());
>             setEntityUuid(result.getUuid());
>         } catch (NetworkRuleConflictException ex) {
>             s_logger.info("Network rule conflict: " , ex);
>             s_logger.trace("Network Rule Conflict: ", ex);
>             throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage());
>         }
>     }
> utils/src/com/cloud/utils/net/Ip.java
> public boolean isIp4() {
>         return ip < Integer.MAX_VALUE;
>     }
> public Ip(String ip) {
>         this.ip = NetUtils.ip2Long(ip);
>     }
> === ip2long for 192.168.1.30 => 3232235806
> === Integer.MAX_VALUE => 231-1 = 2147483647
> 3232235806 (192.168.1.30) is therefore bigger then MAX_VALUE making isIp4() return FALSE
and throwing a InvalidParameterValueException…



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message