Merge pull request #3782 from weaveworks/fix-pcap-timeout
Reduce pcap timeout to avoid overflow
This commit is contained in:
1 file changed
+5
-1
+5
-1
@@ -4,10 +4,14 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"sync"
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/google/gopacket/pcap"
|
"github.com/google/gopacket/pcap"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Must be less than 2^31 usec - see https://github.com/google/gopacket/issues/708
|
||||||
|
const longTimeout = time.Duration(30 * time.Minute)
|
||||||
|
|
||||||
type Pcap struct {
|
type Pcap struct {
|
||||||
NonDiscardingFlowOp
|
NonDiscardingFlowOp
|
||||||
|
|
||||||
@@ -77,7 +81,7 @@ func newPcapHandle(ifName string, promisc bool, snaplen int, bufSz int) (handle
|
|||||||
if err = inactive.SetSnapLen(snaplen); err != nil {
|
if err = inactive.SetSnapLen(snaplen); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if err = inactive.SetTimeout(MaxDuration); err != nil {
|
if err = inactive.SetTimeout(longTimeout); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if err = inactive.SetImmediateMode(true); err != nil {
|
if err = inactive.SetImmediateMode(true); err != nil {
|
||||||
|
|||||||
Reference in new issue
Block a user