Browse Source

[3242] Use new IfaceMgr::getAddress function in CfgMgr.

Marcin Siodelski 11 years ago
parent
commit
f1fabbe371
1 changed files with 6 additions and 8 deletions
  1. 6 8
      src/lib/dhcpsrv/cfgmgr.cc

+ 6 - 8
src/lib/dhcpsrv/cfgmgr.cc

@@ -248,14 +248,12 @@ CfgMgr::belongsToSubnet4(const std::string& iface_name) const {
     if (iface == NULL) {
         isc_throw(isc::BadValue, "interface " << iface_name << " doesn't exist");
     }
-    for (Iface::AddressCollection::const_iterator addr = iface->getAddresses().begin();
-         addr != iface->getAddresses().end(); ++addr) {
-        if (addr->isV4()) {
-            for (Subnet4Collection::const_iterator subnet = subnets4_.begin();
-                 subnet != subnets4_.end(); ++subnet) {
-                if ((*subnet)->inRange(*addr)) {
-                    return (true);
-                }
+    IOAddress addr("::1");
+    if (iface->getAddress4(addr)) {
+        for (Subnet4Collection::const_iterator subnet = subnets4_.begin();
+             subnet != subnets4_.end(); ++subnet) {
+            if ((*subnet)->inRange(addr)) {
+                return (true);
             }
         }
     }