summaryrefslogtreecommitdiffstats
path: root/src/lib/dhcpsrv/cfg_subnets6.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/dhcpsrv/cfg_subnets6.cc')
-rw-r--r--src/lib/dhcpsrv/cfg_subnets6.cc26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/lib/dhcpsrv/cfg_subnets6.cc b/src/lib/dhcpsrv/cfg_subnets6.cc
index a156163577..aa86bbd8c3 100644
--- a/src/lib/dhcpsrv/cfg_subnets6.cc
+++ b/src/lib/dhcpsrv/cfg_subnets6.cc
@@ -249,15 +249,27 @@ CfgSubnets6::selectSubnet(const asiolink::IOAddress& address,
// If the specified address matches a relay address, return this
// subnet.
- if (is_relay_address &&
- ((*subnet)->hasRelayAddress(address)) &&
- (*subnet)->clientSupported(client_classes)) {
- LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE,
- DHCPSRV_CFGMGR_SUBNET6_RELAY)
- .arg((*subnet)->toText()).arg(address.toText());
- return (*subnet);
+ if ((*subnet)->hasRelays()) {
+ if (!(*subnet)->hasRelayAddress(address) ||
+ !(*subnet)->clientSupported(client_classes)) {
+ continue;
+ }
+
+ } else {
+ SharedNetwork6Ptr network;
+ (*subnet)->getSharedNetwork(network);
+ if (!network || !network->hasRelayAddress(address) ||
+ !network->clientSupported(client_classes)) {
+ continue;
+ }
}
+ // The relay address is matching the one specified for a subnet
+ // or a shared network.
+ LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE,
+ DHCPSRV_CFGMGR_SUBNET6_RELAY)
+ .arg((*subnet)->toText()).arg(address.toText());
+ return (*subnet);
}
}