From 6d61c30937457b09ca5802c46ec2073e23ad6b87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20W=C3=B3jcik?= Date: Mon, 22 Dec 2025 14:10:10 +0100 Subject: [PATCH] don't check traffic policy for native tunnels --- .../LocationCardRoute/LocationCardRoute.tsx | 24 ++++++++++++------- .../MfaMobileApprove/MfaMobileApprove.tsx | 2 +- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/pages/client/pages/ClientInstancePage/components/LocationsList/components/LocationCardRoute/LocationCardRoute.tsx b/src/pages/client/pages/ClientInstancePage/components/LocationsList/components/LocationCardRoute/LocationCardRoute.tsx index fa2c6003..8fd65974 100644 --- a/src/pages/client/pages/ClientInstancePage/components/LocationsList/components/LocationCardRoute/LocationCardRoute.tsx +++ b/src/pages/client/pages/ClientInstancePage/components/LocationsList/components/LocationCardRoute/LocationCardRoute.tsx @@ -8,6 +8,7 @@ import { Toggle } from '../../../../../../../../shared/defguard-ui/components/La import type { ToggleOption } from '../../../../../../../../shared/defguard-ui/components/Layout/Toggle/types'; import { clientApi } from '../../../../../../clientAPI/clientApi'; import { + ClientConnectionType, ClientTrafficPolicy, type CommonWireguardFields, type DefguardInstance, @@ -57,16 +58,23 @@ export const LocationCardRoute = ({ location, selectedDefguardInstance }: Props) }, [LL.pages, selectedDefguardInstance?.client_traffic_policy]); let selected: number; - if (selectedDefguardInstance?.client_traffic_policy === ClientTrafficPolicy.NONE) { - selected = Number(location?.route_all_traffic); - } else if ( - selectedDefguardInstance?.client_traffic_policy === - ClientTrafficPolicy.DISABLE_ALL_TRAFFIC - ) { - selected = 0; + // check traffic policy for Defguard locations + if (location?.connection_type === ClientConnectionType.LOCATION) { + if (selectedDefguardInstance?.client_traffic_policy === ClientTrafficPolicy.NONE) { + selected = Number(location?.route_all_traffic); + } else if ( + selectedDefguardInstance?.client_traffic_policy === + ClientTrafficPolicy.DISABLE_ALL_TRAFFIC + ) { + selected = 0; + } else { + selected = 1; + } } else { - selected = 1; + // fall back to selected value for basic WireGuard tunnels + selected = Number(location?.route_all_traffic); } + return (