@@ -232,7 +232,7 @@ func (l *Listener) PcapHandle(ifi pcap.Interface) (handle *pcap.Handle, err erro
232
232
if l .TimestampType != "" && l .TimestampType != "go" {
233
233
var ts pcap.TimestampSource
234
234
ts , err = pcap .TimestampSourceFromString (l .TimestampType )
235
- fmt .Println ("Setting custom Timestamp Source. Supported values: `simple `, " , inactive .SupportedTimestamps ())
235
+ fmt .Println ("Setting custom Timestamp Source. Supported values: `go `, " , inactive .SupportedTimestamps ())
236
236
err = inactive .SetTimestampSource (ts )
237
237
if err != nil {
238
238
return nil , fmt .Errorf ("%q: supported timestamps: %q, interface: %q" , err , inactive .SupportedTimestamps (), ifi .Name )
@@ -517,11 +517,20 @@ func (l *Listener) setInterfaces() (err error) {
517
517
}
518
518
519
519
for _ , pi := range pifis {
520
+ if len (pi .Addresses ) == 0 {
521
+ continue
522
+ }
523
+
520
524
var ni net.Interface
521
525
for _ , i := range ifis {
522
- if i .Name == pi .Name {
523
- ni = i
524
- break
526
+ addrs , _ := i .Addrs ()
527
+ for _ , a := range addrs {
528
+ for _ , pa := range pi .Addresses {
529
+ if strings .HasPrefix (a .String (), pa .IP .String ()) {
530
+ ni = i
531
+ break
532
+ }
533
+ }
525
534
}
526
535
}
527
536
@@ -537,9 +546,7 @@ func (l *Listener) setInterfaces() (err error) {
537
546
return
538
547
}
539
548
540
- if len (pi .Addresses ) != 0 {
541
- l .Interfaces = append (l .Interfaces , pi )
542
- }
549
+ l .Interfaces = append (l .Interfaces , pi )
543
550
}
544
551
return
545
552
}
0 commit comments