X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=net%2Fllc%2Faf_llc.c;h=5a04db745c8d64394ce074cdecaa69d84ede0aa0;hb=9464c7cf61b9433057924c36e6e02f303a00e768;hp=2652ead96c64e329b7c2f929316d1324d8aecfd5;hpb=41689045f6a3cbe0550e1d34e9cc20d2e8c432ba;p=linux-2.6.git diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c index 2652ead96..5a04db745 100644 --- a/net/llc/af_llc.c +++ b/net/llc/af_llc.c @@ -20,6 +20,7 @@ * * See the GNU General Public License for more details. */ +#include #include #include #include @@ -673,7 +674,7 @@ static int llc_ui_recvmsg(struct kiocb *iocb, struct socket *sock, lock_sock(sk); copied = -ENOTCONN; - if (unlikely(sk->sk_type == SOCK_STREAM && sk->sk_state == TCP_LISTEN)) + if (sk->sk_state == TCP_LISTEN) goto out; timeo = sock_rcvtimeo(sk, nonblock); @@ -732,7 +733,7 @@ static int llc_ui_recvmsg(struct kiocb *iocb, struct socket *sock, if (sk->sk_shutdown & RCV_SHUTDOWN) break; - if (sk->sk_type == SOCK_STREAM && sk->sk_state == TCP_CLOSE) { + if (sk->sk_state == TCP_CLOSE) { if (!sock_flag(sk, SOCK_DONE)) { /* * This occurs when user tries to read @@ -784,20 +785,24 @@ static int llc_ui_recvmsg(struct kiocb *iocb, struct socket *sock, copied += used; len -= used; + if (used + offset < skb->len) + continue; + if (!(flags & MSG_PEEK)) { - sk_eat_skb(sk, skb, 0); + sk_eat_skb(sk, skb); *seq = 0; } - - /* For non stream protcols we get one packet per recvmsg call */ - if (sk->sk_type != SOCK_STREAM) - goto copy_uaddr; - - /* Partial read */ - if (used + offset < skb->len) - continue; } while (len > 0); + /* + * According to UNIX98, msg_name/msg_namelen are ignored + * on connected socket. -ANK + * But... af_llc still doesn't have separate sets of methods for + * SOCK_DGRAM and SOCK_STREAM :-( So we have to do this test, will + * eventually fix this tho :-) -acme + */ + if (sk->sk_type == SOCK_DGRAM) + goto copy_uaddr; out: release_sock(sk); return copied;