mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-15 09:04:39 +00:00
Proxy/MVC: add "S" option for AllowDynamic in InterfaceField type to select only static dynamic ip's, so we can select lo0 in proxy.
Although it's not perfect, this seems like the least destructive option at the moment. Eventually we might need to refactor some of the proxy/interface selection, since it doesn't support ipv6 either.
This commit is contained in:
parent
c3d2dcfa21
commit
bf30d129ce
@ -60,7 +60,7 @@ class InterfaceField extends BaseListField
|
||||
/**
|
||||
* @var bool allow dynamic interfaces
|
||||
*/
|
||||
private $internalAllowDynamic = false;
|
||||
private $internalAllowDynamic = 0;
|
||||
|
||||
/**
|
||||
* collect parents for lagg interfaces
|
||||
@ -120,6 +120,10 @@ class InterfaceField extends BaseListField
|
||||
foreach ($configObj->interfaces->children() as $key => $value) {
|
||||
if (!$this->internalAllowDynamic && !empty($value->internal_dynamic)) {
|
||||
continue;
|
||||
} elseif ($this->internalAllowDynamic == 2 && !empty($value->internal_dynamic)) {
|
||||
if (empty($value->ipaddr) && empty($value->ipaddrv6)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
$allInterfaces[$key] = $value;
|
||||
if (!empty($value->if)) {
|
||||
@ -185,7 +189,7 @@ class InterfaceField extends BaseListField
|
||||
private function updateInternalCacheKey()
|
||||
{
|
||||
$tmp = serialize($this->internalFilters);
|
||||
$tmp .= $this->internalAllowDynamic ? "Y" : "N";
|
||||
$tmp .= (string)$this->internalAllowDynamic;
|
||||
$tmp .= $this->internalAddParentDevices ? "Y" : "N";
|
||||
$this->internalCacheKey = md5($tmp);
|
||||
}
|
||||
@ -218,14 +222,16 @@ class InterfaceField extends BaseListField
|
||||
|
||||
/**
|
||||
* select if dynamic (hotplug) interfaces maybe selectable
|
||||
* @param $value boolean value 0/1
|
||||
* @param $value Y/N/S (Yes, No, Static)
|
||||
*/
|
||||
public function setAllowDynamic($value)
|
||||
{
|
||||
if (trim(strtoupper($value)) == "Y") {
|
||||
$this->internalAllowDynamic = true;
|
||||
} else {
|
||||
$this->internalAllowDynamic = false;
|
||||
$this->internalAllowDynamic = 1;
|
||||
} elseif (trim(strtoupper($value)) == "S") {
|
||||
$this->internalAllowDynamic = 2;
|
||||
}else {
|
||||
$this->internalAllowDynamic = 0;
|
||||
}
|
||||
$this->updateInternalCacheKey();
|
||||
}
|
||||
|
||||
@ -239,6 +239,7 @@
|
||||
<interfaces type="InterfaceField">
|
||||
<Required>N</Required>
|
||||
<multiple>Y</multiple>
|
||||
<AllowDynamic>S</AllowDynamic>
|
||||
<default>lan</default>
|
||||
<filters>
|
||||
<enable>/^(?!0).*$/</enable>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user