mirror of
https://github.com/chirpstack/chirpstack.git
synced 2024-12-19 13:17:55 +00:00
Add config option to allow unknown gateways.
This commit is contained in:
parent
bf6df9c845
commit
613f4562a2
@ -104,6 +104,12 @@ pub fn run() {
|
||||
# This defines how long (after generating) the certificate remains valid.
|
||||
client_cert_lifetime="{{ gateway.client_cert_lifetime }}"
|
||||
|
||||
# Allow unknown gateways.
|
||||
#
|
||||
# If set to true, then uplinks received from gateways not configured in
|
||||
# ChirpStack will be allowed.
|
||||
allow_unknown_gateways={{ gateway.allow_unknown_gateways }}
|
||||
|
||||
|
||||
# Network related configuration.
|
||||
[network]
|
||||
|
@ -132,6 +132,7 @@ pub struct Gateway {
|
||||
pub client_cert_lifetime: Duration,
|
||||
pub ca_cert: String,
|
||||
pub ca_key: String,
|
||||
pub allow_unknown_gateways: bool,
|
||||
}
|
||||
|
||||
impl Default for Gateway {
|
||||
@ -140,6 +141,7 @@ impl Default for Gateway {
|
||||
client_cert_lifetime: Duration::from_secs(60 * 60 * 24 * 365),
|
||||
ca_cert: "".to_string(),
|
||||
ca_key: "".to_string(),
|
||||
allow_unknown_gateways: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ use uuid::Uuid;
|
||||
|
||||
use crate::config;
|
||||
use crate::framelog;
|
||||
use crate::storage::{gateway, get_redis_conn, redis_key};
|
||||
use crate::storage::{error::Error as StorageError, gateway, get_redis_conn, redis_key};
|
||||
use chirpstack_api::{api, common, gw};
|
||||
use lrwn::region::CommonName;
|
||||
use lrwn::{MType, PhyPayload, EUI64};
|
||||
@ -304,11 +304,19 @@ pub async fn handle_uplink(deduplication_id: Uuid, uplink: gw::UplinkFrameSet) -
|
||||
}
|
||||
|
||||
async fn update_gateway_metadata(ufs: &mut UplinkFrameSet) -> Result<()> {
|
||||
let conf = config::get();
|
||||
for rx_info in &mut ufs.rx_info_set {
|
||||
let gw_id = EUI64::from_str(&rx_info.gateway_id)?;
|
||||
let gw_meta = match gateway::get_meta(&gw_id).await {
|
||||
Ok(v) => v,
|
||||
Err(e) => {
|
||||
if conf.gateway.allow_unknown_gateways {
|
||||
if let StorageError::NotFound(_) = e {
|
||||
ufs.gateway_private_map.insert(gw_id, false);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
error!(
|
||||
gateway_id = gw_id.to_string().as_str(),
|
||||
error = format!("{}", e).as_str(),
|
||||
|
Loading…
Reference in New Issue
Block a user