Skip to content

Use of WriteHeaderIncludePacket for ICMP reply packets causes test failures on raw packet receive. #3902

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

Closed
jelischer opened this issue Sep 10, 2020 · 1 comment

Comments

@jelischer
Copy link
Contributor

jelischer commented Sep 10, 2020

If WriteHeaderIncludePacket() is used for sending echo reply from network/ipv4/icmp.go then then programs that use raw sockets to watch for both request and reply packets start to experience failures. The replies sent on the wire appear correct and pass external tests however something seems to go terribly wrong with the looped copies of those packets.

Specifically several tests in https://github.com/google/gvisor/blob/master/test/syscalls/linux/raw_socket_icmp.cc start failing.

The packet generated in an attempt to use WriteHeaderIncludePacket() is correct and includes the entire outgoing packet in the Data buffer. The packet received externally is identical to that sent using WritePacket(). I would like to use WriteHeaderIncludePacket as RFC 792 requires that the ICMP code also have some had in the IP header contents and WritePacket has no way to do that. (without patching) where WriteHeaderIncludePacket() is designed to allow this.

To reproduce: change the code in ipv4/icmp.go to create a full packet and use WriteHeaderIncludePacket() to send it. Then from the gvisor directory run "make tests". Six tests will fail, all with similar symptoms. RawSocketICMPTest::ExpectICMPSuccess() will fail.

Linux julian-desk.xxxxxxxxx 5.6.14-2rodete5-amd64 #1 SMP Debian 5.6.14-2rodete5 (2020-07-31 > 2018) x86_64 GNU/Linux

@jelischer
Copy link
Contributor Author

It appears that this issue may have another root cause. The problem is resolved when a copy of the incoming packet in the icmp echo code is replaced with a deep copy, suggesting that the issue is related to header changes in the raw socket code being reflected in the outgoing echo packet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant