I want to stuff data into a packet, but I want to make sure that the packet does not exceed 512 bytes, so I need to know what the initial size of a UDP packet is so I know how much data I can put into the packet. I did some snooping around on Google, but I found answers that were contradictory. I'm using IPv6. Thanks in advance to anyone who replies!
Asked
Active
Viewed 821 times
1
-
Is your actual question what the minimum size of a UDP packet is? If so this has been asked and answered a few times. What's your reason for wanting to limit your packet size? 512 bytes is coincidentally the size imposed by DNS, have you seen this post ? – Reaces Jan 08 '15 at 12:48
1 Answers
3
Why not start with the RFCs or Wikipedia:
- UDP: https://www.rfc-editor.org/rfc/rfc768 and http://en.wikipedia.org/wiki/User_Datagram_Protocol
- IPv6: https://www.rfc-editor.org/rfc/rfc2460 and http://en.wikipedia.org/wiki/IPv6_packet
Result: 40 Byte for the minimal fixed IPv6 header and 8 byte for the UDP header
But: IPv6 has extension headers of variable length. Some of them can (theoetically) reach a length of 256 Bytes, so it's entirely possible to have a packet exceeding 512 byes without any payload.