Project

General

Profile

« Previous | Next » 

Revision 47ee6926

Added by Ermal LUÇI over 13 years ago

Implement is_jumbo_capable in a more performant way. This should help with large number of interfaces

View differences:

etc/inc/globals.inc
40 40
	return $string;
41 41
}
42 42

  
43
function get_nics_with_capabilities($CAPABILITIES) {
44
	$ifs = `/sbin/ifconfig -l`;
45
	$if_list = split(" ", $ifs);
46
	$vlan_native_supp = array();
47
	foreach($if_list as $if => $iface) {
48
		$iface = trim($iface);
49
		$capable = pfSense_get_interface_addresses($iface);
50
		if(isset($capable['caps'][$CAPABILITIES])) {
51
			$interfacenonum = remove_numbers($iface);
52
			if(!in_array($interfacenonum, $vlan_native_supp))
53
				$vlan_native_supp[] = $interfacenonum;
54
		}
55
	}
56
	return $vlan_native_supp;
57
}
58

  
59 43
$g = array(
60 44
	"base_packages" => "siproxd", 
61 45
	"event_address" => "unix:///var/run/check_reload_status",
......
112 96
	"help_base_url" => "/help.php"
113 97
);
114 98

  
115
// Loop through and set vlan_long_frame VLAN_MTU
116
$vlan_native_supp = get_nics_with_capabilities("vlanmtu");
117
$g['vlan_long_frame'] = array_merge(array("vge", "bfe",  "bge",  "dc",  "em",  "fxp",  "gem",  "hme",  "ixgb",  "le", "lem", "nge",  "re",  "rl",  "sis",  "sk",  "ste",  "ti",  "tl",  "tx",  "txp",  "vr", "xl", "lagg"), (array)$vlan_native_supp);
118

  
119 99
/* IP TOS flags */
120 100
$iptos = array("lowdelay", "throughput", "reliability");
121 101

  
etc/inc/interfaces.inc
4134 4134
 * RESULT
4135 4135
 *   boolean          - true or false
4136 4136
 ******/
4137
function is_jumbo_capable($int) {
4138
        global $g;
4137
function is_jumbo_capable($iface) {
4139 4138

  
4140
        $int_family = preg_split("/[0-9]+/", $int);
4141

  
4142
        if (in_array($int_family[0], $g['vlan_long_frame']))
4139
	$iface = trim($iface);
4140
	$capable = pfSense_get_interface_addresses($iface);
4141
	if (isset($capable['caps'][$CAPABILITIES]))
4143 4142
                return true;
4144
        else
4145
                return false;
4143

  
4144
	return false;
4146 4145
}
4147 4146

  
4148 4147
function setup_pppoe_reset_file($pppif, $iface="") {

Also available in: Unified diff