mirror of https://github.com/apache/cloudstack.git
bug 9605: exclude virtual interfaces when searching for cidrs
This commit is contained in:
parent
1bd0496bd0
commit
b8d9513309
|
|
@ -985,7 +985,6 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
|
|||
buf.append(" eth").append(deviceId).append("mask=").append(nic.getNetmask());
|
||||
}
|
||||
|
||||
buf.append(" eth").append(deviceId).append("mask=").append(nic.getNetmask());
|
||||
if (nic.isDefaultNic()) {
|
||||
buf.append(" gateway=").append(nic.getGateway());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,14 +116,16 @@ public class NetUtils {
|
|||
List<String> cidrList = new ArrayList<String>();
|
||||
try {
|
||||
for(NetworkInterface ifc : IteratorUtil.enumerationAsIterable(NetworkInterface.getNetworkInterfaces())) {
|
||||
for (InterfaceAddress address : ifc.getInterfaceAddresses()) {
|
||||
InetAddress addr = address.getAddress();
|
||||
int prefixLength = address.getNetworkPrefixLength();
|
||||
if(prefixLength < 32 && prefixLength > 0) {
|
||||
String ip = ipFromInetAddress(addr);
|
||||
cidrList.add(ipAndNetMaskToCidr(ip, getCidrNetmask(prefixLength)));
|
||||
}
|
||||
}
|
||||
if(ifc.isUp() && !ifc.isVirtual() && !ifc.isLoopback()) {
|
||||
for (InterfaceAddress address : ifc.getInterfaceAddresses()) {
|
||||
InetAddress addr = address.getAddress();
|
||||
int prefixLength = address.getNetworkPrefixLength();
|
||||
if(prefixLength < 32 && prefixLength > 0) {
|
||||
String ip = ipFromInetAddress(addr);
|
||||
cidrList.add(ipAndNetMaskToCidr(ip, getCidrNetmask(prefixLength)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch(SocketException e) {
|
||||
s_logger.warn("UnknownHostException in getLocalCidrs().", e);
|
||||
|
|
|
|||
Loading…
Reference in New Issue