On Thu, 02 Sep 2010 15:40:47 +0200
Eric Dumazet <eric.dumazet@gmail.com> wrote:
With Eric's suggestion, you might find most packets are going
to be aligned but the code should not depend on it always being true.
Packets that get forwarded have header determined by the receiving
interface.
Something like:
skb = skb_realloc_headroom(skb, 2);
if (!skb)
goto drop;
__skb_push(skb, 2);
memmove(skb->data, skb->data + 2, ETH_HLEN);
skb->data[ETH_HLEN] = 0;
skb->data[ETH_HLEN+1] = 0;
if (!IS_ALIGNED(skb->data, 16)) {
nskb = netdev_alloc_skb(dev, skb->len + 16);
if (!nskb)
goto drop2;
skb_reserve(nskb, PTR_ALIGN(skb->data, 16) - skb->data);
skb_put(skb, skb->len);
memcpy(nskb->data, skb->data, skb->len);
dev_kfree_skb(skb);
skb = nskb;
}
--
--