Skip to content

Commit

Permalink
[PKTGEN]: Respect hard_header_len of device.
Browse files Browse the repository at this point in the history
Don't assume 16.

Found by Ben Greear.

Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
David S. Miller committed Jan 18, 2006
1 parent e048a37 commit 7ac5459
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions net/core/pktgen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7ac5459

Please sign in to comment.