diff --git a/lam/lib/modules/fixed_ip.inc b/lam/lib/modules/fixed_ip.inc index 3f683e50..3fe1bbed 100644 --- a/lam/lib/modules/fixed_ip.inc +++ b/lam/lib/modules/fixed_ip.inc @@ -770,7 +770,7 @@ class fixed_ip extends baseModule { /** * Extracts the IP from a list of DHCP statements. * - * @param array $dhcpStatements values of dhcpStatements attribute + * @param string $dhcpStatements values of dhcpStatements attribute */ public static function extractIP($dhcpStatements) { $return = null; diff --git a/lam/lib/types/dhcp.inc b/lam/lib/types/dhcp.inc index 7f80cf4c..80b80226 100644 --- a/lam/lib/types/dhcp.inc +++ b/lam/lib/types/dhcp.inc @@ -177,6 +177,43 @@ class lamDHCPList extends lamList { 'deleteEntry' => _("Delete selected DHCP entries")); } + /** + * {@inheritDoc} + * @see lamList::isFilterMatching() + */ + protected function isFilterMatching(&$data, $filterAttribute, $regex) { + if ($filterAttribute == "fixed_ips") { + if (empty($regex)) { + return true; + } + $entries = searchLDAP($data['dn'], 'objectClass=dhcpHost', array('dhcpstatements', 'dhcphwaddress', 'cn')); + if (sizeof($entries) > 0) { + foreach ($entries as $entry) { + foreach ($entry as $attrName => $attrValues) { + if (!is_array($attrValues)) { + continue; + } + foreach ($attrValues as $attrValue) { + if (preg_match($regex, $attrValue)) { + return true; + } + } + if (!empty($entry['dhcpstatements'])) { + $ip = fixed_ip::extractIP($entry['dhcpstatements']); + if (!empty($ip)) { + if (preg_match($regex, $ip)) { + return true; + } + } + } + } + } + } + return false; + } + return parent::isFilterMatching($data, $filterAttribute, $regex); + } + /** * {@inheritDoc} * @see lamList::getTableCellContent()