summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2006-01-18 14:19:10 -0800
committerDavid S. Miller <davem@sunset.davemloft.net>2006-01-18 14:19:10 -0800
commit7ac5459ec0f074022818af35c589b9e2b406d7c3 (patch)
tree2b623adcfcce2185b60b1aceed01f3a68b471f4e /net
parente048a374d0d7beb9cf3529eac71ddd79699c8669 (diff)
downloadlinux-3.10-7ac5459ec0f074022818af35c589b9e2b406d7c3.tar.gz
linux-3.10-7ac5459ec0f074022818af35c589b9e2b406d7c3.tar.bz2
linux-3.10-7ac5459ec0f074022818af35c589b9e2b406d7c3.zip
[PKTGEN]: Respect hard_header_len of device.
Don't assume 16. Found by Ben Greear. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/core/pktgen.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 3827f881f42..da16f8fd149 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -1860,13 +1860,14 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev,
*/
mod_cur_headers(pkt_dev);
- skb = alloc_skb(pkt_dev->cur_pkt_size + 64 + 16, GFP_ATOMIC);
+ datalen = (odev->hard_header_len + 16) & ~0xf;
+ skb = alloc_skb(pkt_dev->cur_pkt_size + 64 + datalen, GFP_ATOMIC);
if (!skb) {
sprintf(pkt_dev->result, "No memory");
return NULL;
}
- skb_reserve(skb, 16);
+ skb_reserve(skb, datalen);
/* Reserve for ethernet and IP header */
eth = (__u8 *) skb_push(skb, 14);