From 26fb4e40b6adb248f85b6342ee1fc66198a45891 Mon Sep 17 00:00:00 2001 From: Sillium Date: Wed, 30 Jun 2021 21:54:52 +0200 Subject: [PATCH] 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 --- cmd/detect.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/detect.go b/cmd/detect.go index e4d5312f1..0499b5445 100644 --- a/cmd/detect.go +++ b/cmd/detect.go @@ -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