mirror of
https://github.com/chirpstack/chirpstack.git
synced 2024-12-23 23:12:26 +00:00
Fix LoRaWAN 1.1 downlink fopts encryption.
This commit is contained in:
parent
2b1bf3b96f
commit
7868629533
@ -557,6 +557,19 @@ impl Data {
|
||||
}
|
||||
}
|
||||
|
||||
// Encrypt f_opts mac-commands (LoRaWAN 1.1)
|
||||
if !self
|
||||
.device_session
|
||||
.mac_version()
|
||||
.to_string()
|
||||
.starts_with("1.0")
|
||||
{
|
||||
phy.encrypt_f_opts(&lrwn::AES128Key::from_slice(
|
||||
&self.device_session.nwk_s_enc_key,
|
||||
)?)
|
||||
.context("Encrypt f_opts")?;
|
||||
}
|
||||
|
||||
// Set MIC.
|
||||
// If this is an ACK, then FCntUp has already been incremented by one. If
|
||||
// this is not an ACK, then DownlinkDataMIC will zero out ConfFCnt.
|
||||
|
@ -2393,14 +2393,14 @@ async fn test_lorawan_11_mac_commands() {
|
||||
..Default::default()
|
||||
},
|
||||
f_opts: lrwn::MACCommandSet::new(vec![lrwn::MACCommand::Raw(vec![
|
||||
2, 20, 1,
|
||||
85, 88, 242,
|
||||
])]),
|
||||
..Default::default()
|
||||
},
|
||||
f_port: None,
|
||||
frm_payload: None,
|
||||
}),
|
||||
mic: Some([119, 74, 235, 162]),
|
||||
mic: Some([124, 101, 247, 223]),
|
||||
},
|
||||
lrwn::PhyPayload {
|
||||
mhdr: lrwn::MHDR {
|
||||
@ -2417,14 +2417,14 @@ async fn test_lorawan_11_mac_commands() {
|
||||
..Default::default()
|
||||
},
|
||||
f_opts: lrwn::MACCommandSet::new(vec![lrwn::MACCommand::Raw(vec![
|
||||
2, 20, 1,
|
||||
85, 88, 242,
|
||||
])]),
|
||||
..Default::default()
|
||||
},
|
||||
f_port: None,
|
||||
frm_payload: None,
|
||||
}),
|
||||
mic: Some([119, 74, 235, 162]),
|
||||
mic: Some([124, 101, 247, 223]),
|
||||
},
|
||||
]),
|
||||
],
|
||||
@ -3329,14 +3329,14 @@ async fn test_lorawan_11_device_queue() {
|
||||
..Default::default()
|
||||
},
|
||||
f_opts: lrwn::MACCommandSet::new(vec![
|
||||
lrwn::MACCommand::Raw(vec![2,20,1]),
|
||||
lrwn::MACCommand::Raw(vec![85, 88, 242]),
|
||||
]),
|
||||
..Default::default()
|
||||
},
|
||||
f_port: None,
|
||||
frm_payload: None,
|
||||
}),
|
||||
mic: Some([183, 102, 104, 194]),
|
||||
mic: Some([227, 104, 50, 163]),
|
||||
},
|
||||
lrwn::PhyPayload {
|
||||
mhdr: lrwn::MHDR {
|
||||
@ -3355,14 +3355,14 @@ async fn test_lorawan_11_device_queue() {
|
||||
..Default::default()
|
||||
},
|
||||
f_opts: lrwn::MACCommandSet::new(vec![
|
||||
lrwn::MACCommand::Raw(vec![2,20,1]),
|
||||
lrwn::MACCommand::Raw(vec![85, 88, 242]),
|
||||
]),
|
||||
..Default::default()
|
||||
},
|
||||
f_port: None,
|
||||
frm_payload: None,
|
||||
}),
|
||||
mic: Some([183, 102, 104, 194]),
|
||||
mic: Some([227, 104, 50, 163]),
|
||||
},
|
||||
]),
|
||||
],
|
||||
|
Loading…
Reference in New Issue
Block a user