NetBSD Problem Report #17616

Received: (qmail 19663 invoked by uid 605); 16 Jul 2002 21:12:17 -0000
Message-Id: <>
Date: 16 Jul 2002 21:12:16 -0000
Subject: accept on a tcp socket loses options
X-Send-Pr-Version: 3.95

>Number:         17616
>Category:       kern
>Synopsis:       accept on a tcp socket loses options
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jul 16 21:13:01 +0000 2002
>Originator:     Bill Studenmund
>Release:        NetBSD 1.6, though it has been around a while


System: NetBSD mail 1.5 NetBSD 1.5 (HOMEWORLD) #0: Sat Feb 10 08:13:16 EET 2001 i386

	When a listening tcp socket gains a new connection (which will be
retrieved by accept(2)), the tcp options of the listening socket
are not copied over. Quoting man 2 accept, "The accept() argument
extracts the first connection request on the queue of pending
connections, creates a new socket with the same properties of s
[the accepted-on socket] and allocates a new file descriptor for
the socket." tcp options certainly are properties of the accepted-
on socket (though admittedly not socket-level ones).
	Other operating systems, such as Linux, do copy over the
tcp options. While I don't think we should do something just because
someone else did, in this case, I think copying tcp options is the
right thing to do.


	Create a tcp socket & bind it to an address. Set tcp options
on it, such as TCP_NODELAY. accept() a new connection. You now have
a socket without the option(s) you set above.


	Not sure. But when we transition a tcp connection from
TCPS_SYN_RECEIVED to ESTABLISHED, we should copy the tcp options
of the listen-on socket. One possible way to do this is to save
the tcp options along with the ip options when we add an entry to
the syn cache.

NetBSD Home
NetBSD PR Database Search

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