diff --git a/api_db.php b/api_db.php index 6203d5d1..cddfb17a 100644 --- a/api_db.php +++ b/api_db.php @@ -62,18 +62,27 @@ if(isset($_GET["network"]) && $auth) while($results !== false && $res = $results->fetchArray(SQLITE3_ASSOC)) { - $id = $res["id"]; - // Empty array for holding the IP addresses + $id = intval($res["id"]); + + // Get IP addresses and host names for this device $res["ip"] = array(); - // Get IP addresses for this device - $network_addresses = $db->query("SELECT ip FROM network_addresses WHERE network_id = $id ORDER BY lastSeen DESC"); - while($network_addresses !== false && $ip = $network_addresses->fetchArray(SQLITE3_ASSOC)) - array_push($res["ip"],$ip["ip"]); - // UTF-8 encode host name and vendor - $res["name"] = utf8_encode($res["name"]); + $res["name"] = array(); + $network_addresses = $db->query("SELECT ip,name FROM network_addresses WHERE network_id = $id ORDER BY lastSeen DESC"); + while($network_addresses !== false && $network_address = $network_addresses->fetchArray(SQLITE3_ASSOC)) + { + array_push($res["ip"],$network_address["ip"]); + if($network_address["name"] !== null) + array_push($res["name"],utf8_encode($network_address["name"])); + else + array_push($res["name"],""); + } + $network_addresses->finalize(); + + // UTF-8 encode vendor $res["macVendor"] = utf8_encode($res["macVendor"]); array_push($network, $res); } + $results->finalize(); $data = array_merge($data, array('network' => $network)); } diff --git a/groups-clients.php b/groups-clients.php index e7c6bea6..36110216 100644 --- a/groups-clients.php +++ b/groups-clients.php @@ -30,14 +30,25 @@
- +
+
+
+

You can select an existing client or add a custom one by typing into the field above and confirming your entry with ⏎.

+

Clients may be described either by their IP addresses (IPv4 and IPv6 are supported), + IP subnets (CIDR notation, like 192.168.2.0/24), + their MAC addresses (like 12:34:56:78:9A:BC), + by their hostnames (like localhost), or by the interface they are connected to (prefaced with a colon, like :eth0).

+

Note that client recognition by IP addresses (incl. subnet ranges) are prefered over MAC address, host name or interface recognition as + the two latter will only be available after some time. + Furthermore, MAC address recognition only works for devices at most one networking hop away from your Pi-hole.

+
+