aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/rx.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2012-05-08 14:56:52 -0400
committerDavid S. Miller <davem@davemloft.net>2012-05-09 20:49:18 -0400
commitb203ca39126bad99583c908be587df067820a1ea (patch)
tree940e32bd15392b400cf50c2ac31c7895637c09fe /net/mac80211/rx.c
parentc47fc9814ca15cc075f1f09e8c069b041f2ea397 (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/rx.c')
-rw-r--r--net/mac80211/rx.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index d5ac02fe37ff..26bfd6fcaa48 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -492,12 +492,12 @@ ieee80211_rx_mesh_check(struct ieee80211_rx_data *rx)
492 if (ieee80211_has_tods(hdr->frame_control) || 492 if (ieee80211_has_tods(hdr->frame_control) ||
493 !ieee80211_has_fromds(hdr->frame_control)) 493 !ieee80211_has_fromds(hdr->frame_control))
494 return RX_DROP_MONITOR; 494 return RX_DROP_MONITOR;
495 if (compare_ether_addr(hdr->addr3, dev_addr) == 0) 495 if (ether_addr_equal(hdr->addr3, dev_addr))
496 return RX_DROP_MONITOR; 496 return RX_DROP_MONITOR;
497 } else { 497 } else {
498 if (!ieee80211_has_a4(hdr->frame_control)) 498 if (!ieee80211_has_a4(hdr->frame_control))
499 return RX_DROP_MONITOR; 499 return RX_DROP_MONITOR;
500 if (compare_ether_addr(hdr->addr4, dev_addr) == 0) 500 if (ether_addr_equal(hdr->addr4, dev_addr))
501 return RX_DROP_MONITOR; 501 return RX_DROP_MONITOR;
502 } 502 }
503 } 503 }
@@ -1275,7 +1275,7 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx)
1275 if (rx->sdata->vif.type == NL80211_IFTYPE_ADHOC) { 1275 if (rx->sdata->vif.type == NL80211_IFTYPE_ADHOC) {
1276 u8 *bssid = ieee80211_get_bssid(hdr, rx->skb->len, 1276 u8 *bssid = ieee80211_get_bssid(hdr, rx->skb->len,
1277 NL80211_IFTYPE_ADHOC); 1277 NL80211_IFTYPE_ADHOC);
1278 if (compare_ether_addr(bssid, rx->sdata->u.ibss.bssid) == 0) { 1278 if (ether_addr_equal(bssid, rx->sdata->u.ibss.bssid)) {
1279 sta->last_rx = jiffies; 1279 sta->last_rx = jiffies;
1280 if (ieee80211_is_data(hdr->frame_control)) { 1280 if (ieee80211_is_data(hdr->frame_control)) {
1281 sta->last_rx_rate_idx = status->rate_idx; 1281 sta->last_rx_rate_idx = status->rate_idx;
@@ -1438,8 +1438,8 @@ ieee80211_reassemble_find(struct ieee80211_sub_if_data *sdata,
1438 */ 1438 */
1439 if (((hdr->frame_control ^ f_hdr->frame_control) & 1439 if (((hdr->frame_control ^ f_hdr->frame_control) &
1440 cpu_to_le16(IEEE80211_FCTL_FTYPE)) || 1440 cpu_to_le16(IEEE80211_FCTL_FTYPE)) ||
1441 compare_ether_addr(hdr->addr1, f_hdr->addr1) != 0 || 1441 !ether_addr_equal(hdr->addr1, f_hdr->addr1) ||
1442 compare_ether_addr(hdr->addr2, f_hdr->addr2) != 0) 1442 !ether_addr_equal(hdr->addr2, f_hdr->addr2))
1443 continue; 1443 continue;
1444 1444
1445 if (time_after(jiffies, entry->first_frag_time + 2 * HZ)) { 1445 if (time_after(jiffies, entry->first_frag_time + 2 * HZ)) {
@@ -1925,7 +1925,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
1925 mpp_path_add(proxied_addr, mpp_addr, sdata); 1925 mpp_path_add(proxied_addr, mpp_addr, sdata);
1926 } else { 1926 } else {
1927 spin_lock_bh(&mppath->state_lock); 1927 spin_lock_bh(&mppath->state_lock);
1928 if (compare_ether_addr(mppath->mpp, mpp_addr) != 0) 1928 if (!ether_addr_equal(mppath->mpp, mpp_addr))
1929 memcpy(mppath->mpp, mpp_addr, ETH_ALEN); 1929 memcpy(mppath->mpp, mpp_addr, ETH_ALEN);
1930 spin_unlock_bh(&mppath->state_lock); 1930 spin_unlock_bh(&mppath->state_lock);
1931 } 1931 }
@@ -1934,7 +1934,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
1934 1934
1935 /* Frame has reached destination. Don't forward */ 1935 /* Frame has reached destination. Don't forward */
1936 if (!is_multicast_ether_addr(hdr->addr1) && 1936 if (!is_multicast_ether_addr(hdr->addr1) &&
1937 compare_ether_addr(sdata->vif.addr, hdr->addr3) == 0) 1937 ether_addr_equal(sdata->vif.addr, hdr->addr3))
1938 return RX_CONTINUE; 1938 return RX_CONTINUE;
1939 1939
1940 q = ieee80211_select_queue_80211(local, skb, hdr); 1940 q = ieee80211_select_queue_80211(local, skb, hdr);
@@ -2122,13 +2122,13 @@ static void ieee80211_process_sa_query_req(struct ieee80211_sub_if_data *sdata,
2122 struct sk_buff *skb; 2122 struct sk_buff *skb;
2123 struct ieee80211_mgmt *resp; 2123 struct ieee80211_mgmt *resp;
2124 2124
2125 if (compare_ether_addr(mgmt->da, sdata->vif.addr) != 0) { 2125 if (!ether_addr_equal(mgmt->da, sdata->vif.addr)) {
2126 /* Not to own unicast address */ 2126 /* Not to own unicast address */
2127 return; 2127 return;
2128 } 2128 }
2129 2129
2130 if (compare_ether_addr(mgmt->sa, sdata->u.mgd.bssid) != 0 || 2130 if (!ether_addr_equal(mgmt->sa, sdata->u.mgd.bssid) ||
2131 compare_ether_addr(mgmt->bssid, sdata->u.mgd.bssid) != 0) { 2131 !ether_addr_equal(mgmt->bssid, sdata->u.mgd.bssid)) {
2132 /* Not from the current AP or not associated yet. */ 2132 /* Not from the current AP or not associated yet. */
2133 return; 2133 return;
2134 } 2134 }
@@ -2338,7 +2338,7 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx)
2338 if (sdata->vif.type != NL80211_IFTYPE_STATION) 2338 if (sdata->vif.type != NL80211_IFTYPE_STATION)
2339 break; 2339 break;
2340 2340
2341 if (compare_ether_addr(mgmt->bssid, sdata->u.mgd.bssid)) 2341 if (!ether_addr_equal(mgmt->bssid, sdata->u.mgd.bssid))
2342 break; 2342 break;
2343 2343
2344 goto queue; 2344 goto queue;
@@ -2772,7 +2772,7 @@ static int prepare_for_handlers(struct ieee80211_rx_data *rx,
2772 if (!bssid && !sdata->u.mgd.use_4addr) 2772 if (!bssid && !sdata->u.mgd.use_4addr)
2773 return 0; 2773 return 0;
2774 if (!multicast && 2774 if (!multicast &&
2775 compare_ether_addr(sdata->vif.addr, hdr->addr1) != 0) { 2775 !ether_addr_equal(sdata->vif.addr, hdr->addr1)) {
2776 if (!(sdata->dev->flags & IFF_PROMISC) || 2776 if (!(sdata->dev->flags & IFF_PROMISC) ||
2777 sdata->u.mgd.use_4addr) 2777 sdata->u.mgd.use_4addr)
2778 return 0; 2778 return 0;
@@ -2790,8 +2790,7 @@ static int prepare_for_handlers(struct ieee80211_rx_data *rx,
2790 return 0; 2790 return 0;
2791 status->rx_flags &= ~IEEE80211_RX_RA_MATCH; 2791 status->rx_flags &= ~IEEE80211_RX_RA_MATCH;
2792 } else if (!multicast && 2792 } else if (!multicast &&
2793 compare_ether_addr(sdata->vif.addr, 2793 !ether_addr_equal(sdata->vif.addr, hdr->addr1)) {
2794 hdr->addr1) != 0) {
2795 if (!(sdata->dev->flags & IFF_PROMISC)) 2794 if (!(sdata->dev->flags & IFF_PROMISC))
2796 return 0; 2795 return 0;
2797 status->rx_flags &= ~IEEE80211_RX_RA_MATCH; 2796 status->rx_flags &= ~IEEE80211_RX_RA_MATCH;
@@ -2807,8 +2806,7 @@ static int prepare_for_handlers(struct ieee80211_rx_data *rx,
2807 break; 2806 break;
2808 case NL80211_IFTYPE_MESH_POINT: 2807 case NL80211_IFTYPE_MESH_POINT:
2809 if (!multicast && 2808 if (!multicast &&
2810 compare_ether_addr(sdata->vif.addr, 2809 !ether_addr_equal(sdata->vif.addr, hdr->addr1)) {
2811 hdr->addr1) != 0) {
2812 if (!(sdata->dev->flags & IFF_PROMISC)) 2810 if (!(sdata->dev->flags & IFF_PROMISC))
2813 return 0; 2811 return 0;
2814 2812
@@ -2818,8 +2816,7 @@ static int prepare_for_handlers(struct ieee80211_rx_data *rx,
2818 case NL80211_IFTYPE_AP_VLAN: 2816 case NL80211_IFTYPE_AP_VLAN:
2819 case NL80211_IFTYPE_AP: 2817 case NL80211_IFTYPE_AP:
2820 if (!bssid) { 2818 if (!bssid) {
2821 if (compare_ether_addr(sdata->vif.addr, 2819 if (!ether_addr_equal(sdata->vif.addr, hdr->addr1))
2822 hdr->addr1))
2823 return 0; 2820 return 0;
2824 } else if (!ieee80211_bssid_match(bssid, 2821 } else if (!ieee80211_bssid_match(bssid,
2825 sdata->vif.addr)) { 2822 sdata->vif.addr)) {
@@ -2841,7 +2838,7 @@ static int prepare_for_handlers(struct ieee80211_rx_data *rx,
2841 case NL80211_IFTYPE_WDS: 2838 case NL80211_IFTYPE_WDS:
2842 if (bssid || !ieee80211_is_data(hdr->frame_control)) 2839 if (bssid || !ieee80211_is_data(hdr->frame_control))
2843 return 0; 2840 return 0;
2844 if (compare_ether_addr(sdata->u.wds.remote_addr, hdr->addr2)) 2841 if (!ether_addr_equal(sdata->u.wds.remote_addr, hdr->addr2))
2845 return 0; 2842 return 0;
2846 break; 2843 break;
2847 default: 2844 default: