Add find_interface_ip which returns the first found ip on an interface

This commit is contained in:
Scott Ullrich 2005-02-18 22:25:35 +00:00
parent e17ce934fd
commit b04a6ca448

View File

@ -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
*/