From 276d9d3fb7bbe601124d0fc48cbda8610ca28067 Mon Sep 17 00:00:00 2001 From: Loren Eteval Date: Sun, 10 Sep 2023 14:20:30 +0800 Subject: [PATCH] Handle missing default gateways Signed-off-by: Loren Eteval --- Furious/Action/Connect.py | 10 ++++++++++ Furious/Utility/Translator.py | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/Furious/Action/Connect.py b/Furious/Action/Connect.py index 059751e..ac77c39 100644 --- a/Furious/Action/Connect.py +++ b/Furious/Action/Connect.py @@ -909,6 +909,16 @@ class ConnectAction(Action): ) ) + if len(defaultGateway) == 0: + logger.error(f'no gateway address found') + + self.coreRunning = False + self.disconnectReason = ( + _('Unable to connect') + ': ' + _('No gateway address found') + ) + + return + if len(defaultGateway) != 1: logger.error(f'found multiple gateway addresses: {defaultGateway}') diff --git a/Furious/Utility/Translator.py b/Furious/Utility/Translator.py index b5840dc..56ec284 100644 --- a/Furious/Utility/Translator.py +++ b/Furious/Utility/Translator.py @@ -956,6 +956,11 @@ TRANSLATION = { 'ZH': 'VPN模式已停止', 'TW': 'VPN模式已停止', }, + 'No gateway address found': { + 'ES': 'No se encontró ninguna dirección de puerta de enlace', + 'ZH': '找不到网关地址', + 'TW': '找不到網關地址', + }, 'Multiple gateway addresses found': { 'ES': 'Se encontraron varias direcciones de puerta de enlace', 'ZH': '找到多个网关地址',