From 52fabcb77014e14fde082b49d896d8263b6c4db7 Mon Sep 17 00:00:00 2001 From: Tony Murray Date: Mon, 19 Jun 2017 12:49:43 -0500 Subject: [PATCH] api: Add search by os to list_devices (#6861) --- doc/API/API-Docs.md | 1 + html/includes/api_functions.inc.php | 3 +++ 2 files changed, 4 insertions(+) diff --git a/doc/API/API-Docs.md b/doc/API/API-Docs.md index 285d2bd287..d6104cfd10 100644 --- a/doc/API/API-Docs.md +++ b/doc/API/API-Docs.md @@ -727,6 +727,7 @@ Input: - up: Only devices that are up - down: Only devices that are down - disabled: Disabled devices + - os: search by os type - mac: search by mac address - ipv4: search by IPv4 address - ipv6: search by IPv6 address (compressed or uncompressed) diff --git a/html/includes/api_functions.inc.php b/html/includes/api_functions.inc.php index 532a34db82..f49de0e7d6 100644 --- a/html/includes/api_functions.inc.php +++ b/html/includes/api_functions.inc.php @@ -220,6 +220,9 @@ function list_devices() $sql = "`status`='0' AND `ignore`='0' AND `disabled`='0'"; } elseif ($type == 'disabled') { $sql = "`disabled`='1'"; + } elseif ($type == 'os') { + $sql = "`os`=?"; + $param[] = $query; } elseif ($type == 'mac') { $join = " LEFT JOIN `ports` ON `devices`.`device_id`=`ports`.`device_id` LEFT JOIN `ipv4_mac` ON `ports`.`port_id`=`ipv4_mac`.`port_id` "; $sql = "`ipv4_mac`.`mac_address`=?";