Revision 1fe208ec
Added by Ermal Luçi over 10 years ago
etc/inc/ipsec.inc | ||
---|---|---|
671 | 671 |
return $result; |
672 | 672 |
} |
673 | 673 |
|
674 |
function ipsec_new_reqid() { |
|
675 |
global $config; |
|
676 |
|
|
677 |
if (!is_array($config['ipsec']) || !is_array($config['ipsec']['phase2'])) |
|
678 |
return; |
|
679 |
|
|
680 |
$ipsecreqid = lock('ipsecreqids', LOCK_EX); |
|
681 |
$keyids = array(); |
|
682 |
$keyid = 1; |
|
683 |
foreach ($config['ipsec']['phase2'] as $ph2) |
|
684 |
$keyids[$ph2['reqid']] = $ph2['reqid']; |
|
685 |
|
|
686 |
for ($i = 1; $i < 16000; $i++) { |
|
687 |
if (!isset($keyids[$i])) { |
|
688 |
$keyid = $i; |
|
689 |
break; |
|
690 |
} |
|
691 |
} |
|
692 |
unlock($ipsecreqid); |
|
693 |
|
|
694 |
return $keyid; |
|
695 |
} |
|
696 |
|
|
674 | 697 |
?> |
Also available in: Unified diff
To avoid issues with clashing SAIDs go back to specifying the reqid in strongswan config.
To be able to manage this first upgrade the config to assign each phase2 an reqid
Second use that during config generation
Ticket #4208