Commit 68ce1ca3 authored by David S. Miller's avatar David S. Miller

[IPV4]: Make raw sockets behave like udp wrt. MSG_TRUNC.

parent 498ced50
...@@ -555,9 +555,11 @@ int raw_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, ...@@ -555,9 +555,11 @@ int raw_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);
if (flags & MSG_TRUNC)
copied = skb->len;
done: done:
skb_free_datagram(sk, skb); skb_free_datagram(sk, skb);
out: return err ? : copied; out: return err ? err : copied;
} }
static int raw_init(struct sock *sk) static int raw_init(struct sock *sk)
......
...@@ -419,7 +419,10 @@ static int rawv6_recvmsg(struct kiocb *iocb, struct sock *sk, ...@@ -419,7 +419,10 @@ static int rawv6_recvmsg(struct kiocb *iocb, struct sock *sk,
if (np->rxopt.all) if (np->rxopt.all)
datagram_recv_ctl(sk, msg, skb); datagram_recv_ctl(sk, msg, skb);
err = copied; err = copied;
if (flags & MSG_TRUNC)
err = skb->len;
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