OSDN Git Service

[NETLINK]: Mirror UDP MSG_TRUNC semantics.
authorDavid S. Miller <davem@sunset.davemloft.net>
Wed, 7 Mar 2007 01:02:35 +0000 (17:02 -0800)
committerDavid S. Miller <davem@sunset.davemloft.net>
Thu, 26 Apr 2007 05:23:35 +0000 (22:23 -0700)
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>
net/netlink/af_netlink.c

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