|
13 | 13 | #include "wilc_wlan.h"
|
14 | 14 | #include <linux/errno.h>
|
15 | 15 | #include <linux/slab.h>
|
16 |
| -#include <linux/etherdevice.h> |
17 | 16 | #define TAG_PARAM_OFFSET (MAC_HDR_LEN + TIME_STAMP_LEN + \
|
18 | 17 | BEACON_INTERVAL_LEN + CAP_INFO_LEN)
|
19 |
| -#define ADDR1 4 |
20 |
| -#define ADDR2 10 |
21 |
| -#define ADDR3 16 |
22 | 18 |
|
23 | 19 | /* Basic Frame Type Codes (2-bit) */
|
24 | 20 | enum basic_frame_type {
|
@@ -175,32 +171,38 @@ static inline u8 get_from_ds(u8 *header)
|
175 | 171 | return ((header[1] & 0x02) >> 1);
|
176 | 172 | }
|
177 | 173 |
|
| 174 | +/* This function extracts the MAC Address in 'address1' field of the MAC */ |
| 175 | +/* header and updates the MAC Address in the allocated 'addr' variable. */ |
| 176 | +static inline void get_address1(u8 *pu8msa, u8 *addr) |
| 177 | +{ |
| 178 | + memcpy(addr, pu8msa + 4, 6); |
| 179 | +} |
| 180 | + |
| 181 | +/* This function extracts the MAC Address in 'address2' field of the MAC */ |
| 182 | +/* header and updates the MAC Address in the allocated 'addr' variable. */ |
| 183 | +static inline void get_address2(u8 *pu8msa, u8 *addr) |
| 184 | +{ |
| 185 | + memcpy(addr, pu8msa + 10, 6); |
| 186 | +} |
| 187 | + |
| 188 | +/* This function extracts the MAC Address in 'address3' field of the MAC */ |
| 189 | +/* header and updates the MAC Address in the allocated 'addr' variable. */ |
| 190 | +static inline void get_address3(u8 *pu8msa, u8 *addr) |
| 191 | +{ |
| 192 | + memcpy(addr, pu8msa + 16, 6); |
| 193 | +} |
| 194 | + |
178 | 195 | /* This function extracts the BSSID from the incoming WLAN packet based on */
|
179 |
| -/* the 'from ds' bit, and updates the MAC Address in the allocated 'data' */ |
| 196 | +/* the 'from ds' bit, and updates the MAC Address in the allocated 'addr' */ |
180 | 197 | /* variable. */
|
181 | 198 | static inline void get_BSSID(u8 *data, u8 *bssid)
|
182 | 199 | {
|
183 | 200 | if (get_from_ds(data) == 1)
|
184 |
| - /* |
185 |
| - * Extract the MAC Address in 'address2' field of the MAC |
186 |
| - * header and update the MAC Address in the allocated 'data' |
187 |
| - * variable. |
188 |
| - */ |
189 |
| - ether_addr_copy(data, bssid + ADDR2); |
| 201 | + get_address2(data, bssid); |
190 | 202 | else if (get_to_ds(data) == 1)
|
191 |
| - /* |
192 |
| - * Extract the MAC Address in 'address1' field of the MAC |
193 |
| - * header and update the MAC Address in the allocated 'data' |
194 |
| - * variable. |
195 |
| - */ |
196 |
| - ether_addr_copy(data, bssid + ADDR1); |
| 203 | + get_address1(data, bssid); |
197 | 204 | else
|
198 |
| - /* |
199 |
| - * Extract the MAC Address in 'address3' field of the MAC |
200 |
| - * header and update the MAC Address in the allocated 'data' |
201 |
| - * variable. |
202 |
| - */ |
203 |
| - ether_addr_copy(data, bssid + ADDR3); |
| 205 | + get_address3(data, bssid); |
204 | 206 | }
|
205 | 207 |
|
206 | 208 | /* This function extracts the SSID from a beacon/probe response frame */
|
|
0 commit comments