mirror of
https://github.com/netbirdio/plugins.git
synced 2026-05-22 18:44:07 -07:00
net/wireguard: deal with kmod service status; closes #3273
Shift the name from wireguard-go to wireguard in this case. HA between go and kmod is probably not going to work fully as the service name shifts, but eventually go should be gone. Since wireguard rc.d script misuses "status" we don't know what the status is and since the kmod has no "process" either we have nothing to go on so the stop and start actions cannot be cleanly represented and are instead replaced by a single restart. If you want to stop wireguard from the GUI it needs to be disabled in its settings.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
PLUGIN_NAME= wireguard
|
||||
PLUGIN_VERSION= 1.13
|
||||
PLUGIN_REVISION= 3
|
||||
PLUGIN_REVISION= 4
|
||||
PLUGIN_COMMENT= WireGuard VPN service
|
||||
PLUGIN_DEPENDS= wireguard-tools
|
||||
PLUGIN_MAINTAINER= m.muenz@gmail.com
|
||||
|
||||
@@ -34,49 +34,66 @@ function wireguard_enabled()
|
||||
|
||||
function wireguard_services()
|
||||
{
|
||||
$services = array();
|
||||
$services = [];
|
||||
|
||||
if (!wireguard_enabled()) {
|
||||
return $services;
|
||||
}
|
||||
|
||||
$services[] = array(
|
||||
$service = [
|
||||
'description' => gettext('WireGuard VPN'),
|
||||
'configd' => array(
|
||||
'restart' => array('wireguard restart'),
|
||||
'start' => array('wireguard start'),
|
||||
'stop' => array('wireguard stop'),
|
||||
),
|
||||
'name' => 'wireguard-go'
|
||||
);
|
||||
'configd' => [
|
||||
'restart' => ['wireguard restart'],
|
||||
'start' => ['wireguard start'],
|
||||
'stop' => ['wireguard stop'],
|
||||
],
|
||||
'name' => 'wireguard-go',
|
||||
];
|
||||
|
||||
if (file_exists('/boot/modules/if_wg.ko') || file_exists('/boot/kernel/if_wg.ko')) {
|
||||
$service['name'] = 'wireguard';
|
||||
$service['nocheck'] = true;
|
||||
}
|
||||
|
||||
$services[] = $service;
|
||||
|
||||
return $services;
|
||||
}
|
||||
|
||||
function wireguard_interfaces()
|
||||
{
|
||||
$interfaces = array();
|
||||
$interfaces = [];
|
||||
|
||||
if (!wireguard_enabled()) {
|
||||
return $interfaces;
|
||||
}
|
||||
$oic = array('enable' => true);
|
||||
$oic['if'] = 'wireguard';
|
||||
$oic['descr'] = gettext('WireGuard (Group)');
|
||||
$oic['type'] = 'group';
|
||||
$oic['virtual'] = true;
|
||||
$oic['networks'] = array();
|
||||
$interfaces['wireguard'] = $oic;
|
||||
|
||||
$interfaces['wireguard'] = [
|
||||
'descr' => gettext('WireGuard (Group)'),
|
||||
'if' => 'wireguard',
|
||||
'virtual' => true,
|
||||
'enable' => true,
|
||||
'type' => 'group',
|
||||
'networks' => [],
|
||||
];
|
||||
|
||||
return $interfaces;
|
||||
}
|
||||
|
||||
function wireguard_xmlrpc_sync()
|
||||
{
|
||||
$result = array();
|
||||
$result = [];
|
||||
|
||||
$result['id'] = 'wireguard';
|
||||
$result['section'] = 'OPNsense.wireguard';
|
||||
$result['description'] = gettext('WireGuard');
|
||||
$result['services'] = ['wireguard-go'];
|
||||
return array($result);
|
||||
|
||||
if (file_exists('/boot/modules/if_wg.ko') || file_exists('/boot/kernel/if_wg.ko')) {
|
||||
$result['services'] = ['wireguard'];
|
||||
}
|
||||
|
||||
return [$result];
|
||||
}
|
||||
|
||||
function wireguard_devices()
|
||||
|
||||
Reference in New Issue
Block a user