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 <[EMAIL PROTECTED]>
--- llc.orig/net/llc/af_llc.c
+++ llc/net/llc/af_llc.c
@@ -674,7 +674,7 @@ static int llc_ui_recvmsg(struct kiocb *
 
        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 *
                        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

--

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to