Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mac80211: use symbolic defines in wpa.c

ETH_ALEN and IEEE80211_QOS_CTL_LEN

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

authored by

Harvey Harrison and committed by
John W. Linville
73e1f7c8 238f74a2

+7 -7
+7 -7
net/mac80211/wpa.c
··· 38 38 *data_len = skb->len - hdrlen; 39 39 40 40 if (ieee80211_is_data_qos(fc)) 41 - *qos_tid = (*ieee80211_get_qos_ctl(hdr) & 0x0f) | 0x80; 41 + *qos_tid = (*ieee80211_get_qos_ctl(hdr) & IEEE80211_QOS_CTL_TID_MASK) | 0x80; 42 42 else 43 43 *qos_tid = 0; 44 44 ··· 312 312 data_len -= CCMP_HDR_LEN + (encrypted ? CCMP_MIC_LEN : 0); 313 313 if (qos_tid & 0x80) { 314 314 qos_included = 1; 315 - qos_tid &= 0x0f; 315 + qos_tid &= IEEE80211_QOS_CTL_TID_MASK; 316 316 } else 317 317 qos_included = 0; 318 318 /* First block, b_0 */ ··· 320 320 b_0[0] = 0x59; /* flags: Adata: 1, M: 011, L: 001 */ 321 321 /* Nonce: QoS Priority | A2 | PN */ 322 322 b_0[1] = qos_tid; 323 - memcpy(&b_0[2], hdr->addr2, 6); 323 + memcpy(&b_0[2], hdr->addr2, ETH_ALEN); 324 324 memcpy(&b_0[8], pn, CCMP_PN_LEN); 325 325 /* l(m) */ 326 326 b_0[14] = (data_len >> 8) & 0xff; ··· 332 332 333 333 len_a = a4_included ? 28 : 22; 334 334 if (qos_included) 335 - len_a += 2; 335 + len_a += IEEE80211_QOS_CTL_LEN; 336 336 337 337 aad[0] = 0; /* (len_a >> 8) & 0xff; */ 338 338 aad[1] = len_a & 0xff; ··· 340 340 aad[2] = fc_pos[0] & ~(BIT(4) | BIT(5) | BIT(6)); 341 341 /* Retry, PwrMgt, MoreData; set Protected */ 342 342 aad[3] = (fc_pos[1] & ~(BIT(3) | BIT(4) | BIT(5))) | BIT(6); 343 - memcpy(&aad[4], &hdr->addr1, 18); 343 + memcpy(&aad[4], &hdr->addr1, 3 * ETH_ALEN); 344 344 345 345 /* Mask Seq#, leave Frag# */ 346 346 aad[22] = *((u8 *) &hdr->seq_ctrl) & 0x0f; 347 347 aad[23] = 0; 348 348 if (a4_included) { 349 - memcpy(&aad[24], hdr->addr4, 6); 349 + memcpy(&aad[24], hdr->addr4, ETH_ALEN); 350 350 aad[30] = 0; 351 351 aad[31] = 0; 352 352 } else 353 - memset(&aad[24], 0, 8); 353 + memset(&aad[24], 0, ETH_ALEN + IEEE80211_QOS_CTL_LEN); 354 354 if (qos_included) { 355 355 u8 *dpos = &aad[a4_included ? 30 : 24]; 356 356