patch-2.2.17 linux/net/ipv4/af_inet.c

Next file: linux/net/ipv4/ip_fw.c
Previous file: linux/net/core/sock.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.16/net/ipv4/af_inet.c linux/net/ipv4/af_inet.c
@@ -118,8 +118,6 @@
 
 #define min(a,b)	((a)<(b)?(a):(b))
 
-struct linux_mib net_statistics;
-
 extern int raw_get_info(char *, char **, off_t, int, int);
 extern int snmp_get_info(char *, char **, off_t, int, int);
 extern int netstat_get_info(char *, char **, off_t, int, int);
@@ -281,7 +279,8 @@
 	struct sock *sk = sock->sk;
 	unsigned char old_state;
 
-	if (sock->state != SS_UNCONNECTED || sock->type != SOCK_STREAM)
+	if (sock->state != SS_UNCONNECTED || sock->type != SOCK_STREAM ||
+	    !((1<<sk->state)&(TCPF_CLOSE|TCPF_LISTEN)))
 		return(-EINVAL);
 
 	if ((unsigned) backlog == 0)	/* BSDism */
@@ -699,9 +698,6 @@
 	sk2->socket = newsock;
 	newsk->socket = NULL;
 
-	if (flags & O_NONBLOCK)
-		goto do_half_success;
-
 	if(sk2->state == TCP_ESTABLISHED)
 		goto do_full_success;
 	if(sk2->err > 0)
@@ -713,10 +709,6 @@
 	destroy_sock(newsk);
 	newsock->state = SS_CONNECTED;
 	return 0;
-
-do_half_success:
-	destroy_sock(newsk);
-	return(0);
 
 do_connect_err:
 	err = sock_error(sk2);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)