aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/libcharon/plugins/kernel_pfkey/kernel_pfkey_ipsec.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libcharon/plugins/kernel_pfkey/kernel_pfkey_ipsec.c b/src/libcharon/plugins/kernel_pfkey/kernel_pfkey_ipsec.c
index 0e2e7df48..7eb6c5808 100644
--- a/src/libcharon/plugins/kernel_pfkey/kernel_pfkey_ipsec.c
+++ b/src/libcharon/plugins/kernel_pfkey/kernel_pfkey_ipsec.c
@@ -2598,7 +2598,13 @@ METHOD(kernel_ipsec_t, add_policy, status_t,
enumerator = policy->used_by->create_enumerator(policy->used_by);
while (enumerator->enumerate(enumerator, (void**)&current_sa))
{
- if (current_sa->priority >= assigned_sa->priority)
+ if (current_sa->priority > assigned_sa->priority)
+ {
+ break;
+ }
+ /* prefer SAs with a reqid over those without */
+ if (current_sa->priority == assigned_sa->priority &&
+ (!current_sa->sa->cfg.reqid || assigned_sa->sa->cfg.reqid))
{
break;
}