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

Incorrect ICMP packet header parsing #1

Open
makstamoian opened this issue Oct 14, 2022 · 0 comments
Open

Incorrect ICMP packet header parsing #1

makstamoian opened this issue Oct 14, 2022 · 0 comments

Comments

@makstamoian
Copy link

ICMP packet headers are parsed wrongly. Since SOCK_RAW is used, the result of recvfrom also includes IP headers. Therefore, ICMP headers begin after IP headers end – in your case, they start not at &pckt, but at &pckt + ip_headers_length point. You need to use iphdr struct, to parse them properly.

This line is entirely wrong:

ping/ping.cpp

Line 235 in 05dbc75

if ( !(pckt.hdr.type == 69 && pckt.hdr.code == 0) )

type and code would be a part of IP headers and the number 69 has nothing to do with the ICMP protocol.

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