From 9f338bccb22e1c7756a0579ca48cd9c42dc43788 Mon Sep 17 00:00:00 2001 From: Adrian-Stefan Mares Date: Wed, 29 Nov 2023 17:43:08 +0100 Subject: [PATCH] gs: Disconnect gateway on Gateway Server address change --- CHANGELOG.md | 2 ++ pkg/gatewayserver/gatewayserver.go | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6dd3a99d56..a69b719fc0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,8 @@ For details about compatibility between different releases, see the **Commitment ### Changed - Server side events replaced with single socket connection using the native WebSocket API. +- Gateways now disconnect if the Gateway Server address has changed. + - This enables CUPS-enabled gateways to change their LNS before the periodic CUPS lookup occurs. ### Deprecated diff --git a/pkg/gatewayserver/gatewayserver.go b/pkg/gatewayserver/gatewayserver.go index 450bf831c5..63ca1790ec 100644 --- a/pkg/gatewayserver/gatewayserver.go +++ b/pkg/gatewayserver/gatewayserver.go @@ -486,6 +486,7 @@ func (gs *GatewayServer) Connect( "enforce_duty_cycle", "frequency_plan_id", "frequency_plan_ids", + "gateway_server_address", "location_public", "require_authenticated_connection", "schedule_anytime_delay", @@ -611,7 +612,8 @@ func requireDisconnect(connected, current *ttnpb.Gateway) bool { connected.StatusPublic != current.StatusPublic || connected.UpdateLocationFromStatus != current.UpdateLocationFromStatus || connected.FrequencyPlanId != current.FrequencyPlanId || - len(connected.FrequencyPlanIds) != len(current.FrequencyPlanIds) { + len(connected.FrequencyPlanIds) != len(current.FrequencyPlanIds) || + connected.GatewayServerAddress != current.GatewayServerAddress { return true } for i := range connected.FrequencyPlanIds { @@ -646,6 +648,7 @@ func (gs *GatewayServer) startDisconnectOnChangeTask(conn connectionEntry) { "enforce_duty_cycle", "frequency_plan_id", "frequency_plan_ids", + "gateway_server_address", "location_public", "require_authenticated_connection", "schedule_anytime_delay",