From owner-freebsd-net@FreeBSD.ORG Sat May 15 11:22:01 2004 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4F43116A4CE; Sat, 15 May 2004 11:22:01 -0700 (PDT) Received: from comp.chem.msu.su (comp.chem.msu.su [158.250.32.97]) by mx1.FreeBSD.org (Postfix) with ESMTP id 36B9E43D45; Sat, 15 May 2004 11:22:00 -0700 (PDT) (envelope-from yar@comp.chem.msu.su) Received: from comp.chem.msu.su (localhost [127.0.0.1]) by comp.chem.msu.su (8.12.9p2/8.12.9) with ESMTP id i4FILw3F092103; Sat, 15 May 2004 22:21:58 +0400 (MSD) (envelope-from yar@comp.chem.msu.su) Received: (from yar@localhost) by comp.chem.msu.su (8.12.9p2/8.12.9/Submit) id i4FILvqB092102; Sat, 15 May 2004 22:21:57 +0400 (MSD) (envelope-from yar) Date: Sat, 15 May 2004 22:21:57 +0400 From: Yar Tikhiy To: arch@freebsd.org, net@freebsd.org Message-ID: <20040515182157.GB89625@comp.chem.msu.su> References: <20040508034514.GA937@grosbein.pp.ru> <20040508132354.GB44214@comp.chem.msu.su> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040508132354.GB44214@comp.chem.msu.su> User-Agent: Mutt/1.5.6i cc: Eugene Grosbein Subject: Re: bin/65928: [PATCH] stock ftpd uses superuser credentials for active mode sockets X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 May 2004 18:22:01 -0000 Hi folks, Attached below is a patch addressing the issue of the inability to reuse a local IP:port couple occupied by an established TCP connection from another user, but by no listeners. Could anybody with fair understanding of our TCP/IP stack review it please? Thanks. -- Yar Index: in_pcb.c =================================================================== RCS file: /home/ncvs/src/sys/netinet/in_pcb.c,v retrieving revision 1.146 diff -u -p -r1.146 in_pcb.c --- in_pcb.c 23 Apr 2004 23:29:49 -0000 1.146 +++ in_pcb.c 15 May 2004 17:37:18 -0000 @@ -340,6 +340,8 @@ in_pcbbind_setup(inp, nam, laddrp, lport return (EADDRINUSE); } else if (t && + (so->so_type != SOCK_STREAM || + ntohl(t->inp_faddr.s_addr) == INADDR_ANY) && (ntohl(sin->sin_addr.s_addr) != INADDR_ANY || ntohl(t->inp_laddr.s_addr) != INADDR_ANY || (t->inp_socket->so_options &