[NETLINK]: Mirror UDP MSG_TRUNC semantics.

If the user passes MSG_TRUNC in via msg_flags, return
the full packet size not the truncated size.

Idea from Herbert Xu and Thomas Graf.

Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
David S. Miller 2007-03-06 17:02:35 -08:00
parent b7aa0bf70c
commit b558ff7999

View File

@ -1242,6 +1242,9 @@ static int netlink_recvmsg(struct kiocb *kiocb, struct socket *sock,
scm_recv(sock, msg, siocb->scm, flags); scm_recv(sock, msg, siocb->scm, flags);
if (flags & MSG_TRUNC)
copied = skb->len;
out: out:
netlink_rcv_wake(sk); netlink_rcv_wake(sk);
return err ? : copied; return err ? : copied;