Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cc2420] Explicitly check the length field #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tim-ist
Copy link

@tim-ist tim-ist commented May 8, 2015

While experimenting with TinyOS apps in Cooja I experienced unhanded exceptions causing the simulation to terminate. Among other problems I noticed that sometimes the length field of received and transmitted packets was incorrect (too large or too small).

The reasons for this might be different, I identified at least three:

  • a collision after the SFD gives length 0xFF in Cooja, or
  • a lost byte in SPI, shifting the whole frame (might be due to a radio driver bug),
  • length zero is received when the synch header of a new louder packet arrives just after the SFD of a weaker packet (winning because of the "capture effect" of MRM).

Regardless the reason, it would be nice to handle the incorrect values explicitly.
This patch adds checks of the length field at RX, rejecting all non-compliant packets. At TX it considers only the first seven bits of the length byte as the length field, resetting its MSB to zero, in accordance with IEEE 802.15.4.

IEEE 802.15.4 allows data packets of 9-127 bytes and acknowledgements of length 5.
This patch adds a check for the received packet length and rejects non-compliant packets.

For transmitted packets only 7 bits are considered as packet length and the
MSB of the byte holding the length field is reset to zero (to comply with the standard).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant