Skip to content

Commit

Permalink
Still working on gateway up/down on service start/stop
Browse files Browse the repository at this point in the history
  • Loading branch information
rcmcdonald91 committed Dec 6, 2021
1 parent f46acda commit 9ecb26b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ function wg_ifconfig_if_destroy($if_name, &$cmds = null) {
return ($ret_code == 0);
}

function wg_gateways_set_enable($enable = true) {
function wg_gateways_set_enable($enable = true, $filter_configure = true) {
$gws = return_gateways_array(true);

// Assume nothing will be done
Expand All @@ -455,11 +455,9 @@ function wg_gateways_set_enable($enable = true) {

wg_write_config("{$action} all WireGuard gateways.", false);

// and now restart dpinger
setup_gateways_monitor();

// Now we need to reconfigure the packet filter rules
filter_configure();
if ($filter_configure) {
filter_configure();
}
}

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ function wg_install() {

$g['wireguard_installing'] = true;

update_status("\n Upgrading any existing WireGuard XML configuration...");

update_status("done.\n Installing WireGuard early shell commands...");

// Installs the WireGuard earlyshellcmds
Expand Down Expand Up @@ -117,12 +115,7 @@ function wg_deinstall() {
// Stop and remove the WireGuard service
wg_service_deinstall(true);

update_status("done.\n Disabling any WireGuard gateways...");

// Disables any WireGuard gateways as these interfaces are now gone
wg_gateways_set_enable(false);

update_status("done.\n");
update_status("done.\n");
}

function wg_delete_temp_files() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ function wg_service_cli_stop($serialize = true) {
// Disable any WireGuard gateways configured on the system.
wg_gateways_set_enable(false);

// Now we restart any additional services
$ret_code |= wg_restart_extra_services();

return $ret_code;
}

Expand Down

0 comments on commit 9ecb26b

Please sign in to comment.