Révision 9abaa8f7
Ajouté par Ermal il y a presque 10 ans
etc/inc/vpn.inc | ||
---|---|---|
42 | 42 |
|
43 | 43 |
require_once("ipsec.inc"); |
44 | 44 |
|
45 |
function vpn_ipsec_configure_loglevels() |
|
45 |
function vpn_ipsec_configure_loglevels($forconfig = false)
|
|
46 | 46 |
{ |
47 | 47 |
global $config, $ipsec_loglevels; |
48 | 48 |
|
49 |
$cfgtext = array(); |
|
49 | 50 |
foreach ($ipsec_loglevels as $lkey => $ldescr) { |
50 |
if (empty($config['ipsec']["ipsec_{$lkey}"]))
|
|
51 |
mwexec("/usr/local/sbin/ipsec stroke loglevel {$lkey} -1", false); |
|
51 |
if (!isset($config['ipsec']["ipsec_{$lkey}"]))
|
|
52 |
$forconfig ? $cfgtext[] = "{$lkey} = -1" : mwexec("/usr/local/sbin/ipsec stroke loglevel {$lkey} -1", false);
|
|
52 | 53 |
else if (is_numeric($config['ipsec']["ipsec_{$lkey}"]) && |
53 | 54 |
intval($config['ipsec']["ipsec_{$lkey}"]) >= 1 && intval($config['ipsec']["ipsec_{$lkey}"]) <= 5) |
54 |
mwexec("/usr/local/sbin/ipsec stroke loglevel {$lkey} " . (intval($config['ipsec']["ipsec_{$lkey}"]) - 1) , false); |
|
55 |
$forconfig ? $cfgtext[] = "${lkey} = " . (intval($config['ipsec']["ipsec_{$lkey}"]) - 1) : |
|
56 |
mwexec("/usr/local/sbin/ipsec stroke loglevel {$lkey} " . (intval($config['ipsec']["ipsec_{$lkey}"]) - 1) , false); |
|
55 | 57 |
} |
58 |
if ($forconfig) |
|
59 |
return implode(',', $cfgtext); |
|
56 | 60 |
} |
57 | 61 |
|
58 | 62 |
/* include all configuration functions */ |
... | ... | |
512 | 516 |
$ipsecconf .= "# This file is automatically generated. Do not edit\n"; |
513 | 517 |
if (is_array($a_phase2) && count($a_phase2)) { |
514 | 518 |
$ipsecconf .= "config setup\n\tuniqueids = yes\n"; |
519 |
$ipsecconf .= "\tcharondebug=\"" . vpn_ipsec_configure_loglevels(true) . "\"\n"; |
|
515 | 520 |
|
516 | 521 |
foreach ($a_phase2 as $ph2ent) { |
517 | 522 |
$ikeid = $ph2ent['ikeid']; |
... | ... | |
842 | 847 |
} else { |
843 | 848 |
mwexec("/usr/local/sbin/ipsec start", false); |
844 | 849 |
} |
845 |
vpn_ipsec_configure_loglevels(); |
|
850 |
|
|
846 | 851 |
if ($natfilterrules == true) |
847 | 852 |
filter_configure(); |
848 | 853 |
/* start filterdns, if necessary */ |
Formats disponibles : Unified diff
Pass the loglevels on the config rather than execing commands to specify these loglevels. This allows somethings to be properly logged as config logs