Skip to content

Commit 6850026

Browse files
weizhouapachedhslove
authored andcommitted
Static Routes: fix check on wrong global configuration (apache#10066)
1 parent 3af10f7 commit 6850026

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
@@ -82,6 +82,9 @@ public interface NetworkOrchestrationService {
8282
ConfigKey<Integer> NetworkLockTimeout = new ConfigKey<Integer>(Integer.class, NetworkLockTimeoutCK, "Network", "600",
8383
"Lock wait timeout (seconds) while implementing network", true, Scope.Global, null);
8484

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

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
@@ -4874,7 +4874,7 @@ public String getConfigComponentName() {
48744874

48754875
@Override
48764876
public ConfigKey<?>[] getConfigKeys() {
4877-
return new ConfigKey<?>[]{NetworkGcWait, NetworkGcInterval, NetworkLockTimeout,
4877+
return new ConfigKey<?>[]{NetworkGcWait, NetworkGcInterval, NetworkLockTimeout, DeniedRoutes,
48784878
GuestDomainSuffix, NetworkThrottlingRate, MinVRVersion,
48794879
PromiscuousMode, MacAddressChanges, ForgedTransmits, MacLearning, RollingRestartEnabled,
48804880
TUNGSTEN_ENABLED, NSX_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
@@ -2976,7 +2976,7 @@ public StaticRoute createStaticRoute(final long gatewayId, final String cidr) th
29762976
}
29772977

29782978
// 2) CIDR should be outside of link-local cidr
2979-
if (NetUtils.isNetworksOverlap(vpc.getCidr(), NetUtils.getLinkLocalCIDR())) {
2979+
if (NetUtils.isNetworksOverlap(cidr, NetUtils.getLinkLocalCIDR())) {
29802980
throw new InvalidParameterValueException("CIDR should be outside of link local cidr " + NetUtils.getLinkLocalCIDR());
29812981
}
29822982

@@ -3005,7 +3005,7 @@ public StaticRouteVO doInTransaction(final TransactionStatus status) throws Netw
30053005
}
30063006

30073007
protected boolean isCidrDenylisted(final String cidr, final long zoneId) {
3008-
final String routesStr = NetworkOrchestrationService.GuestDomainSuffix.valueIn(zoneId);
3008+
final String routesStr = NetworkOrchestrationService.DeniedRoutes.valueIn(zoneId);
30093009
if (routesStr != null && !routesStr.isEmpty()) {
30103010
final String[] cidrDenyList = routesStr.split(",");
30113011

0 commit comments

Comments
 (0)