3

I'm learning some tcp/ip basics, and am having trouble understanding the Message Length field in UDP. In my book, it says that the Message Length represents the UDP header and data in octets, and since the UDP header is 8 octets, the minimum Message Length value is 8. I have a scenario where the UDP header is 8 octets, and the data is a 13 character string(13 octets). However, the example I'm looking at says the message length is 20 + 13, and then explains that it's 20 octets for the header and 13 octets for the data. I thought that UDP headers were 8 octets, not 20, so why is this 20?

I suspect that it might have to do with the pseudo header, which is 12 octets, so 12 from the pseudo and 8 from the actual header = 20 total header octets. Is this the case? It's really not making any sense to me. Also doesn't the 13 octet data need to be rounded to a multiple of 4? The way it is presented in my book makes it look like the data needs to be padded to 32 bits(4 octets).

Sorry for this confusion, just trying to understand the layout here. If you guys need any additional information just ask.

Here is the example

1 Answer 1

4

You're right UDP header is 8 bytes. So I can't really explain your 12+8 scenario. Pseudoheader refers to the header which is considered when calculating checksum, is is combination of IP + UDP + payload, but not all of if, hence pseudo.

20B is normal size for IPV4 (and TCP). So maybe confusion lies there?

If you can put your example online, it might help understanding what the author tries to communicate.

EDIT the packet you entered is 20+8+13 bytes. If your document claims 20+13, it is missing the UDP header.

6
  • I put the example there. This is for a homework assignment and my teacher filled out this part completely, showing us how a udp packet is sent inside an IP datagram inside an ethernet frame. It all makes sense to me, except the size. The message length in the UDP packet seems to be wrong, which then makes the total length field in the IP datagram wrong as well. Do you think it's just a typo? Commented May 29, 2013 at 21:26
  • 1
    Definitely typo in docs, if it says 20+13, 20 IPv4 + 8 UDP + 13 payload is correct answer for the IP packet. If we look at your ethernet (L1+L2) it is also incorrect, DMAC(6)+SMAC(6)+TYPE(2)+CRC (4) == L2, PREAMBLE(7)+START_FRAME_DELIMITER(1)+INTER_FRAME_GAP(12) are L1, (IFG==INTER_FRAME_GAP is omitted completely)
    – ytti
    Commented May 29, 2013 at 21:31
  • Ah, well that first typo explains things then. I'm sorry but what are L1 and L2? In my book the ethernet frame only has preamble, destination address, source address, frame type, frame data, and crc. Do you think my teacher is just trying to ignore that more complex stuff for this problem since this is a introductory course? Commented May 29, 2013 at 21:46
  • 1
    He is just forgetting about 'IFG' or inter_frame_gap, which is pause between two frames. Its lenght is 12B (it's really silent for a time it takes to send 12B). Usually premable+sfd+ifg are considered L1, dmac+smac+type+crc are considired L2, IP is consdered L3 and TCP/UDP are considered L4 as per OSI model
    – ytti
    Commented May 29, 2013 at 21:47
  • 1
    The length of the UDP data is exact number, not multiple of X, i.e. padding makes no sense.
    – ytti
    Commented May 30, 2013 at 6:56

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.