diff --git a/probe/main.go b/probe/main.go index db5e99ae5..0b3a8c63a 100644 --- a/probe/main.go +++ b/probe/main.go @@ -115,9 +115,6 @@ func main() { } if *captureEnabled { - if *captureOn > *captureOff { - log.Fatalf("-capture.on (%s) must be <= -capture.off (%s)", *captureOn, *captureOff) - } for _, iface := range strings.Split(*captureInterfaces, ",") { source, err := sniff.NewSource(iface) if err != nil { diff --git a/probe/sniff/sniffer.go b/probe/sniff/sniffer.go index 2489ed38f..e0a13feef 100644 --- a/probe/sniff/sniffer.go +++ b/probe/sniff/sniffer.go @@ -64,6 +64,12 @@ func (s *Sniffer) loop(src gopacket.ZeroCopyPacketDataSource, on, off time.Durat done = make(chan struct{}) // when src is finished, we're done too ) + // As a special case, if our off duty cycle is zero, i.e. 100% sample + // rate, we simply disable the turn-off signal channel. + if off == 0 { + turnOff = nil + } + go func() { s.read(src, packets, &process, &total, &count) close(done)