Skip to content

Commit c9274ac

Browse files
committed
Fix windows loopback
Windows loopback do not have addresses
1 parent 024e126 commit c9274ac

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

capture/capture.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -571,10 +571,6 @@ func (l *Listener) setInterfaces() (err error) {
571571
}
572572

573573
for _, pi := range pifis {
574-
if len(pi.Addresses) == 0 {
575-
continue
576-
}
577-
578574
var ni net.Interface
579575
for _, i := range ifis {
580576
addrs, _ := i.Addrs()
@@ -586,14 +582,16 @@ func (l *Listener) setInterfaces() (err error) {
586582
}
587583
}
588584
}
585+
586+
if len(addrs) == 0 && i.Name == pi.Name {
587+
ni = i
588+
break
589+
}
589590
}
590591

591592
if ni.Flags&net.FlagLoopback != 0 {
592593
l.loopIndex = ni.Index
593594
}
594-
if ni.Flags&net.FlagUp == 0 {
595-
continue
596-
}
597595

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

0 commit comments

Comments
 (0)