Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 149983
b: refs/heads/master
c: e7ec86f
h: refs/heads/master
i:
  149981: 362a4ec
  149979: cd0326d
  149975: 3388942
  149967: 8bca2b2
  149951: f1f465a
v: v3
  • Loading branch information
Johannes Berg authored and John W. Linville committed Apr 22, 2009
1 parent 384d591 commit 365dece
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 30 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ba44cb7226afd4e19308c1d8a90e8b7c566c0d8b
refs/heads/master: e7ec86f54e519e8e86f1cf328db13263f3ef8bd4
32 changes: 31 additions & 1 deletion trunk/include/linux/ieee80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ struct ieee80211_tim_ie {
u8 dtim_period;
u8 bitmap_ctrl;
/* variable size: 1 - 251 bytes */
u8 virtual_map[0];
u8 virtual_map[1];
} __attribute__ ((packed));

#define WLAN_SA_QUERY_TR_ID_LEN 16
Expand Down Expand Up @@ -1392,4 +1392,34 @@ static inline unsigned long ieee80211_tu_to_usec(unsigned long tu)
return 1024 * tu;
}

/**
* ieee80211_check_tim - check if AID bit is set in TIM
* @tim: the TIM IE
* @tim_len: length of the TIM IE
* @aid: the AID to look for
*/
static inline bool ieee80211_check_tim(struct ieee80211_tim_ie *tim,
u8 tim_len, u16 aid)
{
u8 mask;
u8 index, indexn1, indexn2;

if (unlikely(!tim || tim_len < sizeof(*tim)))
return false;

aid &= 0x3fff;
index = aid / 8;
mask = 1 << (aid & 7);

indexn1 = tim->bitmap_ctrl & 0xfe;
indexn2 = tim_len + indexn1 - 4;

if (index < indexn1 || index > indexn2)
return false;

index -= indexn1;

return !!(tim->virtual_map[index] & mask);
}

#endif /* LINUX_IEEE80211_H */
2 changes: 1 addition & 1 deletion trunk/net/mac80211/ieee80211_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ struct ieee802_11_elems {
u8 *fh_params;
u8 *ds_params;
u8 *cf_params;
u8 *tim;
struct ieee80211_tim_ie *tim;
u8 *ibss_params;
u8 *challenge;
u8 *wpa;
Expand Down
27 changes: 2 additions & 25 deletions trunk/net/mac80211/mlme.c
Original file line number Diff line number Diff line change
Expand Up @@ -675,30 +675,6 @@ static void ieee80211_sta_wmm_params(struct ieee80211_local *local,
}
}

static bool ieee80211_check_tim(struct ieee802_11_elems *elems, u16 aid)
{
u8 mask;
u8 index, indexn1, indexn2;
struct ieee80211_tim_ie *tim = (struct ieee80211_tim_ie *) elems->tim;

if (unlikely(!tim || elems->tim_len < 4))
return false;

aid &= 0x3fff;
index = aid / 8;
mask = 1 << (aid & 7);

indexn1 = tim->bitmap_ctrl & 0xfe;
indexn2 = elems->tim_len + indexn1 - 4;

if (index < indexn1 || index > indexn2)
return false;

index -= indexn1;

return !!(tim->virtual_map[index] & mask);
}

static u32 ieee80211_handle_bss_capability(struct ieee80211_sub_if_data *sdata,
u16 capab, bool erp_valid, u8 erp)
{
Expand Down Expand Up @@ -1806,7 +1782,8 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
care_about_ies, ncrc);

if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK)
directed_tim = ieee80211_check_tim(&elems, ifmgd->aid);
directed_tim = ieee80211_check_tim(elems.tim, elems.tim_len,
ifmgd->aid);

ncrc = crc32_be(ncrc, (void *)&directed_tim, sizeof(directed_tim));

Expand Down
6 changes: 4 additions & 2 deletions trunk/net/mac80211/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -588,8 +588,10 @@ u32 ieee802_11_parse_elems_crc(u8 *start, size_t len,
elems->cf_params_len = elen;
break;
case WLAN_EID_TIM:
elems->tim = pos;
elems->tim_len = elen;
if (elen >= sizeof(struct ieee80211_tim_ie)) {
elems->tim = (void *)pos;
elems->tim_len = elen;
}
break;
case WLAN_EID_IBSS_PARAMS:
elems->ibss_params = pos;
Expand Down

0 comments on commit 365dece

Please sign in to comment.