patch-2.1.106 linux/net/ipv4/udp.c

Next file: linux/net/ipv6/af_inet6.c
Previous file: linux/net/ipv4/tcp_output.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.105/linux/net/ipv4/udp.c linux/net/ipv4/udp.c
@@ -5,7 +5,7 @@
  *
  *		The User Datagram Protocol (UDP).
  *
- * Version:	$Id: udp.c,v 1.56 1998/05/08 21:06:30 davem Exp $
+ * Version:	$Id: udp.c,v 1.57 1998/05/14 06:32:44 davem Exp $
  *
  * Authors:	Ross Biro, <bir7@leland.Stanford.Edu>
  *		Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
@@ -57,6 +57,8 @@
  *		Andi Kleen	:	Some cleanups, cache destination entry
  *					for connect. 
  *	Vitaly E. Lavrov	:	Transparent proxy revived after year coma.
+ *		Melvin Smith	:	Check msg_name not msg_namelen in sendto(),
+ *					return ENOTCONN for unconnected sockets (POSIX)
  *
  *
  *		This program is free software; you can redistribute it and/or
@@ -657,7 +659,7 @@
 	 *	Get and verify the address. 
 	 */
 	 
-	if (msg->msg_namelen) {
+	if (msg->msg_name) {
 		struct sockaddr_in * usin = (struct sockaddr_in*)msg->msg_name;
 		if (msg->msg_namelen < sizeof(*usin))
 			return(-EINVAL);
@@ -684,7 +686,7 @@
 		 */
 	} else {
 		if (sk->state != TCP_ESTABLISHED)
-			return -EINVAL;
+			return -ENOTCONN;
 		ufh.daddr = sk->daddr;
 		ufh.uh.dest = sk->dport;
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov