Skip to content

Commit

Permalink
[LLC]: allow datagram recvmsg
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Stephen Hemminger authored and David S. Miller committed Jun 18, 2006
1 parent aecbd4e commit 29efcd2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/llc/af_llc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 29efcd2

Please sign in to comment.