fix: issues from syncing with upstream

This commit is contained in:
Carlos Hernandez 2025-10-24 07:49:50 -06:00
parent 97040a4239
commit 7c32f4ed83
No known key found for this signature in database
GPG Key ID: 0B673B2706512093

View File

@ -166,7 +166,7 @@ func (s *systemConfigurator) removeKeyFromSystemConfig(key string) error {
}
func (s *systemConfigurator) addLocalDNS() error {
if !s.systemDNSSettings.ServerIP.IsValid() || len(s.systemDNSSettings.Domains) == 0 {
if len(s.systemDNSSettings.ServerIPs) == 0 || len(s.systemDNSSettings.Domains) == 0 {
if err := s.recordSystemDNSSettings(true); err != nil {
log.Errorf("Unable to get system DNS configuration")
return fmt.Errorf("recordSystemDNSSettings(): %w", err)
@ -243,7 +243,9 @@ func (s *systemConfigurator) getSystemDNSSettings() (SystemDNSSettings, error) {
} else if inServerAddressesArray {
address := strings.Split(line, " : ")[1]
if ip, err := netip.ParseAddr(address); err == nil && ip.Is4() {
dnsSettings.ServerIPs = append(dnsSettings.ServerIPs, ip)
if ip.IsValid() {
dnsSettings.ServerIPs = append(dnsSettings.ServerIPs, ip.Unmap())
}
inServerAddressesArray = false // Stop reading after finding the first IPv4 address
}
}