Skip to content

icmp: fix reply4() - #183

Merged
ignoramous merged 1 commit into
celzero:n2from
Lanius-collaris:fix-icmpv4
Aug 27, 2025
Merged

icmp: fix reply4()#183
ignoramous merged 1 commit into
celzero:n2from
Lanius-collaris:fix-icmpv4

Conversation

@Lanius-collaris

Copy link
Copy Markdown
Contributor
haha debug replyBuf: [65 0 0 84 237 199 64 0 128 1 190 171 9 9 9 9 10 0 2 100 0 0 239 131 12 60 0 0 74 174 185 145 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
E async.go:21>icmp.go:158: icmp: v4: 9: wrote reply to tun; err? header is malformed

Firestack misused IPv4.SetHeaderLength(), replyHeaderLength >> 2 is unnecessary.

replyIPHdr.SetHeaderLength(replyHeaderLength >> 2) // IHL in 32-bit words.

https://github.com/google/gvisor/blob/738e1d995f64d20fd11ab59a88d12b524acb672e/pkg/tcpip/header/ipv4.go#L298

The upstream has merged Amaindex's pull request google/gvisor#11609 , so my small changes should work.

@ignoramous
ignoramous merged commit 0dc35ce into celzero:n2 Aug 27, 2025
6 of 8 checks passed
@ignoramous

Copy link
Copy Markdown
Contributor

Thanks!

@Lanius-collaris

Copy link
Copy Markdown
Contributor Author

Oh, I forgot to call replyPkt.DecRef(), merging #142 will fix it.

@ignoramous

Copy link
Copy Markdown
Contributor

Is #142 required when google/gvisor#11609 is present in upstream?

@Lanius-collaris

Lanius-collaris commented Aug 28, 2025

Copy link
Copy Markdown
Contributor Author

Is #142 required when google/gvisor#11609 is present in upstream?

google/gvisor#11609 didn't touch ICMPv6, as current gvisor never delivers ICMPv6 Echo Request Messages to TransportProtocolHandler, I suggest using iptables hack for now.

😇 Maybe libslirp in AVD is too old, I can't test ping6 in emulator, but icmp-hack branch does work on physical devices.

@Lanius-collaris
Lanius-collaris deleted the fix-icmpv4 branch August 28, 2025 02:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants