mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-18 10:35:27 +00:00
interfaces: GIF/GRE configuration - format local addresses by using the new option introduced in 10c81a4eea
ref: https://github.com/opnsense/core/issues/7241 https://github.com/opnsense/core/issues/7242
This commit is contained in:
parent
10c81a4eea
commit
07a051fd7d
@ -56,7 +56,7 @@ class LinkAddressField extends BaseField
|
||||
if (!empty((string)$node->virtual) || empty((string)$node->enable)) {
|
||||
continue;
|
||||
}
|
||||
self::$known_addresses[] = $ifname;
|
||||
self::$known_addresses[$ifname] = $descr;
|
||||
self::$option_groups['interfaces']['items'][$ifname] = $descr;
|
||||
}
|
||||
if (isset($cfg->virtualip)) {
|
||||
@ -69,7 +69,7 @@ class LinkAddressField extends BaseField
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
self::$known_addresses[] = $key;
|
||||
self::$known_addresses[$key] = $descr;
|
||||
self::$option_groups[(string)$node->mode]['items'][$key] = $descr;
|
||||
}
|
||||
}
|
||||
@ -96,7 +96,7 @@ class LinkAddressField extends BaseField
|
||||
if ($this->internalValue != null) {
|
||||
$validators[] = new CallbackValidator(["callback" => function ($data) {
|
||||
$messages = [];
|
||||
if (in_array($data, self::$known_addresses)) {
|
||||
if (isset(self::$known_addresses[$data])) {
|
||||
return $messages;
|
||||
} elseif (!Util::isIpAddress($data)) {
|
||||
$messages[] = gettext('A valid network address is required.');
|
||||
@ -108,6 +108,17 @@ class LinkAddressField extends BaseField
|
||||
return $validators;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
if (isset(self::$known_addresses[$this->internalValue])) {
|
||||
return self::$known_addresses[$this->internalValue];
|
||||
}
|
||||
return $this->internalValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* return either ipaddr or if field, only one should be used, addresses are preferred.
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user