wireless: Use eth_<foo>_addr instead of memset
Use the built-in function instead of memset. Miscellanea: Add #include <linux/etherdevice.h> where appropriate Use ETH_ALEN instead of 6 Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
519983b129
commit
93803b3385
@@ -174,8 +174,8 @@ netdev_tx_t hostap_data_start_xmit(struct sk_buff *skb,
|
||||
/* send broadcast and multicast frames to broadcast RA, if
|
||||
* configured; otherwise, use unicast RA of the WDS link */
|
||||
if ((local->wds_type & HOSTAP_WDS_BROADCAST_RA) &&
|
||||
skb->data[0] & 0x01)
|
||||
memset(&hdr.addr1, 0xff, ETH_ALEN);
|
||||
is_multicast_ether_addr(skb->data))
|
||||
eth_broadcast_addr(hdr.addr1);
|
||||
else if (iface->type == HOSTAP_INTERFACE_WDS)
|
||||
memcpy(&hdr.addr1, iface->u.wds.remote_addr,
|
||||
ETH_ALEN);
|
||||
|
@@ -309,7 +309,7 @@ void hostap_deauth_all_stas(struct net_device *dev, struct ap_data *ap,
|
||||
int i;
|
||||
|
||||
PDEBUG(DEBUG_AP, "%s: Deauthenticate all stations\n", dev->name);
|
||||
memset(addr, 0xff, ETH_ALEN);
|
||||
eth_broadcast_addr(addr);
|
||||
|
||||
resp = cpu_to_le16(WLAN_REASON_PREV_AUTH_NOT_VALID);
|
||||
|
||||
@@ -1015,8 +1015,8 @@ static void prism2_send_mgmt(struct net_device *dev,
|
||||
memcpy(hdr->addr3, dev->dev_addr, ETH_ALEN); /* SA */
|
||||
} else if (ieee80211_is_ctl(hdr->frame_control)) {
|
||||
/* control:ACK does not have addr2 or addr3 */
|
||||
memset(hdr->addr2, 0, ETH_ALEN);
|
||||
memset(hdr->addr3, 0, ETH_ALEN);
|
||||
eth_zero_addr(hdr->addr2);
|
||||
eth_zero_addr(hdr->addr3);
|
||||
} else {
|
||||
memcpy(hdr->addr2, dev->dev_addr, ETH_ALEN); /* SA */
|
||||
memcpy(hdr->addr3, dev->dev_addr, ETH_ALEN); /* BSSID */
|
||||
@@ -1601,7 +1601,7 @@ static void handle_assoc(local_info_t *local, struct sk_buff *skb,
|
||||
memcpy(prev_ap, pos, ETH_ALEN);
|
||||
pos++; pos++; pos++; left -= 6;
|
||||
} else
|
||||
memset(prev_ap, 0, ETH_ALEN);
|
||||
eth_zero_addr(prev_ap);
|
||||
|
||||
if (left >= 2) {
|
||||
unsigned int ileft;
|
||||
|
@@ -442,7 +442,7 @@ static void handle_info_queue_linkstatus(local_info_t *local)
|
||||
} else {
|
||||
netif_carrier_off(local->dev);
|
||||
netif_carrier_off(local->ddev);
|
||||
memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN);
|
||||
eth_zero_addr(wrqu.ap_addr.sa_data);
|
||||
}
|
||||
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
|
||||
|
||||
|
@@ -224,7 +224,7 @@ int prism2_wds_del(local_info_t *local, u8 *remote_addr,
|
||||
|
||||
if (selected) {
|
||||
if (do_not_remove)
|
||||
memset(selected->u.wds.remote_addr, 0, ETH_ALEN);
|
||||
eth_zero_addr(selected->u.wds.remote_addr);
|
||||
else {
|
||||
hostap_remove_interface(selected->dev, rtnl_locked, 0);
|
||||
local->wds_connections--;
|
||||
@@ -1087,7 +1087,7 @@ int prism2_sta_deauth(local_info_t *local, u16 reason)
|
||||
|
||||
ret = prism2_sta_send_mgmt(local, local->bssid, IEEE80211_STYPE_DEAUTH,
|
||||
(u8 *) &val, 2);
|
||||
memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN);
|
||||
eth_zero_addr(wrqu.ap_addr.sa_data);
|
||||
wireless_send_event(local->dev, SIOCGIWAP, &wrqu, NULL);
|
||||
return ret;
|
||||
}
|
||||
|
@@ -4,6 +4,7 @@
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/wireless.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <net/iw_handler.h>
|
||||
#include <net/ieee80211_radiotap.h>
|
||||
@@ -85,16 +86,16 @@ struct hfa384x_rx_frame {
|
||||
/* 802.11 */
|
||||
__le16 frame_control;
|
||||
__le16 duration_id;
|
||||
u8 addr1[6];
|
||||
u8 addr2[6];
|
||||
u8 addr3[6];
|
||||
u8 addr1[ETH_ALEN];
|
||||
u8 addr2[ETH_ALEN];
|
||||
u8 addr3[ETH_ALEN];
|
||||
__le16 seq_ctrl;
|
||||
u8 addr4[6];
|
||||
u8 addr4[ETH_ALEN];
|
||||
__le16 data_len;
|
||||
|
||||
/* 802.3 */
|
||||
u8 dst_addr[6];
|
||||
u8 src_addr[6];
|
||||
u8 dst_addr[ETH_ALEN];
|
||||
u8 src_addr[ETH_ALEN];
|
||||
__be16 len;
|
||||
|
||||
/* followed by frame data; max 2304 bytes */
|
||||
@@ -114,16 +115,16 @@ struct hfa384x_tx_frame {
|
||||
/* 802.11 */
|
||||
__le16 frame_control; /* parts not used */
|
||||
__le16 duration_id;
|
||||
u8 addr1[6];
|
||||
u8 addr2[6]; /* filled by firmware */
|
||||
u8 addr3[6];
|
||||
u8 addr1[ETH_ALEN];
|
||||
u8 addr2[ETH_ALEN]; /* filled by firmware */
|
||||
u8 addr3[ETH_ALEN];
|
||||
__le16 seq_ctrl; /* filled by firmware */
|
||||
u8 addr4[6];
|
||||
u8 addr4[ETH_ALEN];
|
||||
__le16 data_len;
|
||||
|
||||
/* 802.3 */
|
||||
u8 dst_addr[6];
|
||||
u8 src_addr[6];
|
||||
u8 dst_addr[ETH_ALEN];
|
||||
u8 src_addr[ETH_ALEN];
|
||||
__be16 len;
|
||||
|
||||
/* followed by frame data; max 2304 bytes */
|
||||
@@ -156,7 +157,7 @@ struct hfa384x_hostscan_request {
|
||||
} __packed;
|
||||
|
||||
struct hfa384x_join_request {
|
||||
u8 bssid[6];
|
||||
u8 bssid[ETH_ALEN];
|
||||
__le16 channel;
|
||||
} __packed;
|
||||
|
||||
@@ -228,7 +229,7 @@ struct hfa384x_scan_result {
|
||||
__le16 chid;
|
||||
__le16 anl;
|
||||
__le16 sl;
|
||||
u8 bssid[6];
|
||||
u8 bssid[ETH_ALEN];
|
||||
__le16 beacon_interval;
|
||||
__le16 capability;
|
||||
__le16 ssid_len;
|
||||
@@ -241,7 +242,7 @@ struct hfa384x_hostscan_result {
|
||||
__le16 chid;
|
||||
__le16 anl;
|
||||
__le16 sl;
|
||||
u8 bssid[6];
|
||||
u8 bssid[ETH_ALEN];
|
||||
__le16 beacon_interval;
|
||||
__le16 capability;
|
||||
__le16 ssid_len;
|
||||
@@ -824,7 +825,7 @@ struct local_info {
|
||||
#define PRISM2_INFO_PENDING_SCANRESULTS 1
|
||||
int prev_link_status; /* previous received LinkStatus info */
|
||||
int prev_linkstatus_connected;
|
||||
u8 preferred_ap[6]; /* use this AP if possible */
|
||||
u8 preferred_ap[ETH_ALEN]; /* use this AP if possible */
|
||||
|
||||
#ifdef PRISM2_CALLBACK
|
||||
void *callback_data; /* Can be used in callbacks; e.g., allocate
|
||||
|
Reference in New Issue
Block a user