0

I am doing raw socket programming and trying to send TCP packets. I have created ethernet header, IPv4 header and TCP header. The ethernet header is 14 bytes long, IPv4 header is 20 bytes long and the TCP header is 20 bytes long.I have checked with Wireshark and found that everything is fine except the TCP header checksum. I have impleted the checksum function correct since the IPv4 checksum is correct. So I checked the packet on WireShark and found that extra 6 bytes are there at the end of the packed. Total length of the packed is 54 bytes, but insted over the network 60 bytes are sent.On Wireshark, under ethernet header Padding: 000000000000 is shown.

I have no idea how these extra 6 bytes are added at the end of my packed since the total length of the packet is 54 bytes.

But I habe also noticed that, if I add TCP payload at the end of the packed, the extra padding bytes are not added by the OS.

Please help.

Thanks.

0

1 Answer 1

0

Ethernet has a minimum packet size of 64 bytes including checksum = 60 bytes not including checksum

Sign up to request clarification or add additional context in comments.

2 Comments

Ok. Does this mean that since the minimum ethernet packet should be 60 bytes, the extra 6 bytes are added by the OS before sending over the network ?
@anbocode Yes..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.