From d5c56d72260c089d4044c963eb471cd84359efa2 Mon Sep 17 00:00:00 2001 From: Ermal Date: Mon, 24 May 2010 22:58:12 +0000 Subject: When editing a mac/ip passthru entry readd the rules again since values might have changed. --- usr/local/www/services_captiveportal_ip_edit.php | 11 +++++++---- usr/local/www/services_captiveportal_mac_edit.php | 11 +++++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) (limited to 'usr/local/www') diff --git a/usr/local/www/services_captiveportal_ip_edit.php b/usr/local/www/services_captiveportal_ip_edit.php index 09d8075..cf5145b 100755 --- a/usr/local/www/services_captiveportal_ip_edit.php +++ b/usr/local/www/services_captiveportal_ip_edit.php @@ -120,10 +120,13 @@ if ($_POST) { write_config(); if (isset($config['captiveportal']['enable']) && is_module_loaded("ipfw.ko")) { - $rules = captiveportal_allowedip_configure_entry($ip); - file_put_contents("{$g['tmp_path']}/allowedip_tmp", $rules); - mwexec("/sbin/ipfw {$g['tmp_path']}/allowedip_tmp"); - @unlink("{$g['tmp_path']}/allowedip_tmp"); + $rules = ""; + for ($i = 3; $i < 10; $i++) + $rules .= "table {$i} delete {$ip['ip']}\n"; + $rules .= captiveportal_allowedip_configure_entry($ip); + file_put_contents("{$g['tmp_path']}/allowedip_tmp{$id}", $rules); + mwexec("/sbin/ipfw -q {$g['tmp_path']}/allowedip_tmp{$id}"); + @unlink("{$g['tmp_path']}/allowedip_tmp{$id}"); } header("Location: services_captiveportal_ip.php"); diff --git a/usr/local/www/services_captiveportal_mac_edit.php b/usr/local/www/services_captiveportal_mac_edit.php index ac7b341..0d46ec4 100755 --- a/usr/local/www/services_captiveportal_mac_edit.php +++ b/usr/local/www/services_captiveportal_mac_edit.php @@ -120,6 +120,17 @@ if ($_POST) { write_config(); + $ruleno = captiveportal_get_ipfw_passthru_ruleno($mac['mac']); + if ($ruleno) { + captiveportal_free_ipfw_ruleno($ruleno); + $rules = "delete {$ruleno}\n"; + $rules .= "delete " . ++$ruleno . "\n"; + $rules .= captiveportal_passthrumac_configure_entry($mac); + file_put_contents("{$g['tmp_path']}/tmpmacedit{$id}", $rules); + mwexec("/sbin/ipfw -q {$g['tmp_path']}/tmpmacedit{$id}"); + @unlink("{$g['tmp_path']}/tmpmacedit{$id}"); + } + header("Location: services_captiveportal_mac.php"); exit; } -- cgit v1.1