mirror of
https://github.com/chirpstack/chirpstack.git
synced 2025-05-06 10:58:27 +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.
|
# This defines how long (after generating) the certificate remains valid.
|
||||||
client_cert_lifetime="{{ gateway.client_cert_lifetime }}"
|
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 related configuration.
|
||||||
[network]
|
[network]
|
||||||
|
@ -132,6 +132,7 @@ pub struct Gateway {
|
|||||||
pub client_cert_lifetime: Duration,
|
pub client_cert_lifetime: Duration,
|
||||||
pub ca_cert: String,
|
pub ca_cert: String,
|
||||||
pub ca_key: String,
|
pub ca_key: String,
|
||||||
|
pub allow_unknown_gateways: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Gateway {
|
impl Default for Gateway {
|
||||||
@ -140,6 +141,7 @@ impl Default for Gateway {
|
|||||||
client_cert_lifetime: Duration::from_secs(60 * 60 * 24 * 365),
|
client_cert_lifetime: Duration::from_secs(60 * 60 * 24 * 365),
|
||||||
ca_cert: "".to_string(),
|
ca_cert: "".to_string(),
|
||||||
ca_key: "".to_string(),
|
ca_key: "".to_string(),
|
||||||
|
allow_unknown_gateways: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ use uuid::Uuid;
|
|||||||
|
|
||||||
use crate::config;
|
use crate::config;
|
||||||
use crate::framelog;
|
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 chirpstack_api::{api, common, gw};
|
||||||
use lrwn::region::CommonName;
|
use lrwn::region::CommonName;
|
||||||
use lrwn::{MType, PhyPayload, EUI64};
|
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<()> {
|
async fn update_gateway_metadata(ufs: &mut UplinkFrameSet) -> Result<()> {
|
||||||
|
let conf = config::get();
|
||||||
for rx_info in &mut ufs.rx_info_set {
|
for rx_info in &mut ufs.rx_info_set {
|
||||||
let gw_id = EUI64::from_str(&rx_info.gateway_id)?;
|
let gw_id = EUI64::from_str(&rx_info.gateway_id)?;
|
||||||
let gw_meta = match gateway::get_meta(&gw_id).await {
|
let gw_meta = match gateway::get_meta(&gw_id).await {
|
||||||
Ok(v) => v,
|
Ok(v) => v,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
if conf.gateway.allow_unknown_gateways {
|
||||||
|
if let StorageError::NotFound(_) = e {
|
||||||
|
ufs.gateway_private_map.insert(gw_id, false);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
error!(
|
error!(
|
||||||
gateway_id = gw_id.to_string().as_str(),
|
gateway_id = gw_id.to_string().as_str(),
|
||||||
error = format!("{}", e).as_str(),
|
error = format!("{}", e).as_str(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user