sureshanaparti commented on a change in pull request #4503:
URL: https://github.com/apache/cloudstack/pull/4503#discussion_r531613119



##########
File path: server/src/main/java/com/cloud/network/NetworkServiceImpl.java
##########
@@ -1029,6 +1029,26 @@ private void checkSharedNetworkCidrOverlap(Long zoneId, 
long physicalNetworkId,
         }
     }
 
+    private void validateRouterIps(String routerIp, String routerIpv6, String 
startIp, String endIp, String startIpv6, String endIpv6) {
+        if (isNotBlank(routerIp)) {
+            if (!NetUtils.isValidIp4(routerIp)) {
+                throw new CloudRuntimeException("Router IPv4 IP provided is of 
incorrect format");
+            }
+            if (!NetUtils.isIpInRange(routerIp, startIp, endIp)) {
+                throw new CloudRuntimeException("Router IPv4 IP provided is 
not within the specified range: " + startIp + " - " + endIp);
+            }
+        }
+        if (isNotBlank(routerIpv6)) {
+            String ipv6Range = startIpv6 + "-" + endIpv6;
+            if (!NetUtils.isValidIp6(routerIpv6)) {
+                throw new CloudRuntimeException("Router IPv6 IP provided is of 
incorrect format");
+            }
+            if (!NetUtils.isIp6InRange(routerIp, ipv6Range)) {
+                throw new CloudRuntimeException("Router IPv4 IP provided is 
not within the specified range: " + startIp + " - " + endIp);

Review comment:
       _IPv4_ => _IPv6_  and same for start/end ip




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to