tun.c does not correctly align skb's
PATCH 1/1 tun.c does not correctly align skb's
Hi David,
While trying to get the tun/tap driver to work on parisc-linux, I found that the driver does not deliver correctly aligned buffers to the underlying layers. The attached patch fixes the problem. AIUI the +2 is there in some net drivers to deal with the 4n+2 length of MAC headers. Since you don't have a MAC header here the +2 is not required. In fact, it will cause the buffers that are delivered to the checksuming routines to be unaligned, which will either not work on some archs, or have performance implications on others.
This was tested on 2.4.19(-pa22).
net/tun.c renamed from net/tun.c.orig +1 -2
@@ -194,12 +194,11 @@memcpy_fromiovec ((void *)&pi, iv,sizeof (pi)); } -if (!(skb =alloc_skb (len +2 ,GFP_KERNEL ))) { +if (!(skb =alloc_skb (len,GFP_KERNEL ))) { tun->stats.rx_dropped++;return -ENOMEM ; } -skb_reserve (skb,2 );memcpy_fromiovec (skb_put (skb, len), iv, len); skb->dev = &tun->dev;
randolph
Signature · 3 lines
Randolph Chung Debian GNU/Linux Developer, hppa/ia64 ports http://www.tausq.org/