diff options
author | Antonio Quartulli <ordex@autistici.org> | 2012-02-18 05:27:34 -0500 |
---|---|---|
committer | Antonio Quartulli <ordex@autistici.org> | 2012-04-18 03:54:01 -0400 |
commit | 0d125074ebc8c971e939f8c2c8f90a80fa09aeb4 (patch) | |
tree | fb31ee069ab0a2abc7681b999839fd81392110f7 /net/batman-adv/bridge_loop_avoidance.c | |
parent | 1eeb479fda2405269b3a85c86ba0eca41fcc4ea0 (diff) |
batman-adv: use ETH_HLEN instead of sizeof(struct ethhdr)
Instead of using sizeof(struct ethhdr) it is strongly recommended to use the
kernel macro ETH_HLEN. This patch substitute each occurrence of the former
expressione with the latter one.
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Diffstat (limited to 'net/batman-adv/bridge_loop_avoidance.c')
-rw-r--r-- | net/batman-adv/bridge_loop_avoidance.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c index c8642b586411..ad394c6496cc 100644 --- a/net/batman-adv/bridge_loop_avoidance.c +++ b/net/batman-adv/bridge_loop_avoidance.c | |||
@@ -290,9 +290,7 @@ static void bla_send_claim(struct bat_priv *bat_priv, uint8_t *mac, | |||
290 | goto out; | 290 | goto out; |
291 | 291 | ||
292 | ethhdr = (struct ethhdr *)skb->data; | 292 | ethhdr = (struct ethhdr *)skb->data; |
293 | hw_src = (uint8_t *)ethhdr + | 293 | hw_src = (uint8_t *)ethhdr + ETH_HLEN + sizeof(struct arphdr); |
294 | sizeof(struct ethhdr) + | ||
295 | sizeof(struct arphdr); | ||
296 | 294 | ||
297 | /* now we pretend that the client would have sent this ... */ | 295 | /* now we pretend that the client would have sent this ... */ |
298 | switch (claimtype) { | 296 | switch (claimtype) { |
@@ -340,7 +338,7 @@ static void bla_send_claim(struct bat_priv *bat_priv, uint8_t *mac, | |||
340 | skb_reset_mac_header(skb); | 338 | skb_reset_mac_header(skb); |
341 | skb->protocol = eth_type_trans(skb, soft_iface); | 339 | skb->protocol = eth_type_trans(skb, soft_iface); |
342 | bat_priv->stats.rx_packets++; | 340 | bat_priv->stats.rx_packets++; |
343 | bat_priv->stats.rx_bytes += skb->len + sizeof(struct ethhdr); | 341 | bat_priv->stats.rx_bytes += skb->len + ETH_HLEN; |
344 | soft_iface->last_rx = jiffies; | 342 | soft_iface->last_rx = jiffies; |
345 | 343 | ||
346 | netif_rx(skb); | 344 | netif_rx(skb); |
@@ -844,7 +842,7 @@ static int bla_process_claim(struct bat_priv *bat_priv, | |||
844 | headlen = sizeof(*vhdr); | 842 | headlen = sizeof(*vhdr); |
845 | } else { | 843 | } else { |
846 | proto = ntohs(ethhdr->h_proto); | 844 | proto = ntohs(ethhdr->h_proto); |
847 | headlen = sizeof(*ethhdr); | 845 | headlen = ETH_HLEN; |
848 | } | 846 | } |
849 | 847 | ||
850 | if (proto != ETH_P_ARP) | 848 | if (proto != ETH_P_ARP) |
@@ -1302,7 +1300,7 @@ int bla_is_backbone_gw(struct sk_buff *skb, | |||
1302 | return 0; | 1300 | return 0; |
1303 | 1301 | ||
1304 | /* first, find out the vid. */ | 1302 | /* first, find out the vid. */ |
1305 | if (!pskb_may_pull(skb, hdr_size + sizeof(struct ethhdr))) | 1303 | if (!pskb_may_pull(skb, hdr_size + ETH_HLEN)) |
1306 | return 0; | 1304 | return 0; |
1307 | 1305 | ||
1308 | ethhdr = (struct ethhdr *)(((uint8_t *)skb->data) + hdr_size); | 1306 | ethhdr = (struct ethhdr *)(((uint8_t *)skb->data) + hdr_size); |