[LLC]: allow datagram recvmsg
authorStephen Hemminger <shemminger@osdl.org>
Thu, 25 May 2006 22:08:59 +0000 (15:08 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Sun, 18 Jun 2006 04:26:02 +0000 (21:26 -0700)
LLC receive is broken for SOCK_DGRAM.
If an application does recv() on a datagram socket and there
is no data present, don't return "not connected". Instead, just
do normal datagram semantics.

Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/llc/af_llc.c

index 7465170a36cabae04eca8f3f5d179924d0c33a58..75c9b1480801e2a52cc81ac96fbcfe21cbcc918e 100644 (file)
@@ -674,7 +674,7 @@ static int llc_ui_recvmsg(struct kiocb *iocb, struct socket *sock,
 
        lock_sock(sk);
        copied = -ENOTCONN;
-       if (sk->sk_state == TCP_LISTEN)
+       if (unlikely(sk->sk_type == SOCK_STREAM && sk->sk_state == TCP_LISTEN))
                goto out;
 
        timeo = sock_rcvtimeo(sk, nonblock);
@@ -733,7 +733,7 @@ static int llc_ui_recvmsg(struct kiocb *iocb, struct socket *sock,
                        if (sk->sk_shutdown & RCV_SHUTDOWN)
                                break;
 
-                       if (sk->sk_state == TCP_CLOSE) {
+                       if (sk->sk_type == SOCK_STREAM && sk->sk_state == TCP_CLOSE) {
                                if (!sock_flag(sk, SOCK_DONE)) {
                                        /*
                                         * This occurs when user tries to read