Commit fbf405e8 authored by David S. Miller's avatar David S. Miller

Merge branch 'udp-hdrs-fixes'

Willem de Bruijn says:

====================
fix two more udp pull header issues

Follow up patches to the fixes to RxRPC and SunRPC. A scan of the
code showed two other interfaces that expect UDP packets to have
a udphdr when queued: read packet length with ioctl SIOCINQ and
receive payload checksum with socket option IP_CHECKSUM.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 99717bdf 31c2e492
...@@ -106,7 +106,8 @@ static void ip_cmsg_recv_checksum(struct msghdr *msg, struct sk_buff *skb, ...@@ -106,7 +106,8 @@ static void ip_cmsg_recv_checksum(struct msghdr *msg, struct sk_buff *skb,
return; return;
if (offset != 0) if (offset != 0)
csum = csum_sub(csum, csum_partial(skb->data, offset, 0)); csum = csum_sub(csum, csum_partial(skb_transport_header(skb),
offset, 0));
put_cmsg(msg, SOL_IP, IP_CHECKSUM, sizeof(__wsum), &csum); put_cmsg(msg, SOL_IP, IP_CHECKSUM, sizeof(__wsum), &csum);
} }
......
...@@ -1282,8 +1282,6 @@ int udp_ioctl(struct sock *sk, int cmd, unsigned long arg) ...@@ -1282,8 +1282,6 @@ int udp_ioctl(struct sock *sk, int cmd, unsigned long arg)
* of this packet since that is all * of this packet since that is all
* that will be read. * that will be read.
*/ */
amount -= sizeof(struct udphdr);
return put_user(amount, (int __user *)arg); return put_user(amount, (int __user *)arg);
} }
...@@ -1377,7 +1375,7 @@ int udp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int noblock, ...@@ -1377,7 +1375,7 @@ int udp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int noblock,
*addr_len = sizeof(*sin); *addr_len = sizeof(*sin);
} }
if (inet->cmsg_flags) if (inet->cmsg_flags)
ip_cmsg_recv_offset(msg, skb, sizeof(struct udphdr)); ip_cmsg_recv_offset(msg, skb, sizeof(struct udphdr) + off);
err = copied; err = copied;
if (flags & MSG_TRUNC) if (flags & MSG_TRUNC)
......
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