llsec: Fix for Issue #1537

This commit is contained in:
kkrentz 2016-03-02 01:58:19 -08:00
parent 4a88e9e537
commit 7353829c72

View file

@ -143,16 +143,15 @@ aead(uint8_t hdrlen, int forward)
static void static void
add_security_header(void) add_security_header(void)
{ {
if(!packetbuf_attr(PACKETBUF_ATTR_SECURITY_LEVEL)) {
packetbuf_set_attr(PACKETBUF_ATTR_FRAME_TYPE, FRAME802154_DATAFRAME); packetbuf_set_attr(PACKETBUF_ATTR_FRAME_TYPE, FRAME802154_DATAFRAME);
packetbuf_set_attr(PACKETBUF_ATTR_SECURITY_LEVEL, SEC_LVL); packetbuf_set_attr(PACKETBUF_ATTR_SECURITY_LEVEL, SEC_LVL);
anti_replay_set_counter();
}
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static void static void
send(mac_callback_t sent, void *ptr) send(mac_callback_t sent, void *ptr)
{ {
add_security_header();
anti_replay_set_counter();
NETSTACK_MAC.send(sent, ptr); NETSTACK_MAC.send(sent, ptr);
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
@ -161,7 +160,6 @@ create(void)
{ {
int result; int result;
add_security_header();
result = DECORATED_FRAMER.create(); result = DECORATED_FRAMER.create();
if(result == FRAMER_FAILED) { if(result == FRAMER_FAILED) {
return result; return result;