summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstephen hemminger <shemminger@vyatta.com>2011-06-08 14:33:07 +0000
committerDavid S. Miller <davem@davemloft.net>2011-06-09 00:08:38 -0700
commita504b86e718a425ea4a34e2f95b5cf0545ddfd8d (patch)
tree5feeeab10c80b49323477545513e70bae97dee84
parent7625eb2f2fff7bfae41d3119b472c20b48874895 (diff)
downloadlwn-a504b86e718a425ea4a34e2f95b5cf0545ddfd8d.tar.gz
lwn-a504b86e718a425ea4a34e2f95b5cf0545ddfd8d.zip
tun: reserves space for network in skb
The tun driver allocates skb's to hold data from user and then passes the data into the network stack as received data. Most network devices allocate the receive skb with routines like dev_alloc_skb() that reserves additional space for use by network protocol stack but tun does not. Because of the lack of padding, when the packet is passed through bridge netfilter a new skb has to be allocated. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/tun.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 8a27cbf19dd6..17db19420637 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -584,7 +584,7 @@ static __inline__ ssize_t tun_get_user(struct tun_struct *tun,
{
struct tun_pi pi = { 0, cpu_to_be16(ETH_P_IP) };
struct sk_buff *skb;
- size_t len = count, align = 0;
+ size_t len = count, align = NET_SKB_PAD;
struct virtio_net_hdr gso = { 0 };
int offset = 0;
@@ -614,7 +614,7 @@ static __inline__ ssize_t tun_get_user(struct tun_struct *tun,
}
if ((tun->flags & TUN_TYPE_MASK) == TUN_TAP_DEV) {
- align = NET_IP_ALIGN;
+ align += NET_IP_ALIGN;
if (unlikely(len < ETH_HLEN ||
(gso.hdr_len && gso.hdr_len < ETH_HLEN)))
return -EINVAL;