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.