google / google/gopacket

pcap timeout parameter restricted to 2^31 microseconds

Open
#708 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
6.8k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

The value goes through [this `usec` parameter](https://github.com/google/gopacket/blob/2d7fab0d91d6bb77c1df6bdeb222270a2aa13820/pcap/pcap_unix.go#L145) which is a C `int`.

I suggest this restriction is documented, though it would also be possible to remove it.

How did I find this? Some code wanted "a really long timeout" and passed MaxInt64 nanoseconds.
That didn't obviously fail until we took [this change](https://github.com/google/gopacket/blob/2d7fab0d91d6bb77c1df6bdeb222270a2aa13820/pcap/pcap_unix.go#L145)

Incidentally, I was unable to find any documentation stating whether it is OK to pass a timeout of 0 seconds and billions of microseconds to `select()`. And I wonder if that gives a clue to #499.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.