The portal derives the device MAC instead of trusting the caller

This commit is contained in:
2026-08-21 13:18:30 -04:00
parent ccd6fc49b2
commit 4322d07b40
4 changed files with 168 additions and 21 deletions

View File

@@ -253,6 +253,24 @@ class UnifiApiClient
return ! empty($data);
}
/**
* The client currently holding this IP, or null.
*
* Reads the cached client list rather than querying per IP: the portal calls
* this once per connection attempt, and a class arriving at once would
* otherwise be one controller round trip each.
*/
public function findClientByIp(string $ip): ?array
{
foreach ($this->getActiveClients() as $client) {
if (($client['ip'] ?? null) === $ip) {
return $client;
}
}
return null;
}
public function kickClient(string $mac): array
{
Cache::forget('unifi:clients');