Skip to content

Commit 8df2245

Browse files
committed
Static Routes: fix check on wrong global configuration
1 parent 971a5b2 commit 8df2245

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

engine/api/src/main/java/org/apache/cloudstack/engine/orchestration/service/NetworkOrchestrationService.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ public interface NetworkOrchestrationService {
8181
ConfigKey<Integer> NetworkLockTimeout = new ConfigKey<Integer>(Integer.class, NetworkLockTimeoutCK, "Network", "600",
8282
"Lock wait timeout (seconds) while implementing network", true, Scope.Global, null);
8383

84+
ConfigKey<String> DeniedRoutes = new ConfigKey<String>(String.class, "denied.routes", "Network", "",
85+
"Routes that are denied, can not be used for Static Routes creation for the VPC Private Gateway", true, ConfigKey.Scope.Zone, null);
86+
8487
ConfigKey<String> GuestDomainSuffix = new ConfigKey<String>(String.class, GuestDomainSuffixCK, "Network", "cloud.internal",
8588
"Default domain name for vms inside virtualized networks fronted by router", true, ConfigKey.Scope.Zone, null);
8689

engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4792,7 +4792,7 @@ public String getConfigComponentName() {
47924792

47934793
@Override
47944794
public ConfigKey<?>[] getConfigKeys() {
4795-
return new ConfigKey<?>[]{NetworkGcWait, NetworkGcInterval, NetworkLockTimeout,
4795+
return new ConfigKey<?>[]{NetworkGcWait, NetworkGcInterval, NetworkLockTimeout, DeniedRoutes,
47964796
GuestDomainSuffix, NetworkThrottlingRate, MinVRVersion,
47974797
PromiscuousMode, MacAddressChanges, ForgedTransmits, MacLearning, RollingRestartEnabled,
47984798
TUNGSTEN_ENABLED };

server/src/main/java/com/cloud/network/vpc/VpcManagerImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2710,7 +2710,7 @@ public StaticRoute createStaticRoute(final long gatewayId, final String cidr) th
27102710
}
27112711

27122712
// 2) CIDR should be outside of link-local cidr
2713-
if (NetUtils.isNetworksOverlap(vpc.getCidr(), NetUtils.getLinkLocalCIDR())) {
2713+
if (NetUtils.isNetworksOverlap(cidr, NetUtils.getLinkLocalCIDR())) {
27142714
throw new InvalidParameterValueException("CIDR should be outside of link local cidr " + NetUtils.getLinkLocalCIDR());
27152715
}
27162716

@@ -2739,7 +2739,7 @@ public StaticRouteVO doInTransaction(final TransactionStatus status) throws Netw
27392739
}
27402740

27412741
protected boolean isCidrDenylisted(final String cidr, final long zoneId) {
2742-
final String routesStr = NetworkOrchestrationService.GuestDomainSuffix.valueIn(zoneId);
2742+
final String routesStr = NetworkOrchestrationService.DeniedRoutes.valueIn(zoneId);
27432743
if (routesStr != null && !routesStr.isEmpty()) {
27442744
final String[] cidrDenyList = routesStr.split(",");
27452745

0 commit comments

Comments
 (0)