Revision 339e2fe5
Added by Ermal Luçi over 10 years ago
etc/inc/captiveportal.inc | ||
---|---|---|
194 | 194 |
} else |
195 | 195 |
captiveportal_syslog("Reconfiguring captive portal({$cpcfg['zone']})."); |
196 | 196 |
|
197 |
if (is_array($cpcfg['passthrumac'])) { |
|
198 |
$nentries = count($cpcfg['passthrumac']); |
|
199 |
if ($nentries > 2000) { |
|
200 |
if (!set_time_limit(0)) |
|
201 |
log_error("Execution time limit may be reached while reconfiguring zone = {$cpzone} due to many passthrugh entries!"); |
|
202 |
} |
|
203 |
} |
|
204 |
|
|
197 | 205 |
/* init ipfw rules */ |
198 | 206 |
captiveportal_init_rules(true); |
199 | 207 |
|
... | ... | |
381 | 389 |
} |
382 | 390 |
} |
383 | 391 |
|
392 |
/* XXX: Same as in rc.php_init_setup */ |
|
393 |
set_time_limit(900); |
|
384 | 394 |
unlock($captiveportallck); |
385 | 395 |
|
386 | 396 |
return 0; |
... | ... | |
474 | 484 |
|
475 | 485 |
captiveportal_load_modules(); |
476 | 486 |
mwexec("/sbin/ipfw zone {$cpzoneid} create", true); |
487 |
captiveportal_flush_dn_ruleno($cpzone); |
|
477 | 488 |
|
478 | 489 |
$cpips = array(); |
479 | 490 |
$ifaces = get_configured_interface_list(); |
... | ... | |
1480 | 1491 |
unlock($cpruleslck); |
1481 | 1492 |
} |
1482 | 1493 |
|
1494 |
/* |
|
1495 |
* To avoid allocating more ids than needed to a zone need |
|
1496 |
* to flush them before loading/creating new ruleset |
|
1497 |
*/ |
|
1498 |
function captiveportal_flush_dn_ruleno($cpzone) { |
|
1499 |
global $config, $g; |
|
1500 |
|
|
1501 |
$cpruleslck = lock("captiveportalrulesdn", LOCK_EX); |
|
1502 |
if (file_exists("{$g['vardb_path']}/captiveportaldn.rules")) { |
|
1503 |
$rules = unserialize(file_get_contents("{$g['vardb_path']}/captiveportaldn.rules")); |
|
1504 |
foreach ($rules as $idx => $zone) { |
|
1505 |
if ($zone == $cpzone) |
|
1506 |
$rules[$idx] = false; |
|
1507 |
} |
|
1508 |
file_put_contents("{$g['vardb_path']}/captiveportaldn.rules", serialize($rules)); |
|
1509 |
unset($rules); |
|
1510 |
} |
|
1511 |
unlock($cpruleslck); |
|
1512 |
} |
|
1513 |
|
|
1483 | 1514 |
function captiveportal_get_dn_passthru_ruleno($value) { |
1484 | 1515 |
global $config, $g, $cpzone, $cpzoneid; |
1485 | 1516 |
|
Also available in: Unified diff
Set the time limit to 0 and restore it back to default value when this is detected.
This has been noted before but considered fixed, this is the real fix actually for dnpipes.