Alignment problems go bye-bye.
This commit is contained in:
parent
9022845135
commit
15f2673757
4
CHANGES
4
CHANGES
|
@ -41,7 +41,11 @@
|
|||
* Intersil Corporation as part of PRISM(R) chipset product development.
|
||||
*
|
||||
* --------------------------------------------------------------------
|
||||
- Work around the braindead RedHat kernel build system.
|
||||
- Fix a class of unaligned accesses in the message structures
|
||||
(kernel driver) and user space parsers (wlanctl-ng, etc)
|
||||
- Fix an unpacked struct problem that affected ARM platforms
|
||||
(thanks to Clay Jones for spotting this one)
|
||||
-pre6
|
||||
- Support the new auto-unknown mode present in firmware >1.3.3
|
||||
When issuing an autojoin, we try to join a BSS, then an IBSS, and if
|
||||
|
|
|
@ -59,6 +59,8 @@ int main(int argc, char **argv)
|
|||
int c, g, i, totgrps, totitems, type;
|
||||
char name[82];
|
||||
|
||||
int pad_id = 0;
|
||||
|
||||
/* traverse the message metadata to build the structures and typedefs */
|
||||
for ( c = 1; c < msg_catlist_size; c++ )
|
||||
{
|
||||
|
@ -82,17 +84,20 @@ int main(int argc, char **argv)
|
|||
case P80211_TYPE_INT:
|
||||
case P80211_TYPE_ENUMINT:
|
||||
case P80211_TYPE_BITARRAY:
|
||||
/* already aligned */
|
||||
printf("\tp80211item_uint32_t");
|
||||
printf("\t%s\t__WLAN_ATTRIB_PACK__;\n",
|
||||
msg_catlist[c].grplist[g].itemlist[i].name);
|
||||
break;
|
||||
case P80211_TYPE_UNKDATA:
|
||||
/* already aligned */
|
||||
printf("\tp80211item_unk%ld_t",
|
||||
msg_catlist[c].grplist[g].itemlist[i].maxlen);
|
||||
printf("\t%s\t__WLAN_ATTRIB_PACK__;\n",
|
||||
msg_catlist[c].grplist[g].itemlist[i].name);
|
||||
break;
|
||||
case P80211_TYPE_INTARRAY:
|
||||
/* already aligned */
|
||||
printf("\tstruct {\n");
|
||||
printf("\t\tUINT32\tdid\t__WLAN_ATTRIB_PACK__;\n");
|
||||
printf("\t\tUINT16\tstatus\t__WLAN_ATTRIB_PACK__;\n");
|
||||
|
@ -103,6 +108,7 @@ int main(int argc, char **argv)
|
|||
msg_catlist[c].grplist[g].itemlist[i].name);
|
||||
break;
|
||||
case P80211_TYPE_MACARRAY:
|
||||
/* May not be aligned, thanks to variable-length array. */
|
||||
printf("\tstruct {\n");
|
||||
printf("\t\tUINT32\tdid\t__WLAN_ATTRIB_PACK__;\n");
|
||||
printf("\t\tUINT16\tstatus\t__WLAN_ATTRIB_PACK__;\n");
|
||||
|
@ -110,20 +116,39 @@ int main(int argc, char **argv)
|
|||
printf("\t\tUINT32\tcnt\t__WLAN_ATTRIB_PACK__;\n");
|
||||
printf("\t\tUINT8\tdata[%ld][WLAN_ADDR_LEN]\t__WLAN_ATTRIB_PACK__;\n",
|
||||
msg_catlist[c].grplist[g].itemlist[i].maxlen);
|
||||
|
||||
if (msg_catlist[c].grplist[g].itemlist[i].maxlen % 4)
|
||||
printf("\t\tUINT8\tpad_%dB[%ld]\t__WLAN_ATTRIB_PACK__;\n",
|
||||
pad_id++,
|
||||
(4 - ((msg_catlist[c].grplist[g].itemlist[i].maxlen * 6) % 4)));
|
||||
|
||||
printf("\t\t} %s\t__WLAN_ATTRIB_PACK__;\n",
|
||||
msg_catlist[c].grplist[g].itemlist[i].name);
|
||||
break;
|
||||
case P80211_TYPE_OCTETSTR:
|
||||
/* May not be aligned. it's a string. */
|
||||
printf("\tp80211item_pstr%ld_t",
|
||||
msg_catlist[c].grplist[g].itemlist[i].maxlen);
|
||||
printf("\t%s\t__WLAN_ATTRIB_PACK__;\n",
|
||||
msg_catlist[c].grplist[g].itemlist[i].name);
|
||||
|
||||
if ((msg_catlist[c].grplist[g].itemlist[i].maxlen + 1) % 4)
|
||||
printf("\tUINT8\tpad_%dC[%ld]\t__WLAN_ATTRIB_PACK__;\n",
|
||||
pad_id++,
|
||||
(4 - ((msg_catlist[c].grplist[g].itemlist[i].maxlen + 1) % 4)));
|
||||
|
||||
break;
|
||||
default:
|
||||
/* May not be aligned. it's a string. */
|
||||
printf("\tp80211item_pstr%ld_t",
|
||||
msg_catlist[c].grplist[g].itemlist[i].maxlen);
|
||||
printf("\t%s\t__WLAN_ATTRIB_PACK__;\n",
|
||||
msg_catlist[c].grplist[g].itemlist[i].name);
|
||||
|
||||
if ((msg_catlist[c].grplist[g].itemlist[i].maxlen + 1) % 4)
|
||||
printf("\tUINT8\tpad_%dD[%ld]\t__WLAN_ATTRIB_PACK__;\n",
|
||||
pad_id++,
|
||||
(4 - ((msg_catlist[c].grplist[g].itemlist[i].maxlen + 1) % 4)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -724,6 +724,11 @@ UINT32 p80211item_maxdatalen( catlistitem_t *metalist, UINT32 did )
|
|||
maxlen = 0xffffffffUL;
|
||||
}
|
||||
|
||||
/* pad for 32-bit aligmnent. */
|
||||
if (maxlen != 0xffffffffUL)
|
||||
if (maxlen % 4)
|
||||
maxlen += (4 - (maxlen % 4));
|
||||
|
||||
return maxlen;
|
||||
}
|
||||
|
||||
|
|
|
@ -512,7 +512,7 @@ void printmsg( UINT8 *msg, UINT32 msgcode )
|
|||
|
||||
for ( i = 1; i < narg; i++ ) {
|
||||
tmpdid = msgcode | P80211DID_MKITEM(i) | alist[i].did;
|
||||
offset =p80211item_getoffset(msg_catlist, tmpdid);
|
||||
offset = p80211item_getoffset(msg_catlist, tmpdid);
|
||||
msgptr = start + offset;
|
||||
|
||||
/* pass tmpdid since the 'totext' functions */
|
||||
|
|
Loading…
Reference in a new issue