dccp: support for passing MSG_TRUNC
authorGerrit Renker <gerrit@erg.abdn.ac.uk>
Wed, 10 Feb 2010 20:26:18 +0000 (20:26 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sat, 13 Feb 2010 00:51:10 +0000 (16:51 -0800)
DCCP is datagram-oriented but lacks UDP's support for MSG_TRUNC as defined in
recvmsg(2)/recv(2). Hence the following 'Hello world\0' receiver

  len = recv(fd, buf, 10, MSG_PEEK | MSG_TRUNC);

wrongly (always) returns 10, while in UDP it returns 12 as expected.
This patch adds the missing MSG_TRUNC support to recvmsg().

Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/dccp/proto.c

index 671cd1413d59188982f066e6a2dd43cc40786659..85ec1cb7fd41015553b2f39c7eca6c3da020e908 100644 (file)
@@ -835,6 +835,8 @@ verify_sock_status:
                        len = -EFAULT;
                        break;
                }
+               if (flags & MSG_TRUNC)
+                       len = skb->len;
        found_fin_ok:
                if (!(flags & MSG_PEEK))
                        sk_eat_skb(sk, skb, 0);