Merge pull request #635 from nfi/linkaddr-size

Use LINKADDR_SIZE instead of sizeof(linkaddr_t) to avoid struct padding problems.
This commit is contained in:
Adam Dunkels 2014-06-11 23:18:27 +02:00
commit cff30a394b
2 changed files with 3 additions and 3 deletions

View file

@ -132,7 +132,7 @@ create_frame(int type, int do_create)
\todo For phase 1 the addresses are all long. We'll need a mechanism \todo For phase 1 the addresses are all long. We'll need a mechanism
in the rime attributes to tell the mac to use long or short for phase 2. in the rime attributes to tell the mac to use long or short for phase 2.
*/ */
if(sizeof(linkaddr_t) == 2) { if(LINKADDR_SIZE == 2) {
/* Use short address mode if linkaddr size is short. */ /* Use short address mode if linkaddr size is short. */
params.fcf.src_addr_mode = FRAME802154_SHORTADDRMODE; params.fcf.src_addr_mode = FRAME802154_SHORTADDRMODE;
} else { } else {
@ -154,7 +154,7 @@ create_frame(int type, int do_create)
linkaddr_copy((linkaddr_t *)&params.dest_addr, linkaddr_copy((linkaddr_t *)&params.dest_addr,
packetbuf_addr(PACKETBUF_ADDR_RECEIVER)); packetbuf_addr(PACKETBUF_ADDR_RECEIVER));
/* Use short address mode if linkaddr size is small */ /* Use short address mode if linkaddr size is small */
if(sizeof(linkaddr_t) == 2) { if(LINKADDR_SIZE == 2) {
params.fcf.dest_addr_mode = FRAME802154_SHORTADDRMODE; params.fcf.dest_addr_mode = FRAME802154_SHORTADDRMODE;
} else { } else {
params.fcf.dest_addr_mode = FRAME802154_LONGADDRMODE; params.fcf.dest_addr_mode = FRAME802154_LONGADDRMODE;

View file

@ -434,7 +434,7 @@ void packetbuf_attr_copyfrom(struct packetbuf_attr *attrs,
#define PACKETBUF_ATTR_BIT 1 #define PACKETBUF_ATTR_BIT 1
#define PACKETBUF_ATTR_BYTE 8 #define PACKETBUF_ATTR_BYTE 8
#define PACKETBUF_ADDRSIZE (sizeof(linkaddr_t) * PACKETBUF_ATTR_BYTE) #define PACKETBUF_ADDRSIZE (LINKADDR_SIZE * PACKETBUF_ATTR_BYTE)
struct packetbuf_attrlist { struct packetbuf_attrlist {
uint8_t type; uint8_t type;