From 81f82bf7c6382ec1daa05f08928afb4b6c47a6b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ermal=20Lu=C3=A7i?= Date: Tue, 2 Sep 2008 15:47:23 +0000 Subject: Fix problem reported on http://forum.pfsense.org/index.php/topic,10984.0.html. Actually this is a dumb php susbstr() function behaviour since the code logic was fine. Either way this fixes the problem of not allowing more the 12 total interfaces present. --- usr/local/www/interfaces_assign.php | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'usr') diff --git a/usr/local/www/interfaces_assign.php b/usr/local/www/interfaces_assign.php index df9c70f..12bd653 100755 --- a/usr/local/www/interfaces_assign.php +++ b/usr/local/www/interfaces_assign.php @@ -241,16 +241,15 @@ if ($_GET['act'] == "add") { $config['interfaces'][$newifname] = array(); $config['interfaces'][$newifname]['descr'] = $descr; } else { - $i = 1; - foreach ($config['interfaces'] as $ifname => $if) { - if ($ifname == "wan" || $ifname == "lan") - continue; - if (substr($ifname, 3) == $i) { - $i++; - continue; - } - break; - } + /* + * Since we account above for LAN and we start counting + * optional(opt#) interfaces from 1 the formula below + * gives the next, to be added, opt# interface. + * + * XXX: The best of all i getting rid of lan and wan + * from interface keys and just keeping their descriptions. + */ + $i = count($config['interfaces']) - 1; $newifname = 'opt' . $i; $descr = "OPT{$i}"; $config['interfaces'][$newifname] = array(); -- cgit v1.1