Consistently use PACKETBUF_ATTR_MAC_SEQNO for MAC sequence number, both input and output. Disable PACKETBUF_ATTR_PACKET_ID in the non-Rime case.

This commit is contained in:
Simon Duquennoy 2015-05-06 14:23:32 +02:00
parent bb76bb8beb
commit 290fc829ea
6 changed files with 10 additions and 5 deletions

View File

@ -242,7 +242,10 @@ parse(void)
}
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, (linkaddr_t *)&frame.src_addr);
packetbuf_set_attr(PACKETBUF_ATTR_PENDING, frame.fcf.frame_pending);
packetbuf_set_attr(PACKETBUF_ATTR_MAC_SEQNO, frame.seq);
#if NETSTACK_CONF_WITH_RIME
packetbuf_set_attr(PACKETBUF_ATTR_PACKET_ID, frame.seq);
#endif
#if LLSEC802154_SECURITY_LEVEL
if(frame.fcf.security_enabled) {

View File

@ -74,7 +74,7 @@ mac_sequence_is_duplicate(void)
for(i = 0; i < MAX_SEQNOS; ++i) {
if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_SENDER),
&received_seqnos[i].sender)) {
if(packetbuf_attr(PACKETBUF_ATTR_PACKET_ID) == received_seqnos[i].seqno) {
if(packetbuf_attr(PACKETBUF_ATTR_MAC_SEQNO) == received_seqnos[i].seqno) {
/* Duplicate packet. */
return 1;
}
@ -102,7 +102,7 @@ mac_sequence_register_seqno(void)
for(j = i - 1; j > 0; --j) {
memcpy(&received_seqnos[j], &received_seqnos[j - 1], sizeof(struct seqno));
}
received_seqnos[0].seqno = packetbuf_attr(PACKETBUF_ATTR_PACKET_ID);
received_seqnos[0].seqno = packetbuf_attr(PACKETBUF_ATTR_MAC_SEQNO);
linkaddr_copy(&received_seqnos[0].sender,
packetbuf_addr(PACKETBUF_ADDR_SENDER));
}

View File

@ -294,7 +294,7 @@ packet_input(void)
if(duplicate) {
/* Drop the packet. */
PRINTF("nullrdc: drop duplicate link layer packet %u\n",
packetbuf_attr(PACKETBUF_ATTR_PACKET_ID));
packetbuf_attr(PACKETBUF_ATTR_MAC_SEQNO));
} else {
mac_sequence_register_seqno();
}

View File

@ -309,9 +309,9 @@ enum {
PACKETBUF_ATTR_IS_CREATED_AND_SECURED,
/* Scope 1 attributes: used between two neighbors only. */
PACKETBUF_ATTR_PACKET_ID,
PACKETBUF_ATTR_PACKET_TYPE,
#if NETSTACK_CONF_WITH_RIME
PACKETBUF_ATTR_PACKET_ID,
PACKETBUF_ATTR_RELIABLE,
PACKETBUF_ATTR_REXMIT,
PACKETBUF_ATTR_MAX_REXMIT,

View File

@ -402,8 +402,10 @@ sicslowmac_dataRequest(void)
frame_create_params_t params;
frame_result_t result;
#if NETSTACK_CONF_WITH_RIME
/* Save the msduHandle in a global variable. */
msduHandle = packetbuf_attr(PACKETBUF_ATTR_PACKET_ID);
#endif
/* Build the FCF. */
params.fcf.frameType = DATAFRAME;

View File

@ -109,7 +109,7 @@ parse(void)
}
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, (linkaddr_t *)&frame.src_addr);
packetbuf_set_attr(PACKETBUF_ATTR_PENDING, frame.fcf.frame_pending);
packetbuf_set_attr(PACKETBUF_ATTR_PACKET_ID, frame.seq);
packetbuf_set_attr(PACKETBUF_ATTR_MAC_SEQNO, frame.seq);
PRINTF("15.4-IN: %2X", frame.fcf.frame_type);
PRINTADDR(packetbuf_addr(PACKETBUF_ADDR_SENDER));