Commit 753eab76 authored by Olaf Kirch's avatar Olaf Kirch Committed by David S. Miller

[UDP]: Make udp_encap_rcv use pskb_may_pull

Make udp_encap_rcv use pskb_may_pull

IPsec with NAT-T breaks on some notebooks using the latest e1000 chipset,
when header split is enabled. When receiving sufficiently large packets, the
driver puts everything up to and including the UDP header into the header
portion of the skb, and the rest goes into the paged part. udp_encap_rcv
forgets to use pskb_may_pull, and fails to decapsulate it. Instead, it
passes it up it to the IKE daemon.
Signed-off-by: default avatarOlaf Kirch <okir@suse.de>
Signed-off-by: default avatarJean Delvare <jdelvare@suse.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 38f7efd5
...@@ -928,23 +928,32 @@ static int udp_encap_rcv(struct sock * sk, struct sk_buff *skb) ...@@ -928,23 +928,32 @@ static int udp_encap_rcv(struct sock * sk, struct sk_buff *skb)
return 1; return 1;
#else #else
struct udp_sock *up = udp_sk(sk); struct udp_sock *up = udp_sk(sk);
struct udphdr *uh = skb->h.uh; struct udphdr *uh;
struct iphdr *iph; struct iphdr *iph;
int iphlen, len; int iphlen, len;
__u8 *udpdata = (__u8 *)uh + sizeof(struct udphdr); __u8 *udpdata;
__be32 *udpdata32 = (__be32 *)udpdata; __be32 *udpdata32;
__u16 encap_type = up->encap_type; __u16 encap_type = up->encap_type;
/* if we're overly short, let UDP handle it */ /* if we're overly short, let UDP handle it */
if (udpdata > skb->tail) len = skb->len - sizeof(struct udphdr);
if (len <= 0)
return 1; return 1;
/* if this is not encapsulated socket, then just return now */ /* if this is not encapsulated socket, then just return now */
if (!encap_type) if (!encap_type)
return 1; return 1;
len = skb->tail - udpdata; /* If this is a paged skb, make sure we pull up
* whatever data we need to look at. */
if (!pskb_may_pull(skb, sizeof(struct udphdr) + min(len, 8)))
return 1;
/* Now we can get the pointers */
uh = skb->h.uh;
udpdata = (__u8 *)uh + sizeof(struct udphdr);
udpdata32 = (__be32 *)udpdata;
switch (encap_type) { switch (encap_type) {
default: default:
......
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