mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Add find_interface_ip which returns the first found ip on an interface
This commit is contained in:
parent
e17ce934fd
commit
b04a6ca448
@ -115,6 +115,14 @@ function convert_ip_to_network_format($ip, $subnet) {
|
||||
return $string;
|
||||
}
|
||||
|
||||
/*
|
||||
* find_interface_ip($interface): return the interface ip (first found)
|
||||
*/
|
||||
function find_interface_ip($interface) {
|
||||
$ip = system("/sbin/ifconfig {$interface} | grep \"inet \" | cut -d\" \" -f 2");
|
||||
return $ip;
|
||||
}
|
||||
|
||||
/*
|
||||
* find_ip_interface($ip): return the interface where an ip is defined
|
||||
*/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user