mirror of
https://github.com/chirpstack/chirpstack.git
synced 2025-06-20 00:04:00 +00:00
Fix LoRaWAN 1.1 downlink fopts encryption.
This commit is contained in:
@ -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.
|
// Set MIC.
|
||||||
// If this is an ACK, then FCntUp has already been incremented by one. If
|
// 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.
|
// this is not an ACK, then DownlinkDataMIC will zero out ConfFCnt.
|
||||||
|
@ -2393,14 +2393,14 @@ async fn test_lorawan_11_mac_commands() {
|
|||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
f_opts: lrwn::MACCommandSet::new(vec![lrwn::MACCommand::Raw(vec![
|
f_opts: lrwn::MACCommandSet::new(vec![lrwn::MACCommand::Raw(vec![
|
||||||
2, 20, 1,
|
85, 88, 242,
|
||||||
])]),
|
])]),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
f_port: None,
|
f_port: None,
|
||||||
frm_payload: None,
|
frm_payload: None,
|
||||||
}),
|
}),
|
||||||
mic: Some([119, 74, 235, 162]),
|
mic: Some([124, 101, 247, 223]),
|
||||||
},
|
},
|
||||||
lrwn::PhyPayload {
|
lrwn::PhyPayload {
|
||||||
mhdr: lrwn::MHDR {
|
mhdr: lrwn::MHDR {
|
||||||
@ -2417,14 +2417,14 @@ async fn test_lorawan_11_mac_commands() {
|
|||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
f_opts: lrwn::MACCommandSet::new(vec![lrwn::MACCommand::Raw(vec![
|
f_opts: lrwn::MACCommandSet::new(vec![lrwn::MACCommand::Raw(vec![
|
||||||
2, 20, 1,
|
85, 88, 242,
|
||||||
])]),
|
])]),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
f_port: None,
|
f_port: None,
|
||||||
frm_payload: 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()
|
..Default::default()
|
||||||
},
|
},
|
||||||
f_opts: lrwn::MACCommandSet::new(vec![
|
f_opts: lrwn::MACCommandSet::new(vec![
|
||||||
lrwn::MACCommand::Raw(vec![2,20,1]),
|
lrwn::MACCommand::Raw(vec![85, 88, 242]),
|
||||||
]),
|
]),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
f_port: None,
|
f_port: None,
|
||||||
frm_payload: None,
|
frm_payload: None,
|
||||||
}),
|
}),
|
||||||
mic: Some([183, 102, 104, 194]),
|
mic: Some([227, 104, 50, 163]),
|
||||||
},
|
},
|
||||||
lrwn::PhyPayload {
|
lrwn::PhyPayload {
|
||||||
mhdr: lrwn::MHDR {
|
mhdr: lrwn::MHDR {
|
||||||
@ -3355,14 +3355,14 @@ async fn test_lorawan_11_device_queue() {
|
|||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
f_opts: lrwn::MACCommandSet::new(vec![
|
f_opts: lrwn::MACCommandSet::new(vec![
|
||||||
lrwn::MACCommand::Raw(vec![2,20,1]),
|
lrwn::MACCommand::Raw(vec![85, 88, 242]),
|
||||||
]),
|
]),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
f_port: None,
|
f_port: None,
|
||||||
frm_payload: None,
|
frm_payload: None,
|
||||||
}),
|
}),
|
||||||
mic: Some([183, 102, 104, 194]),
|
mic: Some([227, 104, 50, 163]),
|
||||||
},
|
},
|
||||||
]),
|
]),
|
||||||
],
|
],
|
||||||
|
Reference in New Issue
Block a user