mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-19 19:15:22 +00:00
Routing, gateways. extend Gateways class with getInterface() to return technical interface and getInterfaceName() to return its name, for https://github.com/opnsense/core/issues/2279
This commit is contained in:
parent
73ee4446d5
commit
45297924e9
@ -329,4 +329,32 @@ class Gateways
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name gateway name
|
||||
* @return string|null gateway interface
|
||||
*/
|
||||
public function getInterface($name)
|
||||
{
|
||||
foreach ($this->getGateways() as $gateway) {
|
||||
if ($gateway['name'] == $name && !empty($gateway['if'])){
|
||||
return $gateway['if'];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name gateway name
|
||||
* @return string|null gateway interface
|
||||
*/
|
||||
public function getInterfaceName($name)
|
||||
{
|
||||
foreach ($this->getGateways() as $gateway) {
|
||||
if ($gateway['name'] == $name && !empty($gateway['interface'])){
|
||||
return $gateway['interface'];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user