CLOUDSTACK-6040: Updated the ip addr validation in create port forwarding (cherry picked from commit 7a71cf33ce103392914ac51cd4689a6f5a340d0a)
Signed-off-by: Animesh Chaturvedi <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/278c54a9 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/278c54a9 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/278c54a9 Branch: refs/heads/4.3 Commit: 278c54a9709a50580edcc45adc5b0585793e4d24 Parents: 8a9b1f7 Author: Jayapal <[email protected]> Authored: Thu Feb 6 17:58:26 2014 +0530 Committer: Animesh Chaturvedi <[email protected]> Committed: Fri Feb 7 13:24:28 2014 -0800 ---------------------------------------------------------------------- .../api/command/user/firewall/CreatePortForwardingRuleCmd.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/278c54a9/api/src/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java index ff63d08..2e8f662 100644 --- a/api/src/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java @@ -18,6 +18,7 @@ package org.apache.cloudstack.api.command.user.firewall; import java.util.List; +import com.cloud.utils.net.NetUtils; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiCommandJobType; import org.apache.cloudstack.api.ApiConstants; @@ -317,7 +318,7 @@ public class CreatePortForwardingRuleCmd extends BaseAsyncCreateCmd implements P Ip privateIp = getVmSecondaryIp(); if (privateIp != null) { - if ( !privateIp.isIp4()) { + if (!NetUtils.isValidIp(privateIp.toString())) { throw new InvalidParameterValueException("Invalid vm ip address"); } }
