diff options
author | Renato Botelho <renato@netgate.com> | 2016-10-24 19:19:19 -0200 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2016-10-24 19:22:00 -0200 |
commit | 517b893eec63ce7695bc91b3a0e82882136e8ef5 (patch) | |
tree | 603b3c72b04277a76b8c531400a0f339ceebf9ed /src/usr/local/www/services_captiveportal_hostname.php | |
parent | 6344be46d4946e594085f7a08249f70a5b109340 (diff) | |
download | pfsense-517b893eec63ce7695bc91b3a0e82882136e8ef5.zip pfsense-517b893eec63ce7695bc91b3a0e82882136e8ef5.tar.gz |
Rework captive portal to run with stock IPFW (round 1)
- Remove use of IPFW context
- Create a rule that will skip to proper rule for each cp zone
- Use new PHP module functions wherever is possible
Diffstat (limited to 'src/usr/local/www/services_captiveportal_hostname.php')
-rw-r--r-- | src/usr/local/www/services_captiveportal_hostname.php | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/usr/local/www/services_captiveportal_hostname.php b/src/usr/local/www/services_captiveportal_hostname.php index 6c2af91..7de5912 100644 --- a/src/usr/local/www/services_captiveportal_hostname.php +++ b/src/usr/local/www/services_captiveportal_hostname.php @@ -75,15 +75,16 @@ if ($_GET['act'] == "del" && !empty($cpzone) && isset($cpzoneid)) { } $sn = (is_ipaddrv6($ip)) ? 128 : 32; if (is_ipaddr($ip)) { - $ipfw = pfSense_ipfw_getTablestats($cpzoneid, IP_FW_TABLE_XLISTENTRY, 3, $ip); - if (is_array($ipfw)) { - captiveportal_free_dn_ruleno($ipfw['dnpipe']); - pfSense_pipe_action("pipe delete {$ipfw['dnpipe']}"); - pfSense_pipe_action("pipe delete " . ($ipfw['dnpipe']+1)); - } + $rule = pfSense_ipfw_table_lookup("{$cpzone}_allowed_up", "{$ip}/{$sn}"); + + pfSense_ipfw_table("{$cpzone}_allowed_up", IP_FW_TABLE_XDEL, "{$ip}/{$sn}"); + pfSense_ipfw_table("{$cpzone}_allowed_down", IP_FW_TABLE_XDEL, "{$ip}/{$sn}"); - pfSense_ipfw_Tableaction($cpzoneid, IP_FW_TABLE_XDEL, 3, $ip, $sn); - pfSense_ipfw_Tableaction($cpzoneid, IP_FW_TABLE_XDEL, 4, $ip, $sn); + if (is_array($rule) && !empty($rule['pipe'])) { + captiveportal_free_dn_ruleno($rule['pipe']); + pfSense_ipfw_pipe("pipe delete {$rule['pipe']}"); + pfSense_ipfw_pipe("pipe delete " . ($rule['pipe']+1)); + } } } |