Revision fe7e987e
Added by Ermal LUÇI over 12 years ago
etc/inc/captiveportal.inc | ||
---|---|---|
1371 | 1371 |
} |
1372 | 1372 |
|
1373 | 1373 |
function captiveportal_get_dn_passthru_ruleno($value) { |
1374 |
global $config, $g, $cpzone; |
|
1375 |
|
|
1376 |
$cpcfg = $config['captiveportal'][$cpzone]; |
|
1377 |
if(!isset($cpcfg['enable'])) |
|
1378 |
return NULL; |
|
1374 |
global $config, $g; |
|
1379 | 1375 |
|
1380 |
$cpruleslck = lock("captiveportalrules{$cpzone}", LOCK_EX);
|
|
1381 |
if (file_exists("{$g['vardb_path']}/captiveportal_{$cpzone}.rules")) {
|
|
1382 |
$rules = unserialize(file_get_contents("{$g['vardb_path']}/captiveportal_{$cpzone}.rules"));
|
|
1376 |
$cpruleslck = lock("captiveportalrulesdn", LOCK_EX);
|
|
1377 |
if (file_exists("{$g['vardb_path']}/captiveportaldn.rules")) {
|
|
1378 |
$rules = unserialize(file_get_contents("{$g['vardb_path']}/captiveportaldn.rules"));
|
|
1383 | 1379 |
captiveportal_ipfw_set_context($cpzone); |
1384 | 1380 |
$ruleno = intval(`/sbin/ipfw show | /usr/bin/grep {$value} | /usr/bin/grep -v grep | /usr/bin/cut -d " " -f 5 | /usr/bin/head -n 1`); |
1385 | 1381 |
if ($rules[$ruleno]) { |
usr/local/www/services_captiveportal_ip.php | ||
---|---|---|
67 | 67 |
$ipent = $a_allowedips[$_GET['id']]; |
68 | 68 |
|
69 | 69 |
if (isset($config['captiveportal'][$cpzone]['enable'])) { |
70 |
if (!empty($ipent['sn'])) |
|
70 |
if (!empty($ipent['sn'])) { |
|
71 |
$ipfw = pfSense_ipfw_getTablestats($cpzone, 3, $ipent['ip'], $ipent['sn']); |
|
71 | 72 |
$ipent['ip'] .= "/{$ipent['sn']}"; |
73 |
} else |
|
74 |
$ipfw = pfSense_ipfw_getTablestats($cpzone, 3, $ipent['ip']); |
|
72 | 75 |
captiveportal_ipfw_set_context($cpzone); |
73 |
$ipfw = pfSense_ipfw_getTablestats($cpzone, 3, $ipent['ip']); |
|
74 | 76 |
if (is_array($ipfw)) { |
75 | 77 |
captiveportal_free_dn_ruleno($ipfw['dnpipe']); |
76 | 78 |
pfSense_pipe_action("pipe delete {$ipfw['dnpipe']}"); |
usr/local/www/services_captiveportal_ip_edit.php | ||
---|---|---|
128 | 128 |
$ip['bw_up'] = $_POST['bw_up']; |
129 | 129 |
if ($_POST['bw_down']) |
130 | 130 |
$ip['bw_down'] = $_POST['bw_down']; |
131 |
$oldmask = ""; |
|
131 | 132 |
if (isset($id) && $a_allowedips[$id]) { |
132 | 133 |
$oldip = $a_allowedips[$id]['ip']; |
133 | 134 |
if (!empty($a_allowedips[$id]['sn'])) |
134 |
$oldip .= "/{$a_allowedips[$id]['sn']}";
|
|
135 |
$oldmask .= "/{$a_allowedips[$id]['sn']}";
|
|
135 | 136 |
$a_allowedips[$id] = $ip; |
136 | 137 |
} else { |
137 | 138 |
$oldip = $ip['ip']; |
138 | 139 |
if (!empty($ip['sn'])) |
139 |
$oldip .= "/{$ip['sn']}";
|
|
140 |
$oldmask .= "/{$ip['sn']}";
|
|
140 | 141 |
$a_allowedips[] = $ip; |
141 | 142 |
} |
142 | 143 |
allowedips_sort(); |
... | ... | |
144 | 145 |
write_config(); |
145 | 146 |
|
146 | 147 |
if (isset($a_cp[$cpzone]['enable']) && is_module_loaded("ipfw.ko")) { |
148 |
captiveportal_ipfw_set_context($cpzone); |
|
149 |
if (is_ipaddr($oldip)) { |
|
150 |
if (!empty($oldmask)) |
|
151 |
$ipfw = pfSense_ipfw_getTablestats($cpzone, 3, $oldip, $oldmask); |
|
152 |
else |
|
153 |
$ipfw = pfSense_ipfw_getTablestats($cpzone, 3, $oldip); |
|
154 |
} |
|
147 | 155 |
$rules = "table 3 delete {$oldip}"; |
148 | 156 |
$rules .= "table 4 delete {$oldip}"; |
149 |
$ipfw = pfSense_ipfw_getTablestats($cpzone, 3, $oldip); |
|
150 | 157 |
if (is_array($ipfw)) { |
151 | 158 |
captiveportal_free_dn_ruleno($ipfw['dnpipe']); |
152 | 159 |
$rules .= "pipe delete {$ipfw['dnpipe']}"; |
usr/local/www/services_captiveportal_mac.php | ||
---|---|---|
130 | 130 |
$ruleno = captiveportal_get_ipfw_passthru_ruleno($a_passthrumacs[$_GET['id']]['mac']); |
131 | 131 |
if ($ruleno) { |
132 | 132 |
captiveportal_free_ipfw_ruleno($ruleno); |
133 |
$pipeno = captiveportal_get_dn_passthru_ruleno($_POST['delmac']);
|
|
133 |
$pipeno = captiveportal_get_dn_passthru_ruleno($a_passthrumacs[$_GET['id']]['mac']);
|
|
134 | 134 |
if ($pipeno) |
135 | 135 |
captiveportal_free_dn_ruleno($pipeno); |
136 | 136 |
captiveportal_ipfw_set_context($cpzone); |
usr/local/www/services_captiveportal_mac_edit.php | ||
---|---|---|
144 | 144 |
$ruleno = captiveportal_get_ipfw_passthru_ruleno($oldmac); |
145 | 145 |
if ($ruleno) { |
146 | 146 |
captiveportal_free_ipfw_ruleno($ruleno); |
147 |
$pipeno = captiveportal_get_dn_passthru_ruleno($_POST['delmac']);
|
|
147 |
$pipeno = captiveportal_get_dn_passthru_ruleno($oldmac);
|
|
148 | 148 |
if ($pipeno) { |
149 | 149 |
captiveportal_free_dn_ruleno($pipeno); |
150 | 150 |
$rules .= "pipe delete {$pipeno}\n"; |
Also available in: Unified diff
Various fixes to removal of pipes