diff options
author | Joe Perches <joe@perches.com> | 2012-05-08 14:56:52 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-05-09 20:49:18 -0400 |
commit | b203ca39126bad99583c908be587df067820a1ea (patch) | |
tree | 940e32bd15392b400cf50c2ac31c7895637c09fe /net/mac80211/tx.c | |
parent | c47fc9814ca15cc075f1f09e8c069b041f2ea397 (diff) |
mac80211: Convert compare_ether_addr to ether_addr_equal
Use the new bool function ether_addr_equal to add
some clarity and reduce the likelihood for misuse
of compare_ether_addr for sorting.
Done via cocci script:
$ cat compare_ether_addr.cocci
@@
expression a,b;
@@
- !compare_ether_addr(a, b)
+ ether_addr_equal(a, b)
@@
expression a,b;
@@
- compare_ether_addr(a, b)
+ !ether_addr_equal(a, b)
@@
expression a,b;
@@
- !ether_addr_equal(a, b) == 0
+ ether_addr_equal(a, b)
@@
expression a,b;
@@
- !ether_addr_equal(a, b) != 0
+ !ether_addr_equal(a, b)
@@
expression a,b;
@@
- ether_addr_equal(a, b) == 0
+ !ether_addr_equal(a, b)
@@
expression a,b;
@@
- ether_addr_equal(a, b) != 0
+ ether_addr_equal(a, b)
@@
expression a,b;
@@
- !!ether_addr_equal(a, b)
+ ether_addr_equal(a, b)
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/mac80211/tx.c')
-rw-r--r-- | net/mac80211/tx.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index d67d36f57d78..e03abc78ee53 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -1665,7 +1665,7 @@ netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb, | |||
1665 | skb->len >= len_rthdr + hdrlen + sizeof(rfc1042_header) + 2) { | 1665 | skb->len >= len_rthdr + hdrlen + sizeof(rfc1042_header) + 2) { |
1666 | u8 *payload = (u8 *)hdr + hdrlen; | 1666 | u8 *payload = (u8 *)hdr + hdrlen; |
1667 | 1667 | ||
1668 | if (compare_ether_addr(payload, rfc1042_header) == 0) | 1668 | if (ether_addr_equal(payload, rfc1042_header)) |
1669 | skb->protocol = cpu_to_be16((payload[6] << 8) | | 1669 | skb->protocol = cpu_to_be16((payload[6] << 8) | |
1670 | payload[7]); | 1670 | payload[7]); |
1671 | } | 1671 | } |
@@ -1698,7 +1698,7 @@ netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb, | |||
1698 | tmp_sdata->vif.type == NL80211_IFTYPE_AP_VLAN || | 1698 | tmp_sdata->vif.type == NL80211_IFTYPE_AP_VLAN || |
1699 | tmp_sdata->vif.type == NL80211_IFTYPE_WDS) | 1699 | tmp_sdata->vif.type == NL80211_IFTYPE_WDS) |
1700 | continue; | 1700 | continue; |
1701 | if (compare_ether_addr(tmp_sdata->vif.addr, hdr->addr2) == 0) { | 1701 | if (ether_addr_equal(tmp_sdata->vif.addr, hdr->addr2)) { |
1702 | sdata = tmp_sdata; | 1702 | sdata = tmp_sdata; |
1703 | break; | 1703 | break; |
1704 | } | 1704 | } |
@@ -1815,9 +1815,8 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1815 | * is being proxied by a portal (i.e. portal address | 1815 | * is being proxied by a portal (i.e. portal address |
1816 | * differs from proxied address) | 1816 | * differs from proxied address) |
1817 | */ | 1817 | */ |
1818 | if (compare_ether_addr(sdata->vif.addr, | 1818 | if (ether_addr_equal(sdata->vif.addr, skb->data + ETH_ALEN) && |
1819 | skb->data + ETH_ALEN) == 0 && | 1819 | !(mppath && !ether_addr_equal(mppath->mpp, skb->data))) { |
1820 | !(mppath && compare_ether_addr(mppath->mpp, skb->data))) { | ||
1821 | hdrlen = ieee80211_fill_mesh_addresses(&hdr, &fc, | 1820 | hdrlen = ieee80211_fill_mesh_addresses(&hdr, &fc, |
1822 | skb->data, skb->data + ETH_ALEN); | 1821 | skb->data, skb->data + ETH_ALEN); |
1823 | rcu_read_unlock(); | 1822 | rcu_read_unlock(); |
@@ -1964,7 +1963,7 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1964 | if (unlikely(!ieee80211_vif_is_mesh(&sdata->vif) && | 1963 | if (unlikely(!ieee80211_vif_is_mesh(&sdata->vif) && |
1965 | !is_multicast_ether_addr(hdr.addr1) && !authorized && | 1964 | !is_multicast_ether_addr(hdr.addr1) && !authorized && |
1966 | (cpu_to_be16(ethertype) != sdata->control_port_protocol || | 1965 | (cpu_to_be16(ethertype) != sdata->control_port_protocol || |
1967 | compare_ether_addr(sdata->vif.addr, skb->data + ETH_ALEN)))) { | 1966 | !ether_addr_equal(sdata->vif.addr, skb->data + ETH_ALEN)))) { |
1968 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 1967 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
1969 | if (net_ratelimit()) | 1968 | if (net_ratelimit()) |
1970 | printk(KERN_DEBUG "%s: dropped frame to %pM" | 1969 | printk(KERN_DEBUG "%s: dropped frame to %pM" |