Skip to contentSkip to conversation

mac80211: Fix bug in computing crc over dynamic IEs in beacon

PATCH In review Vasanthakumar Thiagarajan 2 participants 3 messages Dec 4, 2009 mac80211

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mac80211: Fix bug in computing crc over dynamic IEs in beacon

On a 32-bit machine, BIT() macro does not give the required
bit value if the bit is mroe than 31. In ieee802_11_parse_elems_crc(), BIT() is suppossed to get the bit value more than 31 (42 (id of ERP_INFO_IE), 37 (CHANNEL_SWITCH_IE), (42), 32 (POWER_CONSTRAINT_IE), 45 (HT_CAP_IE), 61 (HT_INFO_IE)). As we do not get the required bit value for the above IEs, crc over these IEs are never calculated, so any dynamic change in these IEs after the association is not really handled on 32-bit platforms. This patch fixes this issue.

---
 net/mac80211/util.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
net/mac80211/util.c +1 -1
index d09f78b..78a6e92 100644
@@ -579,7 +579,7 @@ u32 ieee802_11_parse_elems_crc(u8 *start, size_t len,
 		if (elen > left)
 			break;
 
-		if (calc_crc && id < 64 && (filter & BIT(id)))
+		if (calc_crc && id < 64 && (filter & (1ULL << id)))
 			crc = crc32_be(crc, pos - 2, elen + 2);
 
 		switch (id) {
Signature · 1 line
1.5.5.1
maintainer
#1 lore raw
Quoted 2 lines · Vasanthakumar Thiagarajan

On a 32-bit machine, BIT() macro does not give the required bit value if the bit is mroe than 31.

For some reason I thought it did, thanks.

Quoted 7 lines

In ieee802_11_parse_elems_crc(),
BIT() is suppossed to get the bit value more than 31 (42 (id of ERP_INFO_IE), 37 (CHANNEL_SWITCH_IE), (42), 32 (POWER_CONSTRAINT_IE), 45 (HT_CAP_IE), 61 (HT_INFO_IE)). As we do not get the required bit value for the above IEs, crc over these IEs are never calculated, so any dynamic change in these IEs after the association is not really handled on 32-bit platforms. This patch fixes this issue.

Right. Note that this function may need to be changed/extended if we ever need to watch for changes in even higher IEs, but so far we don't.

johannes

#2 lore raw
Quoted 10 lines · Johannes Berg
Quoted 7 lines

In ieee802_11_parse_elems_crc(),
BIT() is suppossed to get the bit value more than 31 (42 (id of ERP_INFO_IE), 37 (CHANNEL_SWITCH_IE), (42), 32 (POWER_CONSTRAINT_IE), 45 (HT_CAP_IE), 61 (HT_INFO_IE)). As we do not get the required bit value for the above IEs, crc over these IEs are never calculated, so any dynamic change in these IEs after the association is not really handled on 32-bit platforms. This patch fixes this issue.

Right. Note that this function may need to be changed/extended if we ever need to watch for changes in even higher IEs, but so far we don't.

Yeah, currently we do only for the IEs whose ids are < 64.

Thanks,

Vasanth