summaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorsamanthakumar <samanthakumar@google.com>2016-04-05 18:41:15 +0200
committerDavid S. Miller <davem@davemloft.net>2016-04-05 22:29:37 +0200
commite6afc8ace6dd5cef5e812f26c72579da8806f5ac (patch)
treeff84943f8c480deb208fba4b768e911f0c1090bf /include/net
parentsock: convert sk_peek_offset functions to WRITE_ONCE (diff)
downloadlinux-e6afc8ace6dd5cef5e812f26c72579da8806f5ac.tar.xz
linux-e6afc8ace6dd5cef5e812f26c72579da8806f5ac.zip
udp: remove headers from UDP packets before queueing
Remove UDP transport headers before queueing packets for reception. This change simplifies a follow-up patch to add MSG_PEEK support. Signed-off-by: Sam Kumar <samanthakumar@google.com> Signed-off-by: Willem de Bruijn <willemb@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/sock.h1
-rw-r--r--include/net/udp.h9
2 files changed, 10 insertions, 0 deletions
diff --git a/include/net/sock.h b/include/net/sock.h
index 09aec75eb184..b75998952482 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1864,6 +1864,7 @@ void sk_reset_timer(struct sock *sk, struct timer_list *timer,
void sk_stop_timer(struct sock *sk, struct timer_list *timer);
+int __sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb);
int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb);
int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb);
diff --git a/include/net/udp.h b/include/net/udp.h
index d870ec1611c4..a0b0da97164c 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -158,6 +158,15 @@ static inline __sum16 udp_v4_check(int len, __be32 saddr,
void udp_set_csum(bool nocheck, struct sk_buff *skb,
__be32 saddr, __be32 daddr, int len);
+static inline void udp_csum_pull_header(struct sk_buff *skb)
+{
+ if (skb->ip_summed == CHECKSUM_NONE)
+ skb->csum = csum_partial(udp_hdr(skb), sizeof(struct udphdr),
+ skb->csum);
+ skb_pull_rcsum(skb, sizeof(struct udphdr));
+ UDP_SKB_CB(skb)->cscov -= sizeof(struct udphdr);
+}
+
struct sk_buff **udp_gro_receive(struct sk_buff **head, struct sk_buff *skb,
struct udphdr *uh);
int udp_gro_complete(struct sk_buff *skb, int nhoff);