From d9aa0a1fc32de9bb9f7e11399e19db835d175325 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Ciarcin=CC=81ski?= Date: Wed, 14 Jan 2026 16:08:37 +0100 Subject: [PATCH 1/3] Add MTU and FwMark to web interface --- .../pages/AddLocationPage/AddLocationPage.tsx | 2 +- .../steps/AddLocationNetworkStep.tsx | 18 ++++++++++++++++++ .../AddLocationPage/useAddLocationStore.tsx | 2 ++ .../EditLocationPage/EditLocationPage.tsx | 4 ++++ web/src/shared/api/types.ts | 2 ++ 5 files changed, 27 insertions(+), 1 deletion(-) diff --git a/web/src/pages/AddLocationPage/AddLocationPage.tsx b/web/src/pages/AddLocationPage/AddLocationPage.tsx index 66adc18401..42695ccd6d 100644 --- a/web/src/pages/AddLocationPage/AddLocationPage.tsx +++ b/web/src/pages/AddLocationPage/AddLocationPage.tsx @@ -29,7 +29,7 @@ export const AddLocationPage = () => { internalVpnSettings: { id: AddLocationPageStep.InternalVpnSettings, order: 1, - label: 'Internal VPN ', + label: 'Internal VPN', description: 'Manage core details and connection parameters for your VPN location.', }, diff --git a/web/src/pages/AddLocationPage/steps/AddLocationNetworkStep.tsx b/web/src/pages/AddLocationPage/steps/AddLocationNetworkStep.tsx index 831c971200..ac42de93dd 100644 --- a/web/src/pages/AddLocationPage/steps/AddLocationNetworkStep.tsx +++ b/web/src/pages/AddLocationPage/steps/AddLocationNetworkStep.tsx @@ -13,6 +13,8 @@ const formSchema = z.object({ keepalive_interval: z .number(m.form_error_required()) .max(65535, m.form_error_port_max()), + mtu: z.number(m.form_error_required()), + fwmark: z.number().nullable(), }); type FormFields = z.infer; @@ -22,6 +24,8 @@ export const AddLocationNetworkStep = () => { useShallow( (s): FormFields => ({ keepalive_interval: s.keepalive_interval, + mtu: s.mtu, + fwmark: s.fwmark, }), ), ); @@ -59,6 +63,20 @@ export const AddLocationNetworkStep = () => { /> )} + + {(field) => ( + + )} + + + {(field) => ( + + )} + { dns: location.dns, endpoint: location.endpoint, keepalive_interval: location.keepalive_interval, + mtu: location.mtu, + fwmark: location.fwmark, location_mfa_mode: location.location_mfa_mode, peer_disconnect_threshold: location.peer_disconnect_threshold, port: location.port, diff --git a/web/src/shared/api/types.ts b/web/src/shared/api/types.ts index 029e7f1385..bfeffbd83c 100644 --- a/web/src/shared/api/types.ts +++ b/web/src/shared/api/types.ts @@ -486,6 +486,8 @@ export interface NetworkLocation { allowed_groups: string[]; dns: string | null; keepalive_interval: number; + mtu: number; + fwmark: number | null; peer_disconnect_threshold: number; acl_enabled: boolean; acl_default_allow: boolean; From f791f9d5a69bad635419b16abb46388e0e69a25b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Ciarcin=CC=81ski?= Date: Wed, 14 Jan 2026 16:41:12 +0100 Subject: [PATCH 2/3] Handle Location updates --- crates/defguard_core/src/handlers/wireguard.rs | 4 +++- .../AddLocationPage/steps/AddLocationNetworkStep.tsx | 12 +++--------- .../pages/AddLocationPage/useAddLocationStore.tsx | 2 +- web/src/pages/EditLocationPage/EditLocationPage.tsx | 10 +++++++++- web/src/shared/api/types.ts | 2 +- 5 files changed, 17 insertions(+), 13 deletions(-) diff --git a/crates/defguard_core/src/handlers/wireguard.rs b/crates/defguard_core/src/handlers/wireguard.rs index a2e8db69d2..99071cf7c9 100644 --- a/crates/defguard_core/src/handlers/wireguard.rs +++ b/crates/defguard_core/src/handlers/wireguard.rs @@ -88,7 +88,7 @@ pub(crate) struct WireguardNetworkInfo { allowed_groups: Vec, } -#[derive(Deserialize, Serialize, ToSchema)] +#[derive(Deserialize, ToSchema)] pub struct WireguardNetworkData { pub name: String, pub address: String, // comma-separated list of addresses @@ -336,6 +336,8 @@ pub(crate) async fn modify_network( network.port = data.port; network.dns = data.dns; network.keepalive_interval = data.keepalive_interval; + network.mtu = data.mtu; + network.fwmark = data.fwmark; network.peer_disconnect_threshold = data.peer_disconnect_threshold; network.acl_enabled = data.acl_enabled; network.acl_default_allow = data.acl_default_allow; diff --git a/web/src/pages/AddLocationPage/steps/AddLocationNetworkStep.tsx b/web/src/pages/AddLocationPage/steps/AddLocationNetworkStep.tsx index ac42de93dd..9c480c6174 100644 --- a/web/src/pages/AddLocationPage/steps/AddLocationNetworkStep.tsx +++ b/web/src/pages/AddLocationPage/steps/AddLocationNetworkStep.tsx @@ -13,7 +13,7 @@ const formSchema = z.object({ keepalive_interval: z .number(m.form_error_required()) .max(65535, m.form_error_port_max()), - mtu: z.number(m.form_error_required()), + mtu: z.number().nullable(), fwmark: z.number().nullable(), }); @@ -65,17 +65,11 @@ export const AddLocationNetworkStep = () => { {(field) => ( - + )} - {(field) => ( - - )} + {(field) => } { )} + + {(field) => ( + + )} + + + {(field) => } + diff --git a/web/src/shared/api/types.ts b/web/src/shared/api/types.ts index bfeffbd83c..a4c1cb140f 100644 --- a/web/src/shared/api/types.ts +++ b/web/src/shared/api/types.ts @@ -486,7 +486,7 @@ export interface NetworkLocation { allowed_groups: string[]; dns: string | null; keepalive_interval: number; - mtu: number; + mtu: number | null; fwmark: number | null; peer_disconnect_threshold: number; acl_enabled: boolean; From d2e77fa2a766537195e9ec71237a011171c56fd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Ciarcin=CC=81ski?= Date: Wed, 14 Jan 2026 16:47:22 +0100 Subject: [PATCH 3/3] Undo cut --- crates/defguard_core/src/handlers/wireguard.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/defguard_core/src/handlers/wireguard.rs b/crates/defguard_core/src/handlers/wireguard.rs index 99071cf7c9..7e8df02863 100644 --- a/crates/defguard_core/src/handlers/wireguard.rs +++ b/crates/defguard_core/src/handlers/wireguard.rs @@ -88,7 +88,7 @@ pub(crate) struct WireguardNetworkInfo { allowed_groups: Vec, } -#[derive(Deserialize, ToSchema)] +#[derive(Deserialize, Serialize, ToSchema)] pub struct WireguardNetworkData { pub name: String, pub address: String, // comma-separated list of addresses