summaryrefslogtreecommitdiffstats
path: root/etc/inc/pfsense-utils.inc
diff options
context:
space:
mode:
Diffstat (limited to 'etc/inc/pfsense-utils.inc')
-rw-r--r--etc/inc/pfsense-utils.inc167
1 files changed, 1 insertions, 166 deletions
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc
index ea0b2b8..c814dac 100644
--- a/etc/inc/pfsense-utils.inc
+++ b/etc/inc/pfsense-utils.inc
@@ -1148,38 +1148,6 @@ function is_carp_defined() {
return true;
}
-/****f* pfsense-utils/get_interface_mtu
- * NAME
- * get_interface_mtu - Return the mtu of an interface
- * RESULT
- * $tmp - Returns the mtu of an interface
- ******/
-function get_interface_mtu($interface) {
- $mtu = `/sbin/ifconfig {$interface} | /usr/bin/grep mtu | /usr/bin/cut -d" " -f6`;
- return $mtu;
-}
-
-/****f* pfsense-utils/is_interface_wireless
- * NAME
- * is_interface_wireless - Returns if an interface is wireless
- * RESULT
- * $tmp - Returns if an interface is wireless
- ******/
-function is_interface_wireless($interface) {
- global $config, $g;
- $friendly = convert_real_interface_to_friendly_interface_name($interface);
- if(!is_array($config['interfaces'][$friendly]['wireless'])) {
- if (preg_match($g['wireless_regex'], $interface)) {
- $config['interfaces'][$friendly]['wireless'] = array();
- return true;
- }
- unset($config['interfaces'][$friendly]['wireless']);
- return false;
- } else {
- return true;
- }
-}
-
/****f* pfsense-utils/find_number_of_created_carp_interfaces
* NAME
* find_number_of_created_carp_interfaces - Return the number of CARP interfaces.
@@ -1299,70 +1267,9 @@ function exec_command($command) {
return(implode("\n", $output));
}
-/****f* interfaces/is_jumbo_capable
- * NAME
- * is_jumbo_capable - Test if interface is jumbo frame capable. Useful for determining VLAN capability.
- * INPUTS
- * $int - string containing interface name
- * RESULT
- * boolean - true or false
- ******/
-function is_jumbo_capable($int) {
- /* Per:
- * http://www.freebsd.org/cgi/man.cgi?query=vlan&manpath=FreeBSD+6.0-RELEASE&format=html
- * Only the following drivers support large frames
- *
- * 'de' chipset purposely left out of this list
- * requires defining BIG_PACKET in the
- * /usr/src/sys/pci/if_de.c source file and rebuilding the
- * kernel or module. The hack works only for the 21041,
- * 21140, and 21140A chips.
- */
- global $g;
-
- $capable = $g['vlan_long_frame'];
-
- $int_family = preg_split("/[0-9]+/", $int);
-
- if (in_array($int_family[0], $capable))
- return true;
- else
- return false;
-}
-
-/*
- * Return the interface array
- */
-function get_interface_arr($flush = false) {
- global $interface_arr_cache;
-
- /* If the cache doesn't exist, build it */
- if (!isset($interface_arr_cache) or $flush)
- $interface_arr_cache = exec_command("/sbin/ifconfig -l");
-
- return $interface_arr_cache;
-}
-
-/*
- * does_interface_exist($interface): return true or false if a interface is
- * detected.
- */
-function does_interface_exist($interface) {
- global $config;
-
- if(!$interface)
- return false;
-
- $ints = get_interface_arr();
-
- if(stristr($ints, $interface) !== false)
- return true;
- else
- return false;
-}
-
/*
* convert_ip_to_network_format($ip, $subnet): converts an ip address to network form
+
*/
function convert_ip_to_network_format($ip, $subnet) {
$ipsplit = split('[.]', $ip);
@@ -2537,42 +2444,6 @@ function update_filter_reload_status($text) {
fclose($fd);
}
-function get_interface_gateway($interface) {
- global $config, $g;
-
- $iflist = get_configured_interface_with_descr();
- /*
- * XXX: This is silly at first, but we may be called with the interface
- * descr for no apparent reason!!!
- */
- foreach ($iflist as $ifent => $ifdesc) {
- if ($ifent == $interface || $ifdesc == $interface) {
- $interface = $ifent;
- break;
- }
- }
-
- $gw = NULL;
-
- $gwcfg = $config['interfaces'][$interface];
- if (is_ipaddr($gwcfg['gateway']))
- $gw = $gwcfg['gateway'];
- else if (!empty($gwcfg['gateway']))
- $gw = lookup_gateway_ip_by_name($gwcfg['gateway']);
-
- // for dynamic interfaces we handle them through the $interface_router file.
- if (!is_ipaddr($gw)) {
- $realif = get_real_interface($interface);
- if (file_exists("{$g['tmp_path']}/{$realif}_router")) {
- $gw = file_get_contents("{$g['tmp_path']}/{$realif}_router");
- $gw = rtrim($gw);
- }
- }
-
- /* return gateway */
- return $gw;
-}
-
/* DHCP enabled on any interfaces? */
function is_dhcp_server_enabled()
{
@@ -2595,42 +2466,6 @@ function is_dhcp_server_enabled()
return $dhcpdenable;
}
-/* return outside interfaces with a gateway */
-function get_interfaces_with_gateway() {
- global $config;
-
- $ints = array();
- $ifdescrs = get_configured_interface_list(false, true);
-
- /* loop interfaces, check config for outbound */
- foreach ($ifdescrs as $ifdescr => $ifname) {
- switch ($config['interfaces'][$ifname]['ipaddr']) {
- case "dhcp":
- case "carpdev-dhcp":
- case "pppoe":
- case "pptp":
- $ints[] = $ifname;
- break;
- default:
- if ($config['interfaces'][$ifname]['pointtopoint'])
- $ints[] = $ifname;
- else if (!empty($config['interfaces'][$ifname]['gateway']))
- $ints[] = $ifname;
- break;
- }
- }
- return $ints;
-}
-
-/* return true if interface has a gateway */
-function interface_has_gateway($friendly) {
- $friendly = strtolower($friendly);
- if (in_array($friendly, get_interfaces_with_gateway()))
- return true;
-
- return false;
-}
-
/****f* pfsense-utils/isAjax
* NAME
* isAjax - reports if the request is driven from prototype
OpenPOWER on IntegriCloud