Update is_multicast_ether_addr() definition; net/ieee80211.h cleanups.

This commit is contained in:
Jeff Garzik 2005-06-27 22:47:18 -04:00
parent 1bad3f4050
commit a5fe736eaf
2 changed files with 11 additions and 39 deletions

View File

@ -65,7 +65,7 @@ static inline int is_zero_ether_addr(const u8 *addr)
*/ */
static inline int is_multicast_ether_addr(const u8 *addr) static inline int is_multicast_ether_addr(const u8 *addr)
{ {
return addr[0] & 0x01; return ((addr[0] != 0xff) && (0x01 & addr[0]));
} }
/** /**

View File

@ -94,6 +94,8 @@ struct eapol {
u16 length; u16 length;
} __attribute__ ((packed)); } __attribute__ ((packed));
#define IEEE80211_1ADDR_LEN 10
#define IEEE80211_2ADDR_LEN 16
#define IEEE80211_3ADDR_LEN 24 #define IEEE80211_3ADDR_LEN 24
#define IEEE80211_4ADDR_LEN 30 #define IEEE80211_4ADDR_LEN 30
#define IEEE80211_FCS_LEN 4 #define IEEE80211_FCS_LEN 4
@ -300,23 +302,6 @@ struct ieee80211_snap_hdr {
#define WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH 9 #define WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH 9
/* Information Element IDs */
#define WLAN_EID_SSID 0
#define WLAN_EID_SUPP_RATES 1
#define WLAN_EID_FH_PARAMS 2
#define WLAN_EID_DS_PARAMS 3
#define WLAN_EID_CF_PARAMS 4
#define WLAN_EID_TIM 5
#define WLAN_EID_IBSS_PARAMS 6
#define WLAN_EID_CHALLENGE 16
#define WLAN_EID_RSN 48
#define WLAN_EID_GENERIC 221
#define IEEE80211_MGMT_HDR_LEN 24
#define IEEE80211_DATA_HDR3_LEN 24
#define IEEE80211_DATA_HDR4_LEN 30
#define IEEE80211_STATMASK_SIGNAL (1<<0) #define IEEE80211_STATMASK_SIGNAL (1<<0)
#define IEEE80211_STATMASK_RSSI (1<<1) #define IEEE80211_STATMASK_RSSI (1<<1)
#define IEEE80211_STATMASK_NOISE (1<<2) #define IEEE80211_STATMASK_NOISE (1<<2)
@ -441,6 +426,8 @@ struct ieee80211_stats {
struct ieee80211_device; struct ieee80211_device;
#include "ieee80211_crypt.h"
#define SEC_KEY_1 (1<<0) #define SEC_KEY_1 (1<<0)
#define SEC_KEY_2 (1<<1) #define SEC_KEY_2 (1<<1)
#define SEC_KEY_3 (1<<2) #define SEC_KEY_3 (1<<2)
@ -488,15 +475,6 @@ Total: 28-2340 bytes
*/ */
struct ieee80211_header_data {
u16 frame_ctl;
u16 duration_id;
u8 addr1[6];
u8 addr2[6];
u8 addr3[6];
u16 seq_ctrl;
};
#define BEACON_PROBE_SSID_ID_POSITION 12 #define BEACON_PROBE_SSID_ID_POSITION 12
/* Management Frame Information Element Types */ /* Management Frame Information Element Types */
@ -541,7 +519,7 @@ struct ieee80211_info_element {
*/ */
struct ieee80211_authentication { struct ieee80211_authentication {
struct ieee80211_header_data header; struct ieee80211_hdr_3addr header;
u16 algorithm; u16 algorithm;
u16 transaction; u16 transaction;
u16 status; u16 status;
@ -550,7 +528,7 @@ struct ieee80211_authentication {
struct ieee80211_probe_response { struct ieee80211_probe_response {
struct ieee80211_header_data header; struct ieee80211_hdr_3addr header;
u32 time_stamp[2]; u32 time_stamp[2];
u16 beacon_interval; u16 beacon_interval;
u16 capability; u16 capability;
@ -648,12 +626,6 @@ enum ieee80211_state {
#define MAC_ARG(x) ((u8*)(x))[0],((u8*)(x))[1],((u8*)(x))[2],((u8*)(x))[3],((u8*)(x))[4],((u8*)(x))[5] #define MAC_ARG(x) ((u8*)(x))[0],((u8*)(x))[1],((u8*)(x))[2],((u8*)(x))[3],((u8*)(x))[4],((u8*)(x))[5]
extern inline int is_broadcast_ether_addr(const u8 *addr)
{
return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
}
#define CFG_IEEE80211_RESERVE_FCS (1<<0) #define CFG_IEEE80211_RESERVE_FCS (1<<0)
#define CFG_IEEE80211_COMPUTE_FCS (1<<1) #define CFG_IEEE80211_COMPUTE_FCS (1<<1)
@ -787,21 +759,21 @@ extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mod
extern inline int ieee80211_get_hdrlen(u16 fc) extern inline int ieee80211_get_hdrlen(u16 fc)
{ {
int hdrlen = 24; int hdrlen = IEEE80211_3ADDR_LEN;
switch (WLAN_FC_GET_TYPE(fc)) { switch (WLAN_FC_GET_TYPE(fc)) {
case IEEE80211_FTYPE_DATA: case IEEE80211_FTYPE_DATA:
if ((fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS)) if ((fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS))
hdrlen = 30; /* Addr4 */ hdrlen = IEEE80211_4ADDR_LEN;
break; break;
case IEEE80211_FTYPE_CTL: case IEEE80211_FTYPE_CTL:
switch (WLAN_FC_GET_STYPE(fc)) { switch (WLAN_FC_GET_STYPE(fc)) {
case IEEE80211_STYPE_CTS: case IEEE80211_STYPE_CTS:
case IEEE80211_STYPE_ACK: case IEEE80211_STYPE_ACK:
hdrlen = 10; hdrlen = IEEE80211_1ADDR_LEN;
break; break;
default: default:
hdrlen = 16; hdrlen = IEEE80211_2ADDR_LEN;
break; break;
} }
break; break;