all: sync with master

This commit is contained in:
Ainar Garipov
2025-02-18 19:50:19 +03:00
parent aef00413d5
commit effc822b85
50 changed files with 740 additions and 351 deletions

View File

@@ -591,17 +591,21 @@ func (s *Storage) ClientRuntime(ip netip.Addr) (rc *Runtime) {
defer s.mu.Unlock()
rc = s.runtimeIndex.client(ip)
if rc != nil {
if !s.runtimeSourceDHCP {
return rc.clone()
}
if !s.runtimeSourceDHCP {
return nil
// SourceHostsFile > SourceDHCP, so return immediately if the client is from
// the hosts file.
if rc != nil && rc.hostsFile != nil {
return rc.clone()
}
// Otherwise, check the DHCP server and add the client information if there
// is any.
host := s.dhcp.HostByIP(ip)
if host == "" {
return nil
return rc.clone()
}
rc = s.runtimeIndex.setInfo(ip, SourceDHCP, []string{host})