if ($type === "MASTER") { log_error("Enabling WAN due to CARP event '$type'"); # Checking `isset` avoids a race condition during startup when the # WireGuard config stanza seems like it's not yet loaded. Without it, this # can create an extra, empty, invalid stanza that breaks WireGuard.# is the isset necessary? if (isset($config['OPNsense']['igc2']['general']['enabled'])) { $config['OPNsense']['igc2']['general']['enabled'] = '1'; }# configd_run('wireguard start'); # WAN is not a service, or is it? write_config("Enable WAN due to CARP event '$type'", false);} else { log_error("Disabling WAN due to CARP event '$type'");# configd_run('wireguard stop'); if (isset($config['OPNsense']['igc2']['general']['enabled'])) { $config['OPNsense']['igc2']['general']['enabled'] = '0'; } write_config("Disable WAN due to CARP event '$type'", false);}