mirror of
https://github.com/netbirdio/plugins.git
synced 2026-05-22 18:44:07 -07:00
net/wireguard - import https://github.com/opnsense/core/commit/c2d07aeef6965a22d4119f815b7afc6bb9d1db09 and https://github.com/opnsense/core/commit/4bef809bd031f0aa3d55963e57a82d988fd2d45a from core
This commit is contained in:
+1
-9
@@ -46,15 +46,6 @@ class ServiceController extends ApiMutableServiceControllerBase
|
||||
protected static $internalServiceEnabled = 'enabled';
|
||||
protected static $internalServiceName = 'wireguard';
|
||||
|
||||
/**
|
||||
* hook group interface registration on reconfigure
|
||||
* @return bool
|
||||
*/
|
||||
protected function invokeInterfaceRegistration()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
@@ -66,6 +57,7 @@ class ServiceController extends ApiMutableServiceControllerBase
|
||||
|
||||
$this->sessionClose();
|
||||
$backend = new Backend();
|
||||
$backend->configdRun('interface invoke registration');
|
||||
$backend->configdRun('template reload ' . escapeshellarg(static::$internalServiceTemplate));
|
||||
$backend->configdpRun('wireguard configure');
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
require_once('script/load_phalcon.php');
|
||||
require_once('util.inc');
|
||||
require_once('config.inc');
|
||||
require_once('interfaces.inc');
|
||||
|
||||
/**
|
||||
@@ -121,6 +122,7 @@ function wg_start($server, $fhandle, $ifcfgflag = 'up')
|
||||
ftruncate($fhandle, 0);
|
||||
fwrite($fhandle, @md5_file($server->cnfFilename) . "|" . wg_reconfigure_hash($server));
|
||||
syslog(LOG_NOTICE, "Wireguard interface {$server->name} ({$server->interface}) started");
|
||||
interfaces_restart_by_device(false, [(string)$server->interface], false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -263,6 +265,5 @@ if (isset($opts['h']) || empty($args) || !in_array($args[0], ['start', 'stop', '
|
||||
}
|
||||
}
|
||||
}
|
||||
mwexecf('/usr/local/etc/rc.routing_configure');
|
||||
}
|
||||
closelog();
|
||||
|
||||
Reference in New Issue
Block a user