From owner-freebsd-net Fri Mar 22 18:53:59 2002 Delivered-To: freebsd-net@freebsd.org Received: from wall.polstra.com (wall-gw.polstra.com [206.213.73.130]) by hub.freebsd.org (Postfix) with ESMTP id BE6C637B404 for ; Fri, 22 Mar 2002 18:53:55 -0800 (PST) Received: from vashon.polstra.com (vashon.polstra.com [206.213.73.13]) by wall.polstra.com (8.11.3/8.11.3) with ESMTP id g2N2rro30056; Fri, 22 Mar 2002 18:53:53 -0800 (PST) (envelope-from jdp@wall.polstra.com) Received: (from jdp@localhost) by vashon.polstra.com (8.11.6/8.11.0) id g2N2rqj07849; Fri, 22 Mar 2002 18:53:52 -0800 (PST) (envelope-from jdp) Date: Fri, 22 Mar 2002 18:53:52 -0800 (PST) Message-Id: <200203230253.g2N2rqj07849@vashon.polstra.com> To: net@freebsd.org From: John Polstra Cc: dinesh@verniernetworks.com Subject: Re: Socket buffer size limitation In-Reply-To: <20020322172352.R60156-100000@getafix.verniernetworks.com> References: <20020322172352.R60156-100000@getafix.verniernetworks.com> Organization: Polstra & Co., Seattle, WA Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org In article <20020322172352.R60156-100000@getafix.verniernetworks.com>, Dinesh Nambisan wrote: > Hello, > I have a situation where I'm trying to set the send and receive buffer > sizes on a socket to large values like 1 MB or so (dont ask why :-), > simple reason being we need it); and setsockopt for setting the buffer > sizes seems to fail with ENOBUFS. On looking at the code in uipc_socket.c > where it handles the SO_SNDBUF & SO_RCVBUF options, and the code in > uipc_socket2.c where it actually tries to reserve space (in sbreserve > function_, the issue seems to be a limit imposed by the code to > approx 227K or so [ sb_max(=256) * MCLBYTES / (MSIZE + MCLBYTES) ; which > works out to approx 227 K on my platform] > Was wondering if anyone could explain as to why this limit is there ? It's probably there to prevent a hostile or broken process from consuming all of the mbufs and/or mbuf clusters. You can change the limit via the sysctl variable "kern.ipc.maxsockbuf". John -- John Polstra John D. Polstra & Co., Inc. Seattle, Washington USA "Disappointment is a good sign of basic intelligence." -- Chögyam Trungpa To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message