- Default gateway is a good feature for having host discovery, and
consequently hosts' pings, work out of the box.
But in real scenarios a controlled network node may be connected to a
legacy switch's trunk port which exposes thousand of hosts which ARP
packets would easily stress controller functionality.
Even though today this can be prevented by configuring a more
specific subnet gateway, the issue is very much possible at first
controller boot, and can always re-occur during subnet config manipulation
if at any point of time we have no user configured subnet gateways.
- This patch provides a way to disable he default gw feature by mean of
a property in config.ini. Property addition is not included, current
behavior is unchanged.
Change-Id: I15b63233e3ed46a8a9fb57bb0988a0d4a2984b11
Signed-off-by: Alessandro Boch <aboch@cisco.com>
* only subnet returned. As soon as a user-configured subnet is created this one will
* vanish.
*/
* only subnet returned. As soon as a user-configured subnet is created this one will
* vanish.
*/
+ private static final String DISABLE_DEFAULT_SUBNET_PROP = "switchmanager.disableDefaultSubnetGateway";
+ private static final String DISABLE_DEFAULT_SUBNET_PROP_VAL = System.getProperty(DISABLE_DEFAULT_SUBNET_PROP);
+ private static final boolean USE_DEFAULT_SUBNET_GW = !Boolean.valueOf(DISABLE_DEFAULT_SUBNET_PROP_VAL);
protected static final SubnetConfig DEFAULT_SUBNETCONFIG;
protected static final Subnet DEFAULT_SUBNET;
protected static final String DEFAULT_SUBNET_NAME = "default (cannot be modifed)";
protected static final SubnetConfig DEFAULT_SUBNETCONFIG;
protected static final Subnet DEFAULT_SUBNET;
protected static final String DEFAULT_SUBNET_NAME = "default (cannot be modifed)";
@Override
public List<SubnetConfig> getSubnetsConfigList() {
// if there are no subnets, return the default subnet
@Override
public List<SubnetConfig> getSubnetsConfigList() {
// if there are no subnets, return the default subnet
- if(subnetsConfigList.size() == 0){
+ if (USE_DEFAULT_SUBNET_GW && subnetsConfigList.isEmpty()) {
return Collections.singletonList(DEFAULT_SUBNETCONFIG);
return Collections.singletonList(DEFAULT_SUBNETCONFIG);
return new ArrayList<SubnetConfig>(subnetsConfigList.values());
}
}
return new ArrayList<SubnetConfig>(subnetsConfigList.values());
}
}
@Override
public SubnetConfig getSubnetConfig(String subnet) {
// if there are no subnets, return the default subnet
@Override
public SubnetConfig getSubnetConfig(String subnet) {
// if there are no subnets, return the default subnet
- if(subnetsConfigList.isEmpty() && subnet.equalsIgnoreCase(DEFAULT_SUBNET_NAME)){
+ if (USE_DEFAULT_SUBNET_GW && subnetsConfigList.isEmpty() && subnet.equalsIgnoreCase(DEFAULT_SUBNET_NAME)) {
return DEFAULT_SUBNETCONFIG;
return DEFAULT_SUBNETCONFIG;
return subnetsConfigList.get(subnet);
}
}
return subnetsConfigList.get(subnet);
}
}