summaryrefslogtreecommitdiffstats
path: root/drivers/net/macvtap.c
diff options
context:
space:
mode:
authorJason Wang <jasowang@redhat.com>2013-03-27 00:11:22 +0100
committerDavid S. Miller <davem@davemloft.net>2013-03-27 17:48:31 +0100
commit40893fd0fd4e0eda8c6a53db6a8e6013b2d44c16 (patch)
treef61f8374d9a77385ef06012256b68633edb27e2c /drivers/net/macvtap.c
parentnet: core: introduce skb_probe_transport_header() (diff)
downloadlinux-40893fd0fd4e0eda8c6a53db6a8e6013b2d44c16.tar.xz
linux-40893fd0fd4e0eda8c6a53db6a8e6013b2d44c16.zip
net: switch to use skb_probe_transport_header()
Switch to use the new help skb_probe_transport_header() to do the l4 header probing for untrusted sources. For packets with partial csum, the header should already been set by skb_partial_csum_set(). Cc: Eric Dumazet <edumazet@google.com> Signed-off-by: Jason Wang <jasowang@redhat.com> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/macvtap.c')
-rw-r--r--drivers/net/macvtap.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
index acf6450ceff5..59e9605de316 100644
--- a/drivers/net/macvtap.c
+++ b/drivers/net/macvtap.c
@@ -21,7 +21,6 @@
#include <net/rtnetlink.h>
#include <net/sock.h>
#include <linux/virtio_net.h>
-#include <net/flow_keys.h>
/*
* A macvtap queue is the central object of this driver, it connects
@@ -646,7 +645,6 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m,
int vnet_hdr_len = 0;
int copylen = 0;
bool zerocopy = false;
- struct flow_keys keys;
if (q->flags & IFF_VNET_HDR) {
vnet_hdr_len = q->vnet_hdr_sz;
@@ -727,12 +725,7 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m,
goto err_kfree;
}
- if (skb->ip_summed == CHECKSUM_PARTIAL)
- skb_set_transport_header(skb, skb_checksum_start_offset(skb));
- else if (skb_flow_dissect(skb, &keys))
- skb_set_transport_header(skb, keys.thoff);
- else
- skb_set_transport_header(skb, ETH_HLEN);
+ skb_probe_transport_header(skb, ETH_HLEN);
rcu_read_lock_bh();
vlan = rcu_dereference_bh(q->vlan);