weizhouapache commented on code in PR #13206:
URL: https://github.com/apache/cloudstack/pull/13206#discussion_r3280023585


##########
plugins/ca/root-ca/src/main/java/org/apache/cloudstack/ca/provider/RootCAProvider.java:
##########
@@ -401,15 +401,21 @@ private boolean loadManagementKeyStore() {
 
     protected void addConfiguredManagementIp(List<String> ipList) {
         String msNetworkCidr = 
configDao.getValue(Config.ManagementNetwork.key());
+        if (StringUtils.isEmpty(msNetworkCidr)) {
+            return;
+        }
         try {
             logger.debug(String.format("Trying to find management IP in CIDR 
range [%s].", msNetworkCidr));
             Enumeration<NetworkInterface> networkInterfaces = 
NetworkInterface.getNetworkInterfaces();
 
             networkInterfaces.asIterator().forEachRemaining(networkInterface 
-> {
                 
networkInterface.getInetAddresses().asIterator().forEachRemaining(inetAddress 
-> {
-                    if 
(NetUtils.isIpWithInCidrRange(inetAddress.getHostAddress(), msNetworkCidr)) {
-                        ipList.add(inetAddress.getHostAddress());
-                        logger.debug(String.format("Added IP [%s] to the list 
of IPs in the management server's certificate.", inetAddress.getHostAddress()));
+                    String[] msNetworkCidrs = msNetworkCidr.split(",");
+                    for (String cidr : msNetworkCidrs) {
+                        if 
(NetUtils.isIpWithInCidrRange(inetAddress.getHostAddress(), cidr)) {

Review Comment:
   ```suggestion
                           if 
(NetUtils.isIpWithInCidrRange(inetAddress.getHostAddress(), cidr.trim())) {
   ```



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

To unsubscribe, e-mail: [email protected]

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

Reply via email to