From 1dbe445acc2b74c4a610e397c0c15031d99666e5 Mon Sep 17 00:00:00 2001 From: Ermal Date: Tue, 20 Apr 2010 18:32:59 +0000 Subject: Use tables of ipfw for passthrough mac entries. This makes it scale way better than previously. Fix multiple entries on adding mac through entries automatically after login for the same user. The changes allow even pass through mac to be controlled from the Status->Captiveportal. Use serialize/unserialize on some files that keep temporary information to speed up calculations. Really allow mac passthrough to follow radius rules or time out rules when present. --- usr/local/www/services_captiveportal_ip_edit.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'usr/local/www/services_captiveportal_ip_edit.php') diff --git a/usr/local/www/services_captiveportal_ip_edit.php b/usr/local/www/services_captiveportal_ip_edit.php index 4e1b661..977ba9f 100755 --- a/usr/local/www/services_captiveportal_ip_edit.php +++ b/usr/local/www/services_captiveportal_ip_edit.php @@ -118,7 +118,21 @@ if ($_POST) { write_config(); if (isset($config['captiveportal']['enable'])) { - mwexec("/sbin/ipfw table 1 add " . $ip['ip']); + $bwup = ""; + $bwdown = ""; + $ruleno = captiveportal_get_next_ipfw_ruleno(); + if (!empty($ip['bw_up'])) { + $pipeno = $ruleno + 20000; + mwexec("/sbin/ipfw pipe {$pipeno} config bw {$ip['bw_up']}Kbit/s queue 100") + $bwup = "pipe {$pipeno}"; + } + if (!empty($ip['bw_down'])) { + $pipeno = $ruleno + 20001; + mwexec("/sbin/ipfw pipe {$pipeno} config bw {$ip['bw_down']}Kbit/s queue 100") + $bwdown = "pipe {$pipeno}"; + } + mwexec("/sbin/ipfw table 1 add {$ip['ip']} {$bwup}"); + mwexec("/sbin/ipfw table 2 add {$ip['ip']} {$bwdown}"); } header("Location: services_captiveportal_ip.php"); -- cgit v1.1