aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorChris J Arges <chris.j.arges@canonical.com>2012-06-27 12:55:28 -0400
committerLuis Henriques <luis.henriques@canonical.com>2012-07-03 11:29:12 -0400
commit2a597eea26a0398761c1b6bdeb12b6152944d978 (patch)
treed8db4a8f6e3746366efd66d09183c21a510d5832 /drivers/net
parent19272540afc96f10811361e00612fcdd02018ebb (diff)
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> (cherry picked from commit a504b86e718a425ea4a34e2f95b5cf0545ddfd8d) BugLink: http://launchpad.net/bugs/905219 Signed-off-by: Chris J Arges <chris.j.arges@canonical.com> Acked-by: Seth Forshee <seth.forshee@canonical.com> Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Diffstat (limited to 'drivers/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 fb50e5a542f..2f2a19054ec 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -607,7 +607,7 @@ static __inline__ ssize_t tun_get_user(struct tun_struct *tun,
607{ 607{
608 struct tun_pi pi = { 0, cpu_to_be16(ETH_P_IP) }; 608 struct tun_pi pi = { 0, cpu_to_be16(ETH_P_IP) };
609 struct sk_buff *skb; 609 struct sk_buff *skb;
610 size_t len = count, align = 0; 610 size_t len = count, align = NET_SKB_PAD;
611 struct virtio_net_hdr gso = { 0 }; 611 struct virtio_net_hdr gso = { 0 };
612 int offset = 0; 612 int offset = 0;
613 613
@@ -637,7 +637,7 @@ static __inline__ ssize_t tun_get_user(struct tun_struct *tun,
637 } 637 }
638 638
639 if ((tun->flags & TUN_TYPE_MASK) == TUN_TAP_DEV) { 639 if ((tun->flags & TUN_TYPE_MASK) == TUN_TAP_DEV) {
640 align = NET_IP_ALIGN; 640 align += NET_IP_ALIGN;
641 if (unlikely(len < ETH_HLEN || 641 if (unlikely(len < ETH_HLEN ||
642 (gso.hdr_len && gso.hdr_len < ETH_HLEN))) 642 (gso.hdr_len && gso.hdr_len < ETH_HLEN)))
643 return -EINVAL; 643 return -EINVAL;