Skip to content

Commit

Permalink
pktgen: bug fix in transmission headers with frags=0
Browse files Browse the repository at this point in the history
(bug introduced by commit 26ad787
(pktgen: speedup fragmented skbs)

The headers of pktgen were incorrectly added in a pktgen packet
without frags (frags=0). There was an offset in the pktgen headers.

The cause was in reusing the pgh variable as a return variable in skb_put
when adding the payload to the skb.

Signed-off-by: Daniel Turull <daniel.turull@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
  • Loading branch information
Daniel Turull authored and David S. Miller committed Mar 14, 2011
1 parent 4e75db2 commit 05aebe2
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions net/core/pktgen.c
Original file line number Diff line number Diff line change
Expand Up @@ -2620,8 +2620,7 @@ static void pktgen_finalize_skb(struct pktgen_dev *pkt_dev, struct sk_buff *skb,
datalen -= sizeof(*pgh);

if (pkt_dev->nfrags <= 0) {
pgh = (struct pktgen_hdr *)skb_put(skb, datalen);
memset(pgh + 1, 0, datalen);
memset(skb_put(skb, datalen), 0, datalen);
} else {
int frags = pkt_dev->nfrags;
int i, len;
Expand Down

0 comments on commit 05aebe2

Please sign in to comment.