From: Gerrit Renker <gerrit@erg.abdn.ac.uk>
To: davem@davemloft.net
Cc: dccp@vger.kernel.org, netdev@vger.kernel.org,
Gerrit Renker <gerrit@erg.abdn.ac.uk>
Subject: [PATCH 1/2] dccp: support for passing MSG_TRUNC
Date: Thu, 11 Feb 2010 07:26:18 +0100 [thread overview]
Message-ID: <1265869579-5829-2-git-send-email-gerrit@erg.abdn.ac.uk> (raw)
In-Reply-To: <1265869579-5829-1-git-send-email-gerrit@erg.abdn.ac.uk>
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>
---
net/dccp/proto.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
--- a/net/dccp/proto.c
+++ b/net/dccp/proto.c
@@ -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);
next prev parent reply other threads:[~2010-02-11 6:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <udp_dccp_msg_trunc>
2010-02-11 6:26 ` net-2.6 [PATCH 0/2] udp/dccp: MSG_TRUNC Gerrit Renker
2010-02-11 6:26 ` Gerrit Renker [this message]
2010-02-11 6:26 ` [PATCH 2/2] udp: remove redundant variable Gerrit Renker
2010-02-13 0:51 ` net-2.6 [PATCH 0/2] udp/dccp: MSG_TRUNC David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1265869579-5829-2-git-send-email-gerrit@erg.abdn.ac.uk \
--to=gerrit@erg.abdn.ac.uk \
--cc=davem@davemloft.net \
--cc=dccp@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).