From 9ecb26b99fb71b625ce6122050491cf93c9d305b Mon Sep 17 00:00:00 2001 From: Christian McDonald Date: Mon, 6 Dec 2021 09:48:25 -0500 Subject: [PATCH] Still working on gateway up/down on service start/stop --- .../files/usr/local/pkg/wireguard/includes/wg_api.inc | 10 ++++------ .../usr/local/pkg/wireguard/includes/wg_install.inc | 9 +-------- .../usr/local/pkg/wireguard/includes/wg_service.inc | 3 +++ 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/net/pfSense-pkg-WireGuard/files/usr/local/pkg/wireguard/includes/wg_api.inc b/net/pfSense-pkg-WireGuard/files/usr/local/pkg/wireguard/includes/wg_api.inc index e94be518..43ad0efe 100644 --- a/net/pfSense-pkg-WireGuard/files/usr/local/pkg/wireguard/includes/wg_api.inc +++ b/net/pfSense-pkg-WireGuard/files/usr/local/pkg/wireguard/includes/wg_api.inc @@ -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 @@ -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(); + } } /* diff --git a/net/pfSense-pkg-WireGuard/files/usr/local/pkg/wireguard/includes/wg_install.inc b/net/pfSense-pkg-WireGuard/files/usr/local/pkg/wireguard/includes/wg_install.inc index 8e679a37..057f7f74 100644 --- a/net/pfSense-pkg-WireGuard/files/usr/local/pkg/wireguard/includes/wg_install.inc +++ b/net/pfSense-pkg-WireGuard/files/usr/local/pkg/wireguard/includes/wg_install.inc @@ -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 @@ -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() { diff --git a/net/pfSense-pkg-WireGuard/files/usr/local/pkg/wireguard/includes/wg_service.inc b/net/pfSense-pkg-WireGuard/files/usr/local/pkg/wireguard/includes/wg_service.inc index be047cc3..2e984101 100644 --- a/net/pfSense-pkg-WireGuard/files/usr/local/pkg/wireguard/includes/wg_service.inc +++ b/net/pfSense-pkg-WireGuard/files/usr/local/pkg/wireguard/includes/wg_service.inc @@ -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; }