diff options
author | gnhb <gnoahb@gmail.com> | 2010-06-03 23:01:34 +0700 |
---|---|---|
committer | gnhb <gnoahb@gmail.com> | 2010-06-03 23:01:34 +0700 |
commit | 4749cccb32c4709c032ce5631ea11cbd157c6548 (patch) | |
tree | b5946c7a168e09d494ed29e5237608a07e1a6f8f /etc/inc/pfsense-utils.inc | |
parent | 1a5f6ddf191db009ae5f798f9e63108216ed3330 (diff) | |
parent | b72eb6c8cc0aa927ee79d4c389429eef1a648433 (diff) | |
download | pfsense-4749cccb32c4709c032ce5631ea11cbd157c6548.zip pfsense-4749cccb32c4709c032ce5631ea11cbd157c6548.tar.gz |
Merge branch 'master' of http://gitweb.pfsense.org/pfsense/mainline into mlppp
Diffstat (limited to 'etc/inc/pfsense-utils.inc')
-rw-r--r-- | etc/inc/pfsense-utils.inc | 61 |
1 files changed, 21 insertions, 40 deletions
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index 15d5282..97aa3e6 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; } |