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:
Ad Schellevis 2019-04-12 15:35:06 +02:00
parent 73ee4446d5
commit 45297924e9

View File

@ -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;
}
}