On Wed, Mar 14, 2001 at 05:03:10PM +0000, David Malone wrote:
> I'm trying to figure out what #define I should use for the largest
> UDP datagram. The header files don't seem to define a constant for
> this. The correct size would seem to be 65535 'cos there are two
> bytes in the UDP header for the size.
> 
> IP_MAXPACKET and IPV6_MAXPACKET are available and have the right
> values, but these don't really seem to be the correct thing to use
> 'cos they don't take headers or the possibility Jumbo payload into
> account.
> 
> I wanted to commit something for:
> 
>       http://www.FreeBSD.org/cgi/query-pr.cgi?pr=25050
> 
> but I'm not convinced that the patch is spot on. I could determine
> the data size and malloc memory dynamically I guess.
> 
The maximum size of IPv4 UDP datagram is 65535-28=65507:

        IP_MAXPACKET - sizeof(struct ip) - sizeof(struct udp)

provided that the send/receive buffers were set appropriately:

: tcpdump: listening on lo0
: 127.0.0.1.49431 > 127.0.0.1.1:  udp 65507 (frag 7691:16360@0+)
: 127.0.0.1 > 127.0.0.1: (frag 7691:16360@16360+)
: 127.0.0.1 > 127.0.0.1: (frag 7691:16360@32720+)
: 127.0.0.1 > 127.0.0.1: (frag 7691:16360@49080+)
: 127.0.0.1 > 127.0.0.1: (frag 7691:75@65440)



-- 
Ruslan Ermilov          Oracle Developer/DBA,
[EMAIL PROTECTED]           Sunbay Software AG,
[EMAIL PROTECTED]          FreeBSD committer,
+380.652.512.251        Simferopol, Ukraine

http://www.FreeBSD.org  The Power To Serve
http://www.oracle.com   Enabling The Information Age

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-net" in the body of the message

Reply via email to