Long
Long

Reputation: 155

Problem with using IPPROTO_RAW with source address filled in when zero

https://man7.org/linux/man-pages/man7/raw.7.html

enter image description here

  1. I am using IPPROTO_RAW to send my tcp packet
  2. I spefic 0.0.0.0 to source address, so linux kernel will auto fill, and ip checksum auto filled in.
  3. I can't calc correct tcp checksum because i don't know what kernel fill in source address
  4. tcpdump always show cksum is incorrect, and i see the sourse address is filled by kernel good.

Maybe is there a way tell kernel auto calc the tcp checksum?

enter image description here

Upvotes: 0

Views: 70

Answers (1)

Streve Ford
Streve Ford

Reputation: 505

I'm guessing that you ran the tcpdump on the same host that is sending the packet. Most NICs will do the checksum calculation in hardware as the packet is being sent. The tcpdump sees the packet before it is sent, so it doesn't see the right checksum.

Try running tcpdump on the destination machine. Hopefully it will see the right checksum.

Upvotes: 0

Related Questions