Skip to content

Commit

Permalink
pktgen: remove one sparse error
Browse files Browse the repository at this point in the history
net/core/pktgen.c:2672:43: warning: incorrect type in assignment (different base types)
net/core/pktgen.c:2672:43:    expected unsigned short [unsigned] [short] [usertype] <noident>
net/core/pktgen.c:2672:43:    got restricted __be16 [usertype] protocol

Let's use proper struct ethhdr instead of hard coding everything.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed May 26, 2015
1 parent 7f15986 commit d496958
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions net/core/pktgen.c
Original file line number Diff line number Diff line change
Expand Up @@ -2645,9 +2645,9 @@ static int process_ipsec(struct pktgen_dev *pkt_dev,
struct xfrm_state *x = pkt_dev->flows[pkt_dev->curfl].x;
int nhead = 0;
if (x) {
int ret;
__u8 *eth;
struct ethhdr *eth;
struct iphdr *iph;
int ret;

nhead = x->props.header_len - skb_headroom(skb);
if (nhead > 0) {
Expand All @@ -2667,9 +2667,9 @@ static int process_ipsec(struct pktgen_dev *pkt_dev,
goto err;
}
/* restore ll */
eth = (__u8 *) skb_push(skb, ETH_HLEN);
memcpy(eth, pkt_dev->hh, 12);
*(u16 *) &eth[12] = protocol;
eth = (struct ethhdr *)skb_push(skb, ETH_HLEN);
memcpy(eth, pkt_dev->hh, 2 * ETH_ALEN);
eth->h_proto = protocol;

/* Update IPv4 header len as well as checksum value */
iph = ip_hdr(skb);
Expand Down

0 comments on commit d496958

Please sign in to comment.