Project

General

Profile

« Previous | Next » 

Revision 3f9a98c1

Added by Scott Ullrich almost 16 years ago

Automatically build vlan_native_supp and vlan_long_frame (native tagging and long frames) by inspecting ifconfig -m accordingly

View differences:

etc/inc/globals.inc
31 31
    POSSIBILITY OF SUCH DAMAGE.
32 32
*/
33 33

  
34
function remove_numbers($string) {
35
	$nums = array("1", "2", "3", "4", "5", "6", "7", "8", "9", "0", " ");
36
	$string = str_replace($nums, '', $string);
37
	return $string;
38
}
39

  
40
function get_nics_with_capabilities($CAPABILITIES) {
41
	$if_list = get_interface_list();
42
	$vlan_native_supp = array();
43
	foreach($if_list as $if => $iface) {
44
		$capable = `ifconfig -m | grep -a1 $if | grep $CAPABILITIES`;
45
		if($capable) {
46
			$interfacenonum = remove_numbers($if);
47
			if(!in_array($interfacenonum, $vlan_native_supp))
48
				$vlan_native_supp[] = $interfacenonum;
49
		}
50
	}
51
	return $vlan_native_supp;
52
}
53

  
34 54
$g = array(
35 55
	"base_packages" => "AutoConfigBackup, siproxd", 
36 56
	"factory_shipped_username" => "admin",
......
76 96
	"embeddedbootupslice" => "/dev/ad0a",
77 97
	"services_dhcp_server_enable" => true,
78 98
	"firmware_update_text" => "(pfSense-*.tgz)",
79
	"wireless_regex" => "/^(ndis|wi|ath|an|ral|ural|wai|iwi|awi|wlan|rum)/",
80
	"vlan_native_supp" => array("bce", "bge", "bfe", "cxgb", "dc", "em", "fxp", "gem", "hme", "ixgb", "msk", "nge", "re", "rl", "sis", "ste", "stge", "ti", "tl", "tx", "txp", "vge", "vr", "xl", "lagg"),
81
	"vlan_long_frame" => array("vge", "bfe",  "bge",  "dc",  "em",  "fxp",  "gem",  "hme",  "ixgb",  "le",  "nge",  "re",  "rl",  "sis",  "sk",  "ste",  "ti",  "tl",  "tx",  "txp",  "vr", "xl", "lagg")
99
	"wireless_regex" => "/^(ndis|wi|ath|an|ral|ural|wai|iwi|awi|wlan|rum)/"
82 100
);
83 101

  
102
// Loop through and set vlan_native_supp (native vlan tagging)
103
$vlan_native_supp = get_nics_with_capabilities("HWTAGGING");
104
if(count($vlan_native_supp) > 0)
105
	$g['vlan_native_supp'] = $vlan_native_supp;
106
else 
107
	$g['vlan_native_supp'] = array("bce", "bge", "bfe", "cxgb", "dc", "em", "fxp", "gem", "hme", "ixgb", "msk", "nge", "re", "rl", "sis", "ste", "stge", "ti", "tl", "tx", "txp", "vge", "vr", "xl", "lagg");
108

  
109
// Loop through and set vlan_long_frame VLAN_MTU
110
$vlan_native_supp = get_nics_with_capabilities("VLAN_MTU");
111
if(count($vlan_native_supp) > 0)
112
	$g['vlan_long_frame'] = $vlan_native_supp;
113
else 
114
	$g['vlan_long_frame'] = array("vge", "bfe",  "bge",  "dc",  "em",  "fxp",  "gem",  "hme",  "ixgb",  "le",  "nge",  "re",  "rl",  "sis",  "sk",  "ste",  "ti",  "tl",  "tx",  "txp",  "vr", "xl", "lagg");
115

  
84 116
/* IP TOS flags */
85 117
$iptos = array("lowdelay", "throughput", "reliability");
86 118

  

Also available in: Unified diff