Decode frm_payload mac-commands in device frame log.

This commit is contained in:
Orne Brocaar
2023-03-02 12:21:42 +00:00
parent 9ab059a552
commit ddea09d9d4
6 changed files with 38 additions and 2 deletions

View File

@ -288,6 +288,7 @@ impl Data {
// The queue item should fit within the max payload size and should not be pending
// already.
if qi.data.len() <= max_payload_size && !qi.is_pending {
trace!(id = %qi.id, more_in_queue = more_in_queue, "Found device queue-item for downlink");
self.device_queue_item = Some(qi);
self.more_device_queue_items = more_in_queue;
return Ok(());
@ -634,6 +635,7 @@ impl Data {
.starts_with("1.1"),
nwk_s_enc_key: self.device_session.nwk_s_enc_key.clone(),
downlink_frame: Some(self.downlink_frame.clone()),
n_f_cnt_down: self.device_session.n_f_cnt_down,
..Default::default()
})
.await

View File

@ -433,6 +433,13 @@ impl TxAck {
let nwk_s_enc_key = AES128Key::from_slice(&df.nwk_s_enc_key)?;
if let Payload::MACPayload(pl) = &mut phy.payload {
if pl.f_port.unwrap_or(0) == 0 {
// We need to set the full NFcntDown to decrypt the mac-commands.
pl.fhdr.f_cnt = df.n_f_cnt_down;
}
}
if let Payload::MACPayload(pl) = &phy.payload {
// f_port must be either None or 0
if pl.f_port.unwrap_or(0) == 0 {

View File

@ -283,6 +283,7 @@ pub async fn get_frame_logs(
let mut phy = lrwn::PhyPayload::from_slice(&pl.phy_payload)?;
if pl.plaintext_mac_commands {
phy.decode_f_opts_to_mac_commands()?;
phy.decode_frm_payload_to_mac_commands()?;
}
let pl = api::LogItem {
@ -314,6 +315,7 @@ pub async fn get_frame_logs(
let mut phy = lrwn::PhyPayload::from_slice(&pl.phy_payload)?;
if pl.plaintext_mac_commands {
phy.decode_f_opts_to_mac_commands()?;
phy.decode_frm_payload_to_mac_commands()?;
}
let pl = api::LogItem {