diff options
author | Darren Embry <dse@webonastick.com> | 2012-03-21 19:48:05 -0400 |
---|---|---|
committer | Darren Embry <dse@webonastick.com> | 2012-03-21 19:48:05 -0400 |
commit | 9a45617000737d00af9364ae0aba28601472b3f0 (patch) | |
tree | 1b16fae47f468a4225582304976ab571ee5f15d4 | |
parent | 2452cc37fb1b735d88b0791ec062c378a2d68f27 (diff) | |
download | pfsense-9a45617000737d00af9364ae0aba28601472b3f0.zip pfsense-9a45617000737d00af9364ae0aba28601472b3f0.tar.gz |
fix for: Spanning Tree interface priority options do not alter Bridge
http://redmine.pfsense.org/issues/2261
-rw-r--r-- | etc/inc/interfaces.inc | 5 | ||||
-rw-r--r-- | etc/inc/util.inc | 14 |
2 files changed, 17 insertions, 2 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index cb5ea22..b8a011b 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -45,6 +45,7 @@ /* include all configuration functions */ require_once("globals.inc"); require_once("cmd_chain.inc"); +require_once("util.inc"); function interfaces_bring_up($interface) { if(!$interface) { @@ -542,7 +543,7 @@ function interface_bridge_configure(&$bridge, $checkmember = 0) { $pconfig = explode(",", $bridge['ifpriority']); $ifpriority = array(); foreach ($pconfig as $cfg) { - $embcfg = explode(":", $cfg); + $embcfg = explode_assoc(":", $cfg); foreach ($embcfg as $key => $value) $ifpriority[$key] = $value; } @@ -555,7 +556,7 @@ function interface_bridge_configure(&$bridge, $checkmember = 0) { $pconfig = explode(",", $bridges['ifpathcost']); $ifpathcost = array(); foreach ($pconfig as $cfg) { - $embcfg = explode(":", $cfg); + $embcfg = explode_assoc(":", $cfg); foreach ($embcfg as $key => $value) $ifpathcost[$key] = $value; } diff --git a/etc/inc/util.inc b/etc/inc/util.inc index dcc6e44..17f5672 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -1645,4 +1645,18 @@ function array_merge_recursive_unique($array0, $array1) { return $result; } +/* + * converts a string like "a,b,c,d" + * into an array like array("a" => "b", "c" => "d") + */ +function explode_assoc($delimiter, $string) { + $array = explode($delimiter, $string); + $result = array(); + $numkeys = floor(count($array) / 2); + for ($i = 0; $i < $numkeys; $i += 1) { + $result[$array[$i * 2]] = $array[$i * 2 + 1]; + } + return $result; +} + ?> |