Commit 964eb7b1 authored by Samuel Thibault's avatar Samuel Thibault Committed by David S. Miller

[UDP]: Return true length if user specifies MSG_TRUNC.

parent db3b92ff
...@@ -828,7 +828,10 @@ int udp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, ...@@ -828,7 +828,10 @@ int udp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
} }
if (inet->cmsg_flags) if (inet->cmsg_flags)
ip_cmsg_recv(msg, skb); ip_cmsg_recv(msg, skb);
err = copied; err = copied;
if (flags & MSG_TRUNC)
err = skb->len - sizeof(struct udphdr);
out_free: out_free:
skb_free_datagram(sk, skb); skb_free_datagram(sk, skb);
......
...@@ -436,7 +436,10 @@ static int udpv6_recvmsg(struct kiocb *iocb, struct sock *sk, ...@@ -436,7 +436,10 @@ static int udpv6_recvmsg(struct kiocb *iocb, struct sock *sk,
sin6->sin6_scope_id = IP6CB(skb)->iif; sin6->sin6_scope_id = IP6CB(skb)->iif;
} }
} }
err = copied; err = copied;
if (flags & MSG_TRUNC)
err = skb->len - sizeof(struct udphdr);
out_free: out_free:
skb_free_datagram(sk, skb); skb_free_datagram(sk, skb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment