From a8ca98e9e68cea61590b4333568609c3ad2fd9fe Mon Sep 17 00:00:00 2001 From: stompro Date: Tue, 8 Sep 2009 10:17:32 -0500 Subject: [PATCH 1/4] Spelling and comment formatting changes, no code changes. --- etc/inc/captiveportal.inc | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/etc/inc/captiveportal.inc b/etc/inc/captiveportal.inc index 3b796286c9..e1547f6f33 100644 --- a/etc/inc/captiveportal.inc +++ b/etc/inc/captiveportal.inc @@ -449,9 +449,10 @@ function captiveportal_prune_old() { $radiusservers = captiveportal_get_radius_servers(); - /* To make sure we iterate over ALL accounts on every run the count($cpdb) is moved outside of the loop. Otherwise - * the loop would evalate count() on every iteration and since $i would increase and count() would decrement they - * would meet before we had a chance to iterate over all accounts. + /* To make sure we iterate over ALL accounts on every run the count($cpdb) is moved + * outside of the loop. Otherwise the loop would evaluate count() on every iteration + * and since $i would increase and count() would decrement they would meet before we + * had a chance to iterate over all accounts. */ $unsetindexes = array(); $no_users = count($cpdb); @@ -485,8 +486,8 @@ function captiveportal_prune_old() { /* if an idle timeout is specified, get last activity timestamp from ipfw */ if (!$timedout && $idletimeout) { $lastact = captiveportal_get_last_activity($cpdb[$i][2]); - /* if the user has logged on but not sent any trafic they will never be logged out. - * We "fix" this by setting lastact to the login timestamp + /* If the user has logged on but not sent any traffic they will never be logged out. + * We "fix" this by setting lastact to the login timestamp. */ $lastact = $lastact ? $lastact : $cpdb[$i][0]; if ($lastact && ((time() - $lastact) >= $idletimeout)) { @@ -607,9 +608,10 @@ function captiveportal_disconnect($dbent, $radiusservers,$term_cause = 1,$stop_t false, $stop_time); } - + /* Delete client's ip entry from tables 3 and 4. */ mwexec("/sbin/ipfw table 3 delete {$dbent[2]}"); mwexec("/sbin/ipfw table 4 delete {$dbent[2]}"); + /* Delete client's ruleno */ mwexec("/sbin/ipfw delete {$dbent[1]}"); /* @@ -771,7 +773,7 @@ function captiveportal_allowedip_configure() { return 0; } -/* get last activity timestamp given ipfw rule number */ +/* get last activity timestamp given client IP address */ function captiveportal_get_last_activity($ip) { $ipfwoutput = ""; @@ -843,7 +845,7 @@ function radius($username,$password,$clientip,$clientmac,$type) { $ruleno = captiveportal_get_next_ipfw_ruleno(); - /* if the pool is empty, return apprioriate message and fail authentication */ + /* If the pool is empty, return appropriate message and fail authentication */ if (is_null($ruleno)) { $auth_list = array(); $auth_list['auth_val'] = 1; From e7b81ad7a4bf619c03ef970c994e8100345445f1 Mon Sep 17 00:00:00 2001 From: stompro Date: Tue, 8 Sep 2009 10:37:19 -0500 Subject: [PATCH 2/4] Fixed a few typos, expanded HCBI description, Expanded other descriptions. Expanded on the description of the wizard so it is clearer about the situation it is to be used for. Added the LAN acronym to the number of interfaces question, so it would be clearer. --- .../www/wizards/traffic_shaper_wizard_multi_lan.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.xml b/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.xml index 256f7a4826..c277839ccb 100644 --- a/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.xml +++ b/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.xml @@ -2,7 +2,7 @@ /* $Id$ */ - traffic_shaper_wizard_multi_lan2.xml + traffic_shaper_wizard_multi_lan.xml part of pfSense (http://www.pfsense.org/) Copyright (C) 2005 Bill Marquette - bill.marquette@gmail.com. @@ -36,13 +36,13 @@ 1 pfSense Traffic Shaper Wizard true - This wizard will guide you through setting up the pfSense traffic shaper. + This wizard will guide you through setting up the pfSense traffic shaper for the situation where you have 1 WAN connection and multiple LAN connections. Enter number of LAN type connections input ^[0-9]+$ - Number of local interfaces you have + Number of local(LAN) interfaces you have ezshaper->step1->numberofconnections @@ -221,7 +221,7 @@ Address input - This allows you to just provide the IP address of the computer(s) or Penalize. NOTE: You can also use a Firewall Alias in this location. + This allows you to just provide the IP address of the computer(s) to penalize. NOTE: You can also use a Firewall Alias in this location. ezshaper->step4->address IP Address field is non-blank and doesn't look like an IP address. @@ -787,7 +787,7 @@ L - Jabber instant messanger + Jabber instant messenger ICQ @@ -1247,7 +1247,7 @@ L - HBCI + Home Banking Computer Interface, for communicating with your bank Next From 8acfca38c7d05d10d49fba585bf9305952f31562 Mon Sep 17 00:00:00 2001 From: stompro Date: Fri, 11 Sep 2009 09:36:27 -0500 Subject: [PATCH 3/4] Fixes error that comes up when wake all is used. This error was coming up when wake all was used from the services WOL page. "Fatal error: Function name must be a string in /usr/local/www/services_wol.php on line 53" --- usr/local/www/services_wol.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/local/www/services_wol.php b/usr/local/www/services_wol.php index 89c36362b5..389047aa9f 100755 --- a/usr/local/www/services_wol.php +++ b/usr/local/www/services_wol.php @@ -50,7 +50,7 @@ if($_GET['wakeall'] <> "") { foreach ($a_wol as $wolent) { $mac = $wolent['mac']; $if = $wolent['interface']; - $bcip = gen_subnet_max($get_interface_ip($if), + $bcip = gen_subnet_max(get_interface_ip($if), get_interface_subnet($if)); mwexec("/usr/local/bin/wol -i {$bcip} {$mac}"); $savemsg .= "Sent magic packet to {$mac}.
"; From 1b197e555d5abc8d2505456cb2f0b347a4d4eaa2 Mon Sep 17 00:00:00 2001 From: stompro Date: Fri, 11 Sep 2009 11:02:50 -0500 Subject: [PATCH 4/4] Added checks to wol command execution to make it more obvious when the script fails. If the wol command returns with anything other than 0, alert the user that the command failed, and that they should look at the system log to find out why the command failed. I'm adding this out of frustration with the fact that the wol command hasn't been included at all in recent snapshots, and because the webgui doesn't give any indication of the command not working, it took much longer for me to figure out why it wasn't working. I hope this can save someone else time. --- usr/local/www/services_wol.php | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/usr/local/www/services_wol.php b/usr/local/www/services_wol.php index 389047aa9f..8fe4ad7853 100755 --- a/usr/local/www/services_wol.php +++ b/usr/local/www/services_wol.php @@ -50,10 +50,16 @@ if($_GET['wakeall'] <> "") { foreach ($a_wol as $wolent) { $mac = $wolent['mac']; $if = $wolent['interface']; + $description = $wolent['descr']; $bcip = gen_subnet_max(get_interface_ip($if), get_interface_subnet($if)); - mwexec("/usr/local/bin/wol -i {$bcip} {$mac}"); - $savemsg .= "Sent magic packet to {$mac}.
"; + /* Execute wol command and check return code. */ + if(!mwexec("/usr/local/bin/wol -i {$bcip} {$mac}")){ + $savemsg .= "Sent magic packet to {$mac} ({$description}).
"; + } + else { + $savemsg .= "Please check the system log, the wol command for {$description} ({$mac}) did not complete successfully.
"; + } } } @@ -82,9 +88,13 @@ if ($_POST || $_GET['mac']) { /* determine broadcast address */ $bcip = gen_subnet_max(get_interface_ip($if), get_interface_subnet($if)); - - mwexec("/usr/local/bin/wol -i {$bcip} {$mac}"); - $savemsg = "Sent magic packet to {$mac}."; + /* Execute wol command and check return code. */ + if(!mwexec("/usr/local/bin/wol -i {$bcip} {$mac}")){ + $savemsg .= "Sent magic packet to {$mac}."; + } + else { + $savemsg .= "Please check the system log, the wol command for {$mac} did not complete successfully.
"; + } } }