Skip to content

Commit

Permalink
Fix windows loopback
Browse files Browse the repository at this point in the history
Windows loopback do not have addresses
  • Loading branch information
buger committed Aug 3, 2021
1 parent 024e126 commit c9274ac
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions capture/capture.go
Original file line number Diff line number Diff line change
Expand Up @@ -571,10 +571,6 @@ func (l *Listener) setInterfaces() (err error) {
}

for _, pi := range pifis {
if len(pi.Addresses) == 0 {
continue
}

var ni net.Interface
for _, i := range ifis {
addrs, _ := i.Addrs()
Expand All @@ -586,14 +582,16 @@ func (l *Listener) setInterfaces() (err error) {
}
}
}

if len(addrs) == 0 && i.Name == pi.Name {
ni = i
break
}
}

if ni.Flags&net.FlagLoopback != 0 {
l.loopIndex = ni.Index
}
if ni.Flags&net.FlagUp == 0 {
continue
}

if isDevice(l.host, pi) {
l.Interfaces = []pcap.Interface{pi}
Expand Down

0 comments on commit c9274ac

Please sign in to comment.