mac80211: use compare_ether_addr on MAC addresses instead of memcmp
Because of the constant size and guaranteed 16 bit alignment, the inline compare_ether_addr function is much cheaper than calling memcmp. Signed-off-by: Felix Fietkau <nbd@openwrt.org> Acked-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
committed by
John W. Linville
parent
4d196e4b2f
commit
888d04dfbe
@@ -489,12 +489,12 @@ ieee80211_rx_mesh_check(struct ieee80211_rx_data *rx)
|
||||
if (ieee80211_has_tods(hdr->frame_control) ||
|
||||
!ieee80211_has_fromds(hdr->frame_control))
|
||||
return RX_DROP_MONITOR;
|
||||
if (memcmp(hdr->addr3, dev_addr, ETH_ALEN) == 0)
|
||||
if (compare_ether_addr(hdr->addr3, dev_addr) == 0)
|
||||
return RX_DROP_MONITOR;
|
||||
} else {
|
||||
if (!ieee80211_has_a4(hdr->frame_control))
|
||||
return RX_DROP_MONITOR;
|
||||
if (memcmp(hdr->addr4, dev_addr, ETH_ALEN) == 0)
|
||||
if (compare_ether_addr(hdr->addr4, dev_addr) == 0)
|
||||
return RX_DROP_MONITOR;
|
||||
}
|
||||
}
|
||||
@@ -2336,7 +2336,7 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx)
|
||||
if (sdata->vif.type != NL80211_IFTYPE_STATION)
|
||||
break;
|
||||
|
||||
if (memcmp(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN))
|
||||
if (compare_ether_addr(mgmt->bssid, sdata->u.mgd.bssid))
|
||||
break;
|
||||
|
||||
goto queue;
|
||||
|
Reference in New Issue
Block a user