diff --git a/internal/home/clients.go b/internal/home/clients.go index 819564bc..341064f4 100644 --- a/internal/home/clients.go +++ b/internal/home/clients.go @@ -619,8 +619,11 @@ func (clients *clientsContainer) addHostLocked( ) (ok bool) { rc := client.NewRuntime(ip) rc.SetInfo(src, []string{host}) - if dhcpHost := clients.dhcp.HostByIP(ip); dhcpHost != "" { - rc.SetInfo(client.SourceDHCP, []string{dhcpHost}) + + if config.Clients.Sources.DHCP { + if dhcpHost := clients.dhcp.HostByIP(ip); dhcpHost != "" { + rc.SetInfo(client.SourceDHCP, []string{dhcpHost}) + } } clients.storage.UpdateRuntime(rc) diff --git a/internal/home/clientshttp.go b/internal/home/clientshttp.go index eba22ddb..f5f061e4 100644 --- a/internal/home/clientshttp.go +++ b/internal/home/clientshttp.go @@ -117,15 +117,17 @@ func (clients *clientsContainer) handleGetClients(w http.ResponseWriter, r *http return true }) - for _, l := range clients.dhcp.Leases() { - cj := runtimeClientJSON{ - Name: l.Hostname, - Source: client.SourceDHCP, - IP: l.IP, - WHOIS: &whois.Info{}, - } + if config.Clients.Sources.DHCP { + for _, l := range clients.dhcp.Leases() { + cj := runtimeClientJSON{ + Name: l.Hostname, + Source: client.SourceDHCP, + IP: l.IP, + WHOIS: &whois.Info{}, + } - data.RuntimeClients = append(data.RuntimeClients, cj) + data.RuntimeClients = append(data.RuntimeClients, cj) + } } data.Tags = clientTags