From 240575ed1f1d0d177f5b1f156fa28d029841ab4b Mon Sep 17 00:00:00 2001 From: Stephen Soltesz Date: Fri, 30 Jun 2023 16:32:09 -0400 Subject: [PATCH] Filter interfaces that are up (#52) --- main.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 8b89ba4..43dbb3a 100644 --- a/main.go +++ b/main.go @@ -94,7 +94,10 @@ func processFlags() ([]net.Interface, error) { if err != nil { return ifaces, err } - ifaces = append(ifaces, *i) + if i.Flags&net.FlagUp != 0 { + // We can only capture packets from interfaces that are up. + ifaces = append(ifaces, *i) + } } return ifaces, nil }