top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

At the receiver side, how to determine the length of actual data and padding in a IPv4 packet?

0 votes
41 views

If the length of IPv4 datagram is less than 46 bytes then padding bits are added to it as minimum length allowed in ethernet frame is 46 bytes.

Question : At the receiver side, how to determine the length of actual data and padding?

posted May 23, 2017 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

This is very simple, the padding is done in MAC layer (L2).

Consider IPv4 header as the responsible of getting the packet from one entity to another in an IP network. IP header contains field called "TotalLength" in 32bit word resolution.

the size received by the MAC is not important, so when a receiver wants to know the payload data size it base it's calculation on the IP header "TotalLength" field and similar fields in ip and higher layers (in TCP).

for example you have TCP above the IPv4, TCP has similar field that says where the data starts from the beginning of the TCP header again in 32bit resolution. if no TCP options are used than TCP header size is 20bytes

ActualDataSize = TotalLength - (IP_Header_Length*4) - (TcpDataOffset *4)

in UDP the header size is fixed so calculation is simpler.

answer May 26, 2017 by anonymous
Similar Questions
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...