[mac-frame] handle exception case for payload of mac cmd (#5499)

In current Mac::Frame implementation, when the frame is a Mac command,
the CommandId is always not included as its private payload, which
means we won't encrypt the CommandId.

In most cases the Private Payload(things we need to encrypt) shall be
set to the MAC Payload field(For Mac cmd, this field includes
CommandId, shown in Figure 7-17) and the Open Payload shall be
empty. The only 2 exception cases are listed in Table 9-1.

So for Mac command with version >= 2, its CommandId should be included
in Private Payload and should be encrypted when necessary. For Mac
command with version < 2, CommandId should be in included in Open
Payload and shouldn't be encrypted.

This commit fixes this problem and adds unit tests for this.
This commit is contained in:
Li Cao
2020-09-08 18:24:17 -07:00
committed by GitHub
parent 3ffc503c32
commit e9d578da51
3 changed files with 49 additions and 7 deletions
-1
View File
@@ -163,7 +163,6 @@ do_unit()
if [[ ${THREAD_VERSION} == "1.2" ]]; then
do_unit_version "1.2-bbr"
do_unit_version "1.1"
fi
}