-
Notifications
You must be signed in to change notification settings - Fork 389
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix PacketCapture pcapng file issue on macOS #6804
Conversation
01870b6
to
12e1973
Compare
e011320
to
32682e8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for making the changes
@tnqn do you want to take a look?
7f6c975
to
d44f261
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
By default, gopacket will write snap length=0 in the pcapng file header, means unlimited snaplen. tcpdump on osx(libpcap version 1.10.1) cannot recognize this and will report error. This patch will set a default value(65535) for it. Signed-off-by: Hang Yan <[email protected]>
d44f261
to
cdb9e83
Compare
/test-all |
Unrelated e2e test failures in |
@hangyan can you back port this PR to release 2.2. |
sure |
By default, gopacket will write snap length=0 in the pcapng file header, means unlimited snaplen. tcpdump on macOS (libpcap version 1.10.1) cannot recognize this and will report error. This patch sets a default value (65535) for it. For antrea-io#6795 Signed-off-by: Hang Yan <[email protected]>
…6815) (#6821)#6804: Fix PacketCapture pcapng file issue on macOS (#6804) (#6983) * Fix packetcapture bpf filter issue (#6815) (#6821) In PacketCapture, packets which don’t match the target BPF can be received after the socket is created and before the bpf filter is applied. This patch uses a zero bpf filter (matches no packet), then empties out any packets that arrived before the "zero-BPF" filter was applied. At this point the socket is definitely empty and it can’t fill up with junk because the zero-BPF is in place. Then we replace the zero-BPF with the real BPF we want. Signed-off-by: Hang Yan <[email protected]> Co-authored-by: Antonin Bas <[email protected]> * Fix PacketCapture pcapng file issue on macOS (#6804) By default, gopacket will write snap length=0 in the pcapng file header, means unlimited snaplen. tcpdump on macOS (libpcap version 1.10.1) cannot recognize this and will report error. This patch sets a default value (65535) for it. For #6795 Signed-off-by: Hang Yan <[email protected]> --------- Signed-off-by: Hang Yan <[email protected]> Co-authored-by: Antonin Bas <[email protected]>
By default, gopacket will write snap length=0 in the pcapng file header, means unlimited snaplen. tcpdump on osx(libpcap version 1.10.1) cannot recognize this and will report error. This patch will set a default value(524288) for it. This patch also add packets file verification in e2e tests.
origin error message:
pcapng format ref: https://pcapng.com/