mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-17 18:14:42 +00:00
System: Gateways: Configuration - prevent removal when gateway is bound to an interface, closes https://github.com/opnsense/core/issues/7270
This commit is contained in:
parent
042486e704
commit
dd394645ac
@ -194,6 +194,16 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
if ($uuid != null) {
|
||||
$gateway = $this->getModel()->getNodeByReference('gateway_item.' . $uuid);
|
||||
$cfg = Config::getInstance()->object();
|
||||
foreach ($cfg->interfaces->children() as $tag => $interface) {
|
||||
if ((string)$interface->gateway == (string)$gateway->name) {
|
||||
throw new UserException(sprintf(
|
||||
gettext("Gateway %s cannot be deleted because it is in use on Interface '%s'"),
|
||||
$gateway->name,
|
||||
$interface->descr ?? $tag
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
$groups = [];
|
||||
foreach ($cfg->gateways->children() as $tag => $gw_group) {
|
||||
if ($tag == 'gateway_group' && !empty($gw_group)) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user