Ignore broadcast and network addresses when generating list of subnet IPs (#1187)

When creating a list of IPs to ping we should ignore the network and broadcast address since it will not detect any devices anyway
This commit is contained in:
Sillium 2021-06-30 21:54:52 +02:00 • committed by GitHub
parent 7c31f51ead
commit 26fb4e40b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -42,8 +42,8 @@ func IPsFromSubnet(arg string) (res []string) {
for ip := gen.Next(); ip != nil; ip = gen.Next() {
res = append(res, ip.String())
}
return res
// remove network and broadcast address
return res[1 : len(res)-1]
}
// ParseHostIPNet converts host or cidr into a host list