bin/65928: [PATCH] stock ftpd uses superuser credentials for active mode sockets

Yar Tikhiy yar at comp.chem.msu.su
Sat May 15 11:22:01 PDT 2004


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 &


More information about the freebsd-net mailing list