force sending to statically configured IPs and ARP cache, even if dhcp leases cannot be parsed

pull/827/merge^2
Adrian Batzill 2023-06-28 09:38:35 +02:00
rodzic 0cc15753b9
commit a54aaeebf5
1 zmienionych plików z 12 dodań i 12 usunięć

Wyświetl plik

@ -61,19 +61,19 @@ func getDHCPLeases() (map[string]string, error) {
} }
dat, err := ioutil.ReadFile(dhcp_lease_file) dat, err := ioutil.ReadFile(dhcp_lease_file)
ret := make(map[string]string) ret := make(map[string]string)
if err != nil {
return ret, err if err == nil {
} lines := strings.Split(string(dat), "\n")
lines := strings.Split(string(dat), "\n") for _, line := range lines {
for _, line := range lines { spaced := strings.Split(line, " ")
spaced := strings.Split(line, " ") if len(spaced) >= 4 {
if len(spaced) >= 4 { ip := spaced[2]
ip := spaced[2] host := spaced[3]
host := spaced[3] if host == "*" {
if host == "*" { host = ""
host = "" }
ret[ip] = host
} }
ret[ip] = host
} }
} }