Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions crates/defguard_core/src/handlers/wireguard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/AddLocationPage/AddLocationPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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.',
},
Expand Down
12 changes: 12 additions & 0 deletions web/src/pages/AddLocationPage/steps/AddLocationNetworkStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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().nullable(),
fwmark: z.number().nullable(),
});

type FormFields = z.infer<typeof formSchema>;
Expand All @@ -22,6 +24,8 @@ export const AddLocationNetworkStep = () => {
useShallow(
(s): FormFields => ({
keepalive_interval: s.keepalive_interval,
mtu: s.mtu,
fwmark: s.fwmark,
}),
),
);
Expand Down Expand Up @@ -59,6 +63,14 @@ export const AddLocationNetworkStep = () => {
/>
)}
</form.AppField>
<form.AppField name="mtu">
{(field) => (
<field.FormInput label="Maximum Transmission Unit (MTU)" type="number" />
)}
</form.AppField>
<form.AppField name="fwmark">
{(field) => <field.FormInput label="Firewall Mark (FwMark)" type="number" />}
</form.AppField>
<ModalControls
submitProps={{
text: m.controls_continue(),
Expand Down
2 changes: 2 additions & 0 deletions web/src/pages/AddLocationPage/useAddLocationStore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ const defaults: StoreValues = {
name: '',
port: 50051,
keepalive_interval: 25,
mtu: null,
fwmark: null,
peer_disconnect_threshold: 300,
acl_default_allow: true,
acl_enabled: false,
Expand Down
12 changes: 12 additions & 0 deletions web/src/pages/EditLocationPage/EditLocationPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ const formSchema = z.object({
keepalive_interval: z
.number(m.form_error_required())
.max(65535, m.form_error_port_max()),
mtu: z.number().nullable(),
fwmark: z.number().nullable(),
allowed_groups: z.array(
z.string(m.form_error_required()).trim().min(1, m.form_error_required()),
),
Expand Down Expand Up @@ -140,6 +142,8 @@ const EditLocationForm = ({ location }: { location: NetworkLocation }) => {
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,
Expand Down Expand Up @@ -217,6 +221,14 @@ const EditLocationForm = ({ location }: { location: NetworkLocation }) => {
<field.FormInput required label="Keep alive interval (seconds)" />
)}
</form.AppField>
<form.AppField name="mtu">
{(field) => (
<field.FormInput label="Maximum Transmission Unit (MTU)" type="number" />
)}
</form.AppField>
<form.AppField name="fwmark">
{(field) => <field.FormInput label="Firewall Mark (FwMark)" type="number" />}
</form.AppField>
</EditPageFormSection>
<form.Subscribe
selector={(s) =>
Expand Down
2 changes: 2 additions & 0 deletions web/src/shared/api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,8 @@ export interface NetworkLocation {
allowed_groups: string[];
dns: string | null;
keepalive_interval: number;
mtu: number | null;
fwmark: number | null;
peer_disconnect_threshold: number;
acl_enabled: boolean;
acl_default_allow: boolean;
Expand Down
Loading