From owner-freebsd-net Wed Mar 14 12:18:27 2001 Delivered-To: freebsd-net@freebsd.org Received: from whale.sunbay.crimea.ua (whale.sunbay.crimea.ua [212.110.138.65]) by hub.freebsd.org (Postfix) with ESMTP id 98ACB37B719 for ; Wed, 14 Mar 2001 12:18:20 -0800 (PST) (envelope-from ru@whale.sunbay.crimea.ua) Received: (from ru@localhost) by whale.sunbay.crimea.ua (8.11.2/8.11.2) id f2EKI3084227; Wed, 14 Mar 2001 22:18:03 +0200 (EET) (envelope-from ru) Date: Wed, 14 Mar 2001 22:18:03 +0200 From: Ruslan Ermilov To: David Malone Cc: freebsd-net@FreeBSD.ORG Subject: Re: UDP datagram max size. Message-ID: <20010314221803.A80894@sunbay.com> Mail-Followup-To: David Malone , freebsd-net@FreeBSD.ORG References: <200103141703.aa78458@salmon.maths.tcd.ie> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200103141703.aa78458@salmon.maths.tcd.ie>; from dwmalone@maths.tcd.ie on Wed, Mar 14, 2001 at 05:03:10PM +0000 Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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, ru@sunbay.com Sunbay Software AG, ru@FreeBSD.org 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 majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message