cloudstack-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daan Hoogland (JIRA)" <j...@apache.org>
Subject [jira] [Closed] (CLOUDSTACK-6020) createPortForwardingRule failes for vmguestip above 127.255.255.255
Date Fri, 12 Sep 2014 08:50:35 GMT

     [ https://issues.apache.org/jira/browse/CLOUDSTACK-6020?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Daan Hoogland closed CLOUDSTACK-6020.
-------------------------------------

no idea if ipv6 addresses can be smaller then or equal to (2L * Integer.MAX_VALUE + 1)

if so open an issue and put it on my name; closing

> 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
>
> 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