diff options
author | Antonio Quartulli <ordex@autistici.org> | 2012-02-18 11:27:34 +0100 |
---|---|---|
committer | Antonio Quartulli <ordex@autistici.org> | 2012-04-18 09:54:01 +0200 |
commit | 0d125074ebc8c971e939f8c2c8f90a80fa09aeb4 (patch) | |
tree | fb31ee069ab0a2abc7681b999839fd81392110f7 /net/batman-adv/bridge_loop_avoidance.c | |
parent | 1eeb479fda2405269b3a85c86ba0eca41fcc4ea0 (diff) | |
download | op-kernel-dev-0d125074ebc8c971e939f8c2c8f90a80fa09aeb4.zip op-kernel-dev-0d125074ebc8c971e939f8c2c8f90a80fa09aeb4.tar.gz |
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 c8642b5..ad394c6 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, goto out; ethhdr = (struct ethhdr *)skb->data; - hw_src = (uint8_t *)ethhdr + - sizeof(struct ethhdr) + - sizeof(struct arphdr); + hw_src = (uint8_t *)ethhdr + ETH_HLEN + sizeof(struct arphdr); /* now we pretend that the client would have sent this ... */ switch (claimtype) { @@ -340,7 +338,7 @@ static void bla_send_claim(struct bat_priv *bat_priv, uint8_t *mac, skb_reset_mac_header(skb); skb->protocol = eth_type_trans(skb, soft_iface); bat_priv->stats.rx_packets++; - bat_priv->stats.rx_bytes += skb->len + sizeof(struct ethhdr); + bat_priv->stats.rx_bytes += skb->len + ETH_HLEN; soft_iface->last_rx = jiffies; netif_rx(skb); @@ -844,7 +842,7 @@ static int bla_process_claim(struct bat_priv *bat_priv, headlen = sizeof(*vhdr); } else { proto = ntohs(ethhdr->h_proto); - headlen = sizeof(*ethhdr); + headlen = ETH_HLEN; } if (proto != ETH_P_ARP) @@ -1302,7 +1300,7 @@ int bla_is_backbone_gw(struct sk_buff *skb, return 0; /* first, find out the vid. */ - if (!pskb_may_pull(skb, hdr_size + sizeof(struct ethhdr))) + if (!pskb_may_pull(skb, hdr_size + ETH_HLEN)) return 0; ethhdr = (struct ethhdr *)(((uint8_t *)skb->data) + hdr_size); |