From owner-freebsd-current Wed Feb 26 1:32:46 2003 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4CFF437B401 for ; Wed, 26 Feb 2003 01:32:44 -0800 (PST) Received: from smtp02.syd.iprimus.net.au (smtp02.syd.iprimus.net.au [210.50.76.70]) by mx1.FreeBSD.org (Postfix) with ESMTP id 523AD43FAF for ; Wed, 26 Feb 2003 01:32:43 -0800 (PST) (envelope-from tim@robbins.dropbear.id.au) Received: from dilbert.robbins.dropbear.id.au ([210.50.248.237]) by smtp02.syd.iprimus.net.au with Microsoft SMTPSVC(5.0.2195.5600); Wed, 26 Feb 2003 20:32:39 +1100 Received: from dilbert.robbins.dropbear.id.au (cd202wtx33hai1je@localhost [127.0.0.1]) by dilbert.robbins.dropbear.id.au (8.12.6/8.12.6) with ESMTP id h1Q9Wbn1045642 for ; Wed, 26 Feb 2003 20:32:37 +1100 (EST) (envelope-from tim@dilbert.robbins.dropbear.id.au) Received: (from tim@localhost) by dilbert.robbins.dropbear.id.au (8.12.6/8.12.6/Submit) id h1Q9WbGV045641 for current@freebsd.org; Wed, 26 Feb 2003 20:32:37 +1100 (EST) (envelope-from tim) Date: Wed, 26 Feb 2003 20:32:36 +1100 From: Tim Robbins To: current@freebsd.org Subject: TCP is still broken Message-ID: <20030226203236.A45378@dilbert.robbins.dropbear.id.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i X-OriginalArrivalTime: 26 Feb 2003 09:32:40.0652 (UTC) FILETIME=[01D8A8C0:01C2DD7A] Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG This program, based on one from the Apache 2 configure script, still causes -current to lock up solid despite the recent bug fixes to the tcptw code. Explicitly closing connected_s before returning from main() seems to avoid the problem. #include #include #include #include #include #include int main(void) { int listen_s, connected_s, client_s; int listen_port, rc; struct sockaddr_in sa; socklen_t sa_len; socklen_t option_len; int option; listen_s = socket(AF_INET, SOCK_STREAM, 0); if (listen_s < 0) { perror("socket"); exit(1); } memset(&sa, 0, sizeof sa); sa.sin_family = AF_INET; /* leave port 0 to get ephemeral */ rc = bind(listen_s, (struct sockaddr *)&sa, sizeof sa); if (rc < 0) { perror("bind for ephemeral port"); exit(1); } /* find ephemeral port */ sa_len = sizeof(sa); rc = getsockname(listen_s, (struct sockaddr *)&sa, &sa_len); if (rc < 0) { perror("getsockname"); exit(1); } listen_port = sa.sin_port; rc = listen(listen_s, 5); if (rc < 0) { perror("listen"); exit(1); } client_s = socket(AF_INET, SOCK_STREAM, 0); if (client_s < 0) { perror("socket"); exit(1); } memset(&sa, 0, sizeof sa); sa.sin_family = AF_INET; sa.sin_port = listen_port; /* leave sin_addr all zeros to use loopback */ rc = connect(client_s, (struct sockaddr *)&sa, sizeof sa); if (rc < 0) { perror("connect"); exit(1); } sa_len = sizeof sa; connected_s = accept(listen_s, (struct sockaddr *)&sa, &sa_len); if (connected_s < 0) { perror("accept"); exit(1); } return 0; } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message