Add uniqueids=never to ignore INITIAL_CONTACT notifies

With uniqueids=no the daemon still deletes any existing IKE_SA with the
same peer if an INITIAL_CONTACT notify is received.  With this new option
it also ignores these notifies.
This commit is contained in:
Tobias Brunner
2012-09-10 17:37:18 +02:00
parent c51af950b1
commit f4cc7ea11b
6 changed files with 28 additions and 14 deletions
+5 -3
View File
@@ -81,11 +81,13 @@ extern enum_name_t *cert_policy_names;
* Uniqueness of an IKE_SA, used to drop multiple connections with one peer.
*/
enum unique_policy_t {
/** do not check for client uniqueness */
/** never check for client uniqueness */
UNIQUE_NEVER,
/** only check for client uniqueness when receiving an INITIAL_CONTACT */
UNIQUE_NO,
/** replace unique IKE_SAs if new ones get established */
/** replace existing IKE_SAs when new ones get established by a client */
UNIQUE_REPLACE,
/** keep existing IKE_SAs, close the new ones on connection attept */
/** keep existing IKE_SAs, close the new ones on connection attempt */
UNIQUE_KEEP,
};
@@ -690,6 +690,9 @@ static peer_cfg_t *build_peer_cfg(private_stroke_config_t *this,
case 3: /* keep */
unique = UNIQUE_KEEP;
break;
case 4: /* never */
unique = UNIQUE_NEVER;
break;
default: /* no */
unique = UNIQUE_NO;
break;
+1 -1
View File
@@ -1711,7 +1711,7 @@ METHOD(ike_sa_manager_t, check_uniqueness, bool,
peer_cfg = ike_sa->get_peer_cfg(ike_sa);
policy = peer_cfg->get_unique_policy(peer_cfg);
if (policy == UNIQUE_NO && !force_replace)
if (policy == UNIQUE_NEVER || (policy == UNIQUE_NO && !force_replace))
{
return FALSE;
}
+2 -1
View File
@@ -435,7 +435,8 @@ METHOD(task_t, build_i, status_t,
message->add_payload(message, (payload_t*)id_payload);
if (idr && message->get_message_id(message) == 1 &&
this->peer_cfg->get_unique_policy(this->peer_cfg) != UNIQUE_NO)
this->peer_cfg->get_unique_policy(this->peer_cfg) != UNIQUE_NO &&
this->peer_cfg->get_unique_policy(this->peer_cfg) != UNIQUE_NEVER)
{
host_t *host;
+1
View File
@@ -61,6 +61,7 @@ static const char *LST_unique[] = {
"yes",
"replace",
"keep",
"never",
NULL
};