summaryrefslogtreecommitdiffstats
path: root/net/packet/af_packet.c
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2013-08-02 11:37:41 +0200
committerDavid S. Miller <davem@davemloft.net>2013-08-02 23:58:32 +0200
commitc483e02614551e44ced3fe6eedda8e36d3277ccc (patch)
tree7d171a5c01d8212921cd2557aa0749fa81263893 /net/packet/af_packet.c
parentaf_packet: fix for sending VLAN frames via packet_mmap (diff)
downloadlinux-c483e02614551e44ced3fe6eedda8e36d3277ccc.tar.xz
linux-c483e02614551e44ced3fe6eedda8e36d3277ccc.zip
af_packet: simplify VLAN frame check in packet_snd
For ethernet frames, eth_type_trans() already parses the header, so one can skip this when checking the frame size. Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/packet/af_packet.c')
-rw-r--r--net/packet/af_packet.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 2b1470de9e16..0c0f6c9a90e7 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -2333,23 +2333,16 @@ static int packet_snd(struct socket *sock,
if (dev->type == ARPHRD_ETHER) {
skb->protocol = eth_type_trans(skb, dev);
+ if (skb->protocol == htons(ETH_P_8021Q))
+ reserve += VLAN_HLEN;
} else {
skb->protocol = proto;
skb->dev = dev;
}
if (!gso_type && (len > dev->mtu + reserve + extra_len)) {
- /* Earlier code assumed this would be a VLAN pkt,
- * double-check this now that we have the actual
- * packet in hand.
- */
- struct ethhdr *ehdr;
- skb_reset_mac_header(skb);
- ehdr = eth_hdr(skb);
- if (ehdr->h_proto != htons(ETH_P_8021Q)) {
- err = -EMSGSIZE;
- goto out_free;
- }
+ err = -EMSGSIZE;
+ goto out_free;
}
skb->priority = sk->sk_priority;