Skip to content

Commit 28d5a60

Browse files
committed
Work on service not starting #131
1 parent 2991275 commit 28d5a60

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

net/pfSense-pkg-WireGuard/files/usr/local/pkg/wireguard/wg_api.inc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -910,13 +910,17 @@ function wg_is_valid_tunnel($tunnel_name, $running_state = false) {
910910

911911
}
912912

913-
// Checks if the service is enabled
913+
// Checks if the service is or should be enabled
914914
function wg_is_service_enabled() {
915915
global $wgg;
916916

917917
$enable = $wgg['config']['enable'];
918918

919-
return (isset($enable) && (($enable === 'on') || $enable === 'yes'));
919+
$is_enabled = (isset($enable) && (($enable === 'on') || $enable === 'yes'));
920+
921+
$should_be_enabled = wg_is_wg_assigned();
922+
923+
return ($is_enabled || $should_be_enabled);
920924

921925
}
922926

net/pfSense-pkg-WireGuard/files/usr/local/www/wg/vpn_wg_settings.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,6 @@
106106

107107
// Defaults for new installations
108108

109-
$pconfig['enable'] = isset($wgg['config']['enable']) ? $wgg['config']['enable'] : 'off';
110-
111109
$pconfig['keep_conf'] = isset($wgg['config']['keep_conf']) ? $wgg['config']['keep_conf'] : 'yes';
112110

113111
$pconfig['resolve_interval'] = isset($wgg['config']['resolve_interval']) ? $wgg['config']['default_resolve_interval'] : $wgg['resolve_interval'];
@@ -161,7 +159,7 @@
161159
'enable',
162160
'Enable',
163161
gettext('Enable WireGuard'),
164-
$pconfig['enable'] == 'on'
162+
wg_is_service_enabled()
165163
);
166164

167165
$wg_enable->setHelp("<span class=\"text-danger\">Note: </span>
@@ -176,7 +174,7 @@
176174
'enable',
177175
'',
178176
'hidden',
179-
'yes'
177+
(wg_is_service_enabled() ? 'yes' : 'no')
180178
));
181179

182180
}

0 commit comments

Comments
 (0)