summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2010-06-02 17:17:55 +0000
committerErmal <eri@pfsense.org>2010-06-02 17:17:55 +0000
commit3d0633917f7acf6f32d178bd68602282db18538d (patch)
tree9d680a8cbc550a7ab4bba4e96010b5d1fd7c1cb4 /etc
parentbf444c344e9a95a5d7e65ae13f40d20aa9958df1 (diff)
downloadpfsense-3d0633917f7acf6f32d178bd68602282db18538d.zip
pfsense-3d0633917f7acf6f32d178bd68602282db18538d.tar.gz
Use the module functions to set/remove/test interface capabilities.
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/pfsense-utils.inc61
1 files changed, 21 insertions, 40 deletions
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc
index 1015023..21bbe0c 100644
--- a/etc/inc/pfsense-utils.inc
+++ b/etc/inc/pfsense-utils.inc
@@ -188,13 +188,15 @@ function enable_hardware_offloading($interface) {
if($int <> "")
$interface = $int;
$int_family = preg_split("/[0-9]+/", $interface);
- $options = strtolower(`/sbin/ifconfig -m {$interface} | grep capabilities`);
+ $options = pfSense_get_interface_addresses($interface);
+ if (!is_array($options))
+ return;
$supported_ints = array('fxp');
if (in_array($int_family, $supported_ints)) {
if(isset($config['system']['do_not_use_nic_microcode']))
continue;
if(does_interface_exist($interface))
- mwexec("/sbin/ifconfig {$interface} link0");
+ pfSense_interface_flags($interface, IFF_LINK0);
}
/* skip vlans for checksumming and polling */
@@ -202,26 +204,24 @@ function enable_hardware_offloading($interface) {
return;
if($config['system']['disablechecksumoffloading']) {
- if(stristr($options, "txcsum") == true)
- mwexec("/sbin/ifconfig {$interface} -txcsum 2>/dev/null");
- if(stristr($options, "rxcsum") == true)
- mwexec("/sbin/ifconfig {$interface} -rxcsum 2>/dev/null");
+ if (isset($options['encaps']['txcsum']))
+ pfSense_interface_capabilities($interface, -IFCAP_TXCSUM);
+ if (isset($options['encaps']['rxcsum']))
+ pfSense_interface_capabilities($interface, -IFCAP_RXCSUM);
} else {
- if(stristr($options, "txcsum") == true)
- mwexec("/sbin/ifconfig {$interface} txcsum 2>/dev/null");
- if(stristr($options, "rxcsum") == true)
- mwexec("/sbin/ifconfig {$interface} rxcsum 2>/dev/null");
+ if (isset($options['caps']['txcsum']))
+ pfSense_interface_capabilities($interface, IFCAP_TXCSUM);
+ if (isset($options['caps']['rxcsum']))
+ pfSense_interface_capabilities($interface, IFCAP_RXCSUM);
}
/* if the NIC supports polling *AND* it is enabled in the GUI */
- if(interface_supports_polling($interface)) {
- $polling = isset($config['system']['polling']);
- if($polling) {
- mwexec("/sbin/ifconfig {$interface} polling 2>/dev/null");
- } else {
- mwexec("/sbin/ifconfig {$interface} -polling 2>/dev/null");
- }
- }
+ $polling = isset($config['system']['polling']);
+ if($polling && isset($options['caps']['polling']))
+ pfSense_interface_capabilities($interface, IFCAP_POLLING);
+ else
+ pfSense_interface_capabilities($interface, -IFCAP_POLLING);
+
return;
}
@@ -236,29 +236,10 @@ function enable_hardware_offloading($interface) {
*
******/
function interface_supports_polling($iface) {
- $pattern = '/([a-z].*)[0-9]/';
- preg_match($pattern, $iface, $iface2);
- $interface=$iface2[1];
- $supported_ints = array("bge",
- "dc",
- "em",
- "fwe",
- "fwip",
- "fxp",
- "ixgb",
- "nfe",
- "vge",
- "re",
- "rl",
- "sf",
- "sis",
- "ste",
- "stge",
- "vge",
- "vr",
- "xl");
- if(in_array($interface, $supported_ints))
+ $opts = pfSense_get_interface_addresses($iface);
+ if (is_array($opts) && isset($opts['caps']['polling']))
return true;
+
return false;
}
OpenPOWER on IntegriCloud