From b04a6ca448bd49fe2e2ba910aca6a3b159d5ac97 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Fri, 18 Feb 2005 22:25:35 +0000 Subject: [PATCH] Add find_interface_ip which returns the first found ip on an interface --- etc/inc/pfsense-utils.inc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index 61106abcd2..900006668b 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -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 */