Skip to content
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

TCP Keep-Alive carrying data #1594

Closed
gyl30 opened this issue Sep 29, 2024 · 12 comments
Closed

TCP Keep-Alive carrying data #1594

gyl30 opened this issue Sep 29, 2024 · 12 comments
Labels

Comments

@gyl30
Copy link
Contributor

gyl30 commented Sep 29, 2024

I recently discovered an interesting phenomenon in a customer environment where TCP Keep-Alive packets appear every second or so and carry a byte of data, these Keep-Alive packets carry data that is intermingled with the normal data and can be passed through TcpReassembly. do we have a way to deal with this situation at PcapPlusPlus? Do we have a way in PcapPlusPlus to handle this situation? I have a screenshot here of Keep-Alive and HTTP data together, causing an error in HTTP parsing.
image

@gyl30
Copy link
Contributor Author

gyl30 commented Sep 29, 2024

I forgot to mention that all the TCP Keep-Alive packets I've observed in my environment carry one byte of data at 0x00.

@tigercosmos
Copy link
Collaborator

It sounds like an edge case. I don't know if it is general enough to modify the TcpReassembly. I also wonder if it's a bug of TcpReassembly. In this case, perhaps you may want to handle the packets yourself.

@gyl30
Copy link
Contributor Author

gyl30 commented Sep 30, 2024

Everyone who encounters this situation with PcapPlusPlus could benefit if it was handled within PcapPlusPlus. I see herethat it is possible to filter out such packets using the bpf filtering rule, but not when using dpdk Using bpf filtering rules

@seladb
Copy link
Owner

seladb commented Oct 1, 2024

@gyl30 is there a pcap file you can share that includes this phenomenon?

@gyl30
Copy link
Contributor Author

gyl30 commented Oct 8, 2024

@seladb
Sorry, the packet capture file involves client information that I can't provide, however, we should be able to reproduce this problem by writing a simple tcp program and setting SO_KEEP* related options

@tigercosmos
Copy link
Collaborator

@gyl30 I think it's possible to reproduce through a unit test. Probably you can consider providing a minimum reproducible test case.

@hidd3ncod3s
Copy link
Contributor

@seladb
Copy link
Owner

seladb commented Oct 9, 2024

It is a common windows behaviour
https://osqa-ask.wireshark.org/questions/44609/wireshark-tcp-keep-alive-detection/

@hidd3ncod3s there is a link to a pcapng flie, but unfortunately it's broken 😕

@seladb Sorry, the packet capture file involves client information that I can't provide, however, we should be able to reproduce this problem by writing a simple tcp program and setting SO_KEEP* related options

@gyl30 maybe you can write such program, record the TCP traffic, and attach a pcap file to this issue?

@gyl30
Copy link
Contributor Author

gyl30 commented Oct 9, 2024

@seladb @hidd3ncod3s @tigercosmos
I've investigated this issue carefully and we probably can't fix it because the first packet received is a TCP Keep-Alive packet. This packet capture file reproduces the problem. Please change the filename suffix to pcapng
Keep-Alive.zip

@gyl30
Copy link
Contributor Author

gyl30 commented Oct 9, 2024

It is a common windows behaviour https://osqa-ask.wireshark.org/questions/44609/wireshark-tcp-keep-alive-detection/

Same problem, I should have caught it earlier

@seladb
Copy link
Owner

seladb commented Oct 9, 2024

@gyl30 how come the TCP flow doesn't start with SYN? 🤔

@gyl30
Copy link
Contributor Author

gyl30 commented Oct 9, 2024

@gyl30 how come the TCP flow doesn't start with SYN? 🤔为什么 TCP 流不以 SYN 开头? 🤔

PcapPlusPlus works fine if you start from the SYN of the TCP stream, the problem I encountered in my client environment did not capture the SYN of the TCP stream for some unknown reason.Keep-Alive.zip was intentionally caused by me in order to reproduce the problem. I now know that this phenomenon is not a problem. This issue can be closed now.

@gyl30 gyl30 closed this as completed Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants