Pull request 2279: AG-27492-clients-runtime-sources-dhcp
Squashed commit of the following: commit51fb3e3d07
Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Sep 19 17:01:03 2024 +0300 all: upd chlog commit3ab945bb44
Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Sep 19 16:49:00 2024 +0300 home: clients runtime sources dhcp
This commit is contained in:
parent
a74c32f742
commit
e338214ad5
|
@ -44,6 +44,8 @@ NOTE: Add new changes BELOW THIS COMMENT.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
- Property `clients.runtime_sources.dhcp` in the configuration file not taking
|
||||||
|
effect.
|
||||||
- Update Google safe search domains list ([#7155]).
|
- Update Google safe search domains list ([#7155]).
|
||||||
- Enforce Bing safe search from Edge sidebar ([#7154]).
|
- Enforce Bing safe search from Edge sidebar ([#7154]).
|
||||||
- Text overflow on the query log page ([#7119]).
|
- Text overflow on the query log page ([#7119]).
|
||||||
|
|
|
@ -619,9 +619,12 @@ func (clients *clientsContainer) addHostLocked(
|
||||||
) (ok bool) {
|
) (ok bool) {
|
||||||
rc := client.NewRuntime(ip)
|
rc := client.NewRuntime(ip)
|
||||||
rc.SetInfo(src, []string{host})
|
rc.SetInfo(src, []string{host})
|
||||||
|
|
||||||
|
if config.Clients.Sources.DHCP {
|
||||||
if dhcpHost := clients.dhcp.HostByIP(ip); dhcpHost != "" {
|
if dhcpHost := clients.dhcp.HostByIP(ip); dhcpHost != "" {
|
||||||
rc.SetInfo(client.SourceDHCP, []string{dhcpHost})
|
rc.SetInfo(client.SourceDHCP, []string{dhcpHost})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
clients.storage.UpdateRuntime(rc)
|
clients.storage.UpdateRuntime(rc)
|
||||||
|
|
||||||
|
|
|
@ -117,6 +117,7 @@ func (clients *clientsContainer) handleGetClients(w http.ResponseWriter, r *http
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if config.Clients.Sources.DHCP {
|
||||||
for _, l := range clients.dhcp.Leases() {
|
for _, l := range clients.dhcp.Leases() {
|
||||||
cj := runtimeClientJSON{
|
cj := runtimeClientJSON{
|
||||||
Name: l.Hostname,
|
Name: l.Hostname,
|
||||||
|
@ -127,6 +128,7 @@ func (clients *clientsContainer) handleGetClients(w http.ResponseWriter, r *http
|
||||||
|
|
||||||
data.RuntimeClients = append(data.RuntimeClients, cj)
|
data.RuntimeClients = append(data.RuntimeClients, cj)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
data.Tags = clientTags
|
data.Tags = clientTags
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue