NetBSD Problem Report #20817

Received: (qmail 25684 invoked by uid 605); 20 Mar 2003 10:00:11 -0000
Message-Id: <200303201000.h2KA06p04637@o065157.ap.plala.or.jp>
Date: Thu, 20 Mar 2003 19:00:05 +0900 (JST)
From: itohy@netbsd.org
Sender: gnats-bugs-owner@netbsd.org
Reply-To: itohy@netbsd.org
To: gnats-bugs@gnats.netbsd.org
Subject: inetd doesn't accept tcp,rcvbuf=16384 et al.
X-Send-Pr-Version: 3.95

>Number:         20817
>Category:       bin
>Synopsis:       inetd doesn't accept tcp,rcvbuf=16384 et al.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 20 10:01:01 +0000 2003
>Closed-Date:    
>Last-Modified:  Thu Mar 20 22:02:00 +0000 2003
>Originator:     ITOH Yasufumi
>Release:        NetBSD 1.6L
>Organization:
>Environment:
System: NetBSD pino.my.domain 1.6L NetBSD 1.6L (PINO) #352: Wed Jan 15 01:30:30 JST 2003 itohy@pino.my.domain:/w/src/sys/arch/i386/compile/PINO i386
Architecture: i386
Machine: i386

>Description:
The inetd(8) manual page mentions TCP buffer size options,
rcvbuf and sndbuf.

	inetd(8) reads:
	> The socket buffer sizes are specified by appending their
	> values to the protocol specification as follows:
	>
	>	tcp,rcvbuf=16384
	>	tcp,sndbuf=64k
	>	tcp,rcvbuf=64k,sndbuf=1m

However, the first form (no suffix) is not accepted.

>How-To-Repeat:
Use the following line (for example) in /etc/inetd.conf

	discard	stream	tcp,rcvbuf=16384	nowait	nobody	internal

and see the following error mesage in /var/log/messages.

	inetd[244]: discard: malformed buffer size option `16384'

>Fix:
	Here's suggested fix.

--- inetd.c.orig	Wed Feb 19 19:24:56 2003
+++ inetd.c	Thu Mar 20 13:01:35 2003
@@ -1415,12 +1415,16 @@
 		MALFORMED(arg); \
 	val = strtol((arg), &cp0, 10); \
 	if (cp0 != NULL) { \
-		if (cp0[1] != '\0') \
+		if (cp0[0] != '\0') \
+			; \
+		else if (cp0[1] != '\0') \
 			MALFORMED((arg)); \
-		if (cp0[0] == 'k') \
+		else if (cp0[0] == 'k') \
 			val *= 1024; \
-		if (cp0[0] == 'm') \
+		else if (cp0[0] == 'm') \
 			val *= 1024 * 1024; \
+		else \
+			MALFORMED((arg)); \
 	} \
 	if (val < 1) { \
 		syslog(LOG_ERR, "%s: invalid buffer size `%s'", \

>Release-Note:
>Audit-Trail:

From: David Laight <david@l8s.co.uk>
To: netbsd-bugs@netbsd.org
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: bin/20817: inetd doesn't accept tcp,rcvbuf=16384 et al.
Date: Thu, 20 Mar 2003 18:20:04 +0000

 >  		MALFORMED(arg); \
 >  	val = strtol((arg), &cp0, 10); \
 >  	if (cp0 != NULL) { \
 > -		if (cp0[1] != '\0') \
 > +		if (cp0[0] != '\0') \
 > +			; \
 > +		else if (cp0[1] != '\0') \
 >  			MALFORMED((arg)); \
 > -		if (cp0[0] == 'k') \
 > +		else if (cp0[0] == 'k') \
 >  			val *= 1024; \
 > -		if (cp0[0] == 'm') \
 > +		else if (cp0[0] == 'm') \
 >  			val *= 1024 * 1024; \
 > +		else \
 > +			MALFORMED((arg)); \
 >  	} \
 >  	if (val < 1) { \
 >  		syslog(LOG_ERR, "%s: invalid buffer size `%s'", \

 It that really a #define ? No wonder we have code bloat...

 	David

 -- 
 David Laight: david@l8s.co.uk

From: Luke Mewburn <lukem@netbsd.org>
To: itohy@netbsd.org
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: bin/20817: inetd doesn't accept tcp,rcvbuf=16384 et al.
Date: Fri, 21 Mar 2003 09:01:54 +1100

 On Thu, Mar 20, 2003 at 07:00:05PM +0900, itohy@netbsd.org wrote:
   | The inetd(8) manual page mentions TCP buffer size options,
   | rcvbuf and sndbuf.
   | 
   | 	inetd(8) reads:
   | 	> The socket buffer sizes are specified by appending their
   | 	> values to the protocol specification as follows:
   | 	>
   | 	>	tcp,rcvbuf=16384
   | 	>	tcp,sndbuf=64k
   | 	>	tcp,rcvbuf=64k,sndbuf=1m
   | 
   | However, the first form (no suffix) is not accepted.
   | 
   | >Fix:
   | 	Here's suggested fix.

 take a look at strsuftollx(3).  it could help simplify a lot of this.
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.