interfaces: call plugins_interfaces() optionally on service reconfigure when invokeInterfaceRegistration() returns true. closes https://github.com/opnsense/core/issues/5768

This commit is contained in:
Ad Schellevis 2022-12-20 20:41:02 +01:00
parent c760383ca4
commit 7c16c3b74f
2 changed files with 18 additions and 1 deletions

View File

@ -158,6 +158,14 @@ abstract class ApiMutableServiceControllerBase extends ApiControllerBase
return 1;
}
/**
* invoke interface registration check, return true to invoke configd action
*/
protected function invokeInterfaceRegistration()
{
return false;
}
/**
* reconfigure with optional stop, generate config and start / reload
* @return array response message
@ -178,7 +186,9 @@ abstract class ApiMutableServiceControllerBase extends ApiControllerBase
) {
$backend->configdRun(escapeshellarg(static::$internalServiceName) . ' stop');
}
if ($this->invokeInterfaceRegistration()) {
$backend->configdRun('interface invoke registration');
}
$backend->configdRun('template reload ' . escapeshellarg(static::$internalServiceTemplate));
if ((string)$model->getNodeByReference(static::$internalServiceEnabled) == '1') {

View File

@ -47,6 +47,13 @@ parameters:
type:script
message:update carp service status
[invoke.registration]
command: /usr/local/sbin/pluginctl -i
parameters:
type:script
message: invoke dynamic interface registration
[list.arp]
command:/usr/local/opnsense/scripts/interfaces/list_arp.py
parameters:%s %s