netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] make sendmsg return EDESTADDRREQ if socket is not connected and daddr was not specified
@ 2003-07-10 23:32 Thomas Graf
  2003-07-11  0:29 ` David S. Miller
  2003-07-11  0:35 ` YOSHIFUJI Hideaki / 吉藤英明
  0 siblings, 2 replies; 6+ messages in thread
From: Thomas Graf @ 2003-07-10 23:32 UTC (permalink / raw)
  To: davem; +Cc: netdev, tgraf

Hello

Another 1003.1 fix:

[EDESTADDRREQ]
    The socket is not connection-mode and does not have its peer
    address set, and no destination address was specified.

fixes sendmsg in ipv{4,6}/{raw,udp}

 -- thomas


Index: net/ipv4/raw.c
===================================================================
RCS file: /cvs/tgr/linux-25/net/ipv4/raw.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 raw.c
--- net/ipv4/raw.c	10 Jul 2003 22:58:45 -0000	1.1.1.2
+++ net/ipv4/raw.c	10 Jul 2003 23:18:04 -0000
@@ -383,7 +383,7 @@
 		 * IP_HDRINCL is much more convenient.
 		 */
 	} else {
-		err = -EINVAL;
+		err = -EDESTADDRREQ;
 		if (sk->sk_state != TCP_ESTABLISHED) 
 			goto out;
 		daddr = inet->daddr;
Index: net/ipv4/udp.c
===================================================================
RCS file: /cvs/tgr/linux-25/net/ipv4/udp.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 udp.c
--- net/ipv4/udp.c	9 Jul 2003 18:42:29 -0000	1.1.1.1
+++ net/ipv4/udp.c	10 Jul 2003 23:18:04 -0000
@@ -540,7 +540,7 @@
 			return -EINVAL;
 	} else {
 		if (sk->sk_state != TCP_ESTABLISHED)
-			return -ENOTCONN;
+			return -EDESTADDRREQ;
 		daddr = inet->daddr;
 		dport = inet->dport;
 		/* Open fast path for connected socket.
Index: net/ipv6/raw.c
===================================================================
RCS file: /cvs/tgr/linux-25/net/ipv6/raw.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 raw.c
--- net/ipv6/raw.c	10 Jul 2003 22:58:50 -0000	1.1.1.2
+++ net/ipv6/raw.c	10 Jul 2003 23:18:04 -0000
@@ -602,7 +602,7 @@
 			fl.oif = sin6->sin6_scope_id;
 	} else {
 		if (sk->sk_state != TCP_ESTABLISHED) 
-			return(-EINVAL);
+			return -EDESTADDRREQ;
 		
 		proto = inet->num;
 		daddr = &np->daddr;
Index: net/ipv6/udp.c
===================================================================
RCS file: /cvs/tgr/linux-25/net/ipv6/udp.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 udp.c
--- net/ipv6/udp.c	9 Jul 2003 18:42:35 -0000	1.1.1.1
+++ net/ipv6/udp.c	10 Jul 2003 23:18:04 -0000
@@ -862,7 +862,7 @@
 			fl.oif = sin6->sin6_scope_id;
 	} else {
 		if (sk->sk_state != TCP_ESTABLISHED)
-			return -ENOTCONN;
+			return -EDESTADDRREQ;
 
 		up->dport = inet->dport;
 		daddr = &np->daddr;

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-07-11  0:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-07-10 23:32 [PATCH] make sendmsg return EDESTADDRREQ if socket is not connected and daddr was not specified Thomas Graf
2003-07-11  0:29 ` David S. Miller
2003-07-11  0:35 ` YOSHIFUJI Hideaki / 吉藤英明
2003-07-11  0:29   ` David S. Miller
2003-07-11  0:41     ` YOSHIFUJI Hideaki / 吉藤英明
2003-07-11  0:37   ` YOSHIFUJI Hideaki / 吉藤英明

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).