mirror of
https://github.com/chirpstack/chirpstack.git
synced 2024-12-23 15:02:26 +00:00
Add check to make sure gateway region = device-profile region.
This commit is contained in:
parent
3486d94441
commit
bd79e72bdb
@ -158,8 +158,12 @@ impl Data {
|
||||
|
||||
async fn get_device_profile(&mut self) -> Result<()> {
|
||||
trace!("Getting the device-profile");
|
||||
self.device_profile =
|
||||
Some(device_profile::get(&self.device.as_ref().unwrap().device_profile_id).await?);
|
||||
let dp = device_profile::get(&self.device.as_ref().unwrap().device_profile_id).await?;
|
||||
if dp.region != self.uplink_frame_set.region_common_name {
|
||||
return Err(anyhow!("Invalid device-profile region"));
|
||||
}
|
||||
self.device_profile = Some(dp);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -152,8 +152,12 @@ impl JoinRequest {
|
||||
async fn get_device_profile(&mut self) -> Result<()> {
|
||||
trace!("Getting device-profile");
|
||||
|
||||
self.device_profile =
|
||||
Some(device_profile::get(&self.device.as_ref().unwrap().device_profile_id).await?);
|
||||
let dp = device_profile::get(&self.device.as_ref().unwrap().device_profile_id).await?;
|
||||
if dp.region != self.uplink_frame_set.region_common_name {
|
||||
return Err(anyhow!("Invalid device-profile region"));
|
||||
}
|
||||
|
||||
self.device_profile = Some(dp);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user