2005-11-08 13:33:28 +00:00
|
|
|
/*
|
2011-05-19 15:27:32 +00:00
|
|
|
* Copyright (C) 2006-2011 Tobias Brunner
|
2007-10-03 15:10:41 +00:00
|
|
|
* Copyright (C) 2006 Daniel Roethlisberger
|
2009-04-14 10:34:24 +00:00
|
|
|
* Copyright (C) 2005-2009 Martin Willi
|
2006-07-07 08:49:06 +00:00
|
|
|
* Copyright (C) 2005 Jan Hutter
|
2005-11-08 13:33:28 +00:00
|
|
|
* Hochschule fuer Technik Rapperswil
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
|
|
|
* Free Software Foundation; either version 2 of the License, or (at your
|
|
|
|
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* for more details.
|
2008-03-13 14:14:44 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @defgroup ike_sa ike_sa
|
|
|
|
* @{ @ingroup sa
|
2005-11-08 13:33:28 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef IKE_SA_H_
|
|
|
|
#define IKE_SA_H_
|
|
|
|
|
2007-06-18 10:32:01 +00:00
|
|
|
typedef enum ike_extension_t ike_extension_t;
|
2007-06-21 15:25:28 +00:00
|
|
|
typedef enum ike_condition_t ike_condition_t;
|
2006-10-30 14:07:05 +00:00
|
|
|
typedef enum ike_sa_state_t ike_sa_state_t;
|
2007-11-20 12:06:40 +00:00
|
|
|
typedef enum statistic_t statistic_t;
|
2006-10-30 14:07:05 +00:00
|
|
|
typedef struct ike_sa_t ike_sa_t;
|
|
|
|
|
2006-10-31 12:27:59 +00:00
|
|
|
#include <library.h>
|
2010-03-24 16:46:29 +00:00
|
|
|
#include <attributes/attribute_handler.h>
|
2005-11-23 09:57:18 +00:00
|
|
|
#include <encoding/message.h>
|
2005-11-28 15:20:51 +00:00
|
|
|
#include <encoding/payloads/proposal_substructure.h>
|
2009-04-24 14:13:52 +00:00
|
|
|
#include <encoding/payloads/configuration_attribute.h>
|
2005-11-23 10:11:50 +00:00
|
|
|
#include <sa/ike_sa_id.h>
|
2006-02-16 09:55:07 +00:00
|
|
|
#include <sa/child_sa.h>
|
2010-06-07 09:37:55 +00:00
|
|
|
#include <sa/task_manager.h>
|
2008-10-28 16:07:06 +00:00
|
|
|
#include <sa/keymat.h>
|
2007-04-10 06:01:03 +00:00
|
|
|
#include <config/peer_cfg.h>
|
|
|
|
#include <config/ike_cfg.h>
|
2010-07-05 09:54:25 +00:00
|
|
|
#include <credentials/auth_cfg.h>
|
2005-11-21 16:41:24 +00:00
|
|
|
|
2007-04-11 07:20:39 +00:00
|
|
|
/**
|
2009-04-21 15:16:56 +00:00
|
|
|
* Timeout in seconds after that a half open IKE_SA gets deleted.
|
2007-04-11 07:20:39 +00:00
|
|
|
*/
|
2009-04-21 15:16:56 +00:00
|
|
|
#define HALF_OPEN_IKE_SA_TIMEOUT 30
|
2007-04-11 07:20:39 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Interval to send keepalives when NATed, in seconds.
|
|
|
|
*/
|
|
|
|
#define KEEPALIVE_INTERVAL 20
|
|
|
|
|
|
|
|
/**
|
|
|
|
* After which time rekeying should be retried if it failed, in seconds.
|
|
|
|
*/
|
|
|
|
#define RETRY_INTERVAL 30
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Jitter to subtract from RETRY_INTERVAL to randomize rekey retry.
|
|
|
|
*/
|
|
|
|
#define RETRY_JITTER 20
|
|
|
|
|
2007-06-18 10:32:01 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Extensions (or optional features) the peer supports
|
2007-06-18 10:32:01 +00:00
|
|
|
*/
|
|
|
|
enum ike_extension_t {
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2007-06-18 10:32:01 +00:00
|
|
|
/**
|
|
|
|
* peer supports NAT traversal as specified in RFC4306
|
|
|
|
*/
|
2007-06-21 15:25:28 +00:00
|
|
|
EXT_NATT = (1<<0),
|
2007-06-18 10:32:01 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* peer supports MOBIKE (RFC4555)
|
|
|
|
*/
|
2007-06-21 15:25:28 +00:00
|
|
|
EXT_MOBIKE = (1<<1),
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2008-04-18 11:24:45 +00:00
|
|
|
/**
|
|
|
|
* peer supports HTTP cert lookups as specified in RFC4306
|
|
|
|
*/
|
|
|
|
EXT_HASH_AND_URL = (1<<2),
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2009-04-14 10:34:24 +00:00
|
|
|
/**
|
|
|
|
* peer supports multiple authentication exchanges, RFC4739
|
|
|
|
*/
|
|
|
|
EXT_MULTIPLE_AUTH = (1<<3),
|
2010-01-07 09:26:58 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* peer uses strongSwan, accept private use extensions
|
|
|
|
*/
|
|
|
|
EXT_STRONGSWAN = (1<<4),
|
2010-01-07 13:30:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* peer supports EAP-only authentication, draft-eronen-ipsec-ikev2-eap-auth
|
|
|
|
*/
|
|
|
|
EXT_EAP_ONLY_AUTHENTICATION = (1<<5),
|
2011-08-10 14:57:59 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* peer is probably a Windows 7 RAS client
|
|
|
|
*/
|
|
|
|
EXT_MS_WINDOWS = (1<<6),
|
2007-06-21 15:25:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Conditions of an IKE_SA, change during its lifetime
|
2007-06-21 15:25:28 +00:00
|
|
|
*/
|
|
|
|
enum ike_condition_t {
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2007-06-21 15:25:28 +00:00
|
|
|
/**
|
2007-10-01 12:19:39 +00:00
|
|
|
* Connection is natted (or faked) somewhere
|
2007-06-21 15:25:28 +00:00
|
|
|
*/
|
|
|
|
COND_NAT_ANY = (1<<0),
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2007-06-21 15:25:28 +00:00
|
|
|
/**
|
|
|
|
* we are behind NAT
|
|
|
|
*/
|
|
|
|
COND_NAT_HERE = (1<<1),
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2007-06-21 15:25:28 +00:00
|
|
|
/**
|
|
|
|
* other is behind NAT
|
|
|
|
*/
|
|
|
|
COND_NAT_THERE = (1<<2),
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2007-10-01 12:19:39 +00:00
|
|
|
/**
|
|
|
|
* Faking NAT to enforce UDP encapsulation
|
|
|
|
*/
|
|
|
|
COND_NAT_FAKE = (1<<3),
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2007-06-21 15:25:28 +00:00
|
|
|
/**
|
2009-04-14 10:34:24 +00:00
|
|
|
* peer has been authenticated using EAP at least once
|
2007-06-21 15:25:28 +00:00
|
|
|
*/
|
2007-11-20 12:06:40 +00:00
|
|
|
COND_EAP_AUTHENTICATED = (1<<4),
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2008-03-13 14:14:44 +00:00
|
|
|
/**
|
|
|
|
* received a certificate request from the peer
|
|
|
|
*/
|
2008-04-11 08:14:48 +00:00
|
|
|
COND_CERTREQ_SEEN = (1<<5),
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2008-11-12 16:07:17 +00:00
|
|
|
/**
|
|
|
|
* Local peer is the "original" IKE initiator. Unaffected from rekeying.
|
|
|
|
*/
|
|
|
|
COND_ORIGINAL_INITIATOR = (1<<6),
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2009-07-02 08:56:13 +00:00
|
|
|
/**
|
|
|
|
* IKE_SA is stale, the peer is currently unreachable (MOBIKE)
|
|
|
|
*/
|
|
|
|
COND_STALE = (1<<7),
|
2007-11-20 12:06:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2008-10-27 14:51:00 +00:00
|
|
|
* Timing information and statistics to query from an SA
|
2007-11-20 12:06:40 +00:00
|
|
|
*/
|
|
|
|
enum statistic_t {
|
2008-10-27 14:51:00 +00:00
|
|
|
/** Timestamp of SA establishement */
|
|
|
|
STAT_ESTABLISHED = 0,
|
|
|
|
/** Timestamp of scheudled rekeying */
|
|
|
|
STAT_REKEY,
|
|
|
|
/** Timestamp of scheudled reauthentication */
|
|
|
|
STAT_REAUTH,
|
|
|
|
/** Timestamp of scheudled delete */
|
|
|
|
STAT_DELETE,
|
|
|
|
/** Timestamp of last inbound IKE packet */
|
|
|
|
STAT_INBOUND,
|
|
|
|
/** Timestamp of last outbound IKE packet */
|
|
|
|
STAT_OUTBOUND,
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2008-10-27 14:51:00 +00:00
|
|
|
STAT_MAX
|
2007-06-18 10:32:01 +00:00
|
|
|
};
|
2007-04-11 07:20:39 +00:00
|
|
|
|
2005-11-21 16:41:24 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* State of an IKE_SA.
|
2006-07-12 14:08:52 +00:00
|
|
|
*
|
|
|
|
* An IKE_SA passes various states in its lifetime. A newly created
|
|
|
|
* SA is in the state CREATED.
|
|
|
|
* @verbatim
|
|
|
|
+----------------+
|
2006-08-23 07:30:43 +00:00
|
|
|
¦ SA_CREATED ¦
|
2006-07-12 14:08:52 +00:00
|
|
|
+----------------+
|
2006-08-23 07:30:43 +00:00
|
|
|
¦
|
2009-09-02 15:26:36 +00:00
|
|
|
on initiate()---> ¦ <----- on IKE_SA_INIT received
|
2006-08-23 07:30:43 +00:00
|
|
|
V
|
2006-07-12 14:08:52 +00:00
|
|
|
+----------------+
|
2006-08-23 07:30:43 +00:00
|
|
|
¦ SA_CONNECTING ¦
|
2006-07-12 14:08:52 +00:00
|
|
|
+----------------+
|
2006-08-23 07:30:43 +00:00
|
|
|
¦
|
|
|
|
¦ <----- on IKE_AUTH successfully completed
|
|
|
|
V
|
2006-07-12 14:08:52 +00:00
|
|
|
+----------------+
|
2006-08-23 07:30:43 +00:00
|
|
|
¦ SA_ESTABLISHED ¦-------------------------+ <-- on rekeying
|
|
|
|
+----------------+ ¦
|
|
|
|
¦ V
|
|
|
|
on delete()---> ¦ <----- on IKE_SA +-------------+
|
|
|
|
¦ delete request ¦ SA_REKEYING ¦
|
|
|
|
¦ received +-------------+
|
|
|
|
V ¦
|
|
|
|
+----------------+ ¦
|
|
|
|
¦ SA_DELETING ¦<------------------------+ <-- after rekeying
|
2006-07-12 14:08:52 +00:00
|
|
|
+----------------+
|
2006-08-23 07:30:43 +00:00
|
|
|
¦
|
|
|
|
¦ <----- after delete() acknowledged
|
|
|
|
¦
|
|
|
|
\V/
|
2006-07-12 14:08:52 +00:00
|
|
|
X
|
|
|
|
/ \
|
|
|
|
@endverbatim
|
2005-11-21 16:41:24 +00:00
|
|
|
*/
|
2006-07-05 10:53:20 +00:00
|
|
|
enum ike_sa_state_t {
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2006-07-05 10:53:20 +00:00
|
|
|
/**
|
|
|
|
* IKE_SA just got created, but is not initiating nor responding yet.
|
|
|
|
*/
|
2006-07-13 08:26:54 +00:00
|
|
|
IKE_CREATED,
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2006-07-05 10:53:20 +00:00
|
|
|
/**
|
|
|
|
* IKE_SA gets initiated actively or passively
|
|
|
|
*/
|
2006-07-13 08:26:54 +00:00
|
|
|
IKE_CONNECTING,
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2006-07-05 10:53:20 +00:00
|
|
|
/**
|
|
|
|
* IKE_SA is fully established
|
|
|
|
*/
|
2006-07-13 08:26:54 +00:00
|
|
|
IKE_ESTABLISHED,
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2008-11-28 10:49:14 +00:00
|
|
|
/**
|
|
|
|
* IKE_SA is managed externally and does not process messages
|
|
|
|
*/
|
|
|
|
IKE_PASSIVE,
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2006-08-23 07:30:43 +00:00
|
|
|
/**
|
|
|
|
* IKE_SA rekeying in progress
|
|
|
|
*/
|
|
|
|
IKE_REKEYING,
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2006-07-05 10:53:20 +00:00
|
|
|
/**
|
|
|
|
* IKE_SA is in progress of deletion
|
|
|
|
*/
|
2006-07-13 08:26:54 +00:00
|
|
|
IKE_DELETING,
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2008-10-14 08:52:13 +00:00
|
|
|
/**
|
|
|
|
* IKE_SA object gets destroyed
|
|
|
|
*/
|
|
|
|
IKE_DESTROYING,
|
2006-07-05 10:53:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2006-10-18 11:46:13 +00:00
|
|
|
* enum names for ike_sa_state_t.
|
2006-07-05 10:53:20 +00:00
|
|
|
*/
|
2006-10-18 11:46:13 +00:00
|
|
|
extern enum_name_t *ike_sa_state_names;
|
2005-11-08 13:33:28 +00:00
|
|
|
|
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Class ike_sa_t representing an IKE_SA.
|
2006-07-05 10:53:20 +00:00
|
|
|
*
|
|
|
|
* An IKE_SA contains crypto information related to a connection
|
|
|
|
* with a peer. It contains multiple IPsec CHILD_SA, for which
|
|
|
|
* it is responsible. All traffic is handled by an IKE_SA, using
|
2007-02-28 14:04:36 +00:00
|
|
|
* the task manager and its tasks.
|
2005-11-08 13:33:28 +00:00
|
|
|
*/
|
2005-11-24 11:30:19 +00:00
|
|
|
struct ike_sa_t {
|
2005-11-08 13:33:28 +00:00
|
|
|
|
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Get the id of the SA.
|
2009-09-02 15:26:36 +00:00
|
|
|
*
|
2006-07-05 10:53:20 +00:00
|
|
|
* Returned ike_sa_id_t object is not getting cloned!
|
2005-11-10 09:35:28 +00:00
|
|
|
*
|
2011-05-19 15:27:32 +00:00
|
|
|
* @return ike_sa's ike_sa_id_t
|
2005-11-08 13:33:28 +00:00
|
|
|
*/
|
2006-07-05 10:53:20 +00:00
|
|
|
ike_sa_id_t* (*get_id) (ike_sa_t *this);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2007-02-28 14:04:36 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Get the numerical ID uniquely defining this IKE_SA.
|
2007-02-28 14:04:36 +00:00
|
|
|
*
|
2011-05-19 15:27:32 +00:00
|
|
|
* @return unique ID
|
2007-02-28 14:04:36 +00:00
|
|
|
*/
|
|
|
|
u_int32_t (*get_unique_id) (ike_sa_t *this);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2006-07-05 10:53:20 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Get the state of the IKE_SA.
|
2006-07-05 10:53:20 +00:00
|
|
|
*
|
|
|
|
* @return state of the IKE_SA
|
|
|
|
*/
|
|
|
|
ike_sa_state_t (*get_state) (ike_sa_t *this);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2006-07-05 10:53:20 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Set the state of the IKE_SA.
|
2006-07-05 10:53:20 +00:00
|
|
|
*
|
|
|
|
* @param state state to set for the IKE_SA
|
|
|
|
*/
|
|
|
|
void (*set_state) (ike_sa_t *this, ike_sa_state_t ike_sa);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2006-07-20 10:09:32 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Get the name of the connection this IKE_SA uses.
|
2006-07-20 10:09:32 +00:00
|
|
|
*
|
|
|
|
* @return name
|
|
|
|
*/
|
|
|
|
char* (*get_name) (ike_sa_t *this);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2007-11-20 12:06:40 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Get statistic values from the IKE_SA.
|
2007-11-20 12:06:40 +00:00
|
|
|
*
|
|
|
|
* @param kind kind of requested value
|
|
|
|
* @return value as integer
|
|
|
|
*/
|
|
|
|
u_int32_t (*get_statistic)(ike_sa_t *this, statistic_t kind);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2006-07-20 10:09:32 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Get the own host address.
|
2009-09-02 15:26:36 +00:00
|
|
|
*
|
2006-07-20 10:09:32 +00:00
|
|
|
* @return host address
|
|
|
|
*/
|
|
|
|
host_t* (*get_my_host) (ike_sa_t *this);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2006-07-27 12:18:40 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Set the own host address.
|
2009-09-02 15:26:36 +00:00
|
|
|
*
|
2006-07-27 12:18:40 +00:00
|
|
|
* @param me host address
|
|
|
|
*/
|
|
|
|
void (*set_my_host) (ike_sa_t *this, host_t *me);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2006-07-20 10:09:32 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Get the other peers host address.
|
2009-09-02 15:26:36 +00:00
|
|
|
*
|
2006-07-20 10:09:32 +00:00
|
|
|
* @return host address
|
|
|
|
*/
|
|
|
|
host_t* (*get_other_host) (ike_sa_t *this);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2006-07-27 12:18:40 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Set the others host address.
|
2009-09-02 15:26:36 +00:00
|
|
|
*
|
2006-07-27 12:18:40 +00:00
|
|
|
* @param other host address
|
|
|
|
*/
|
|
|
|
void (*set_other_host) (ike_sa_t *this, host_t *other);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2010-08-30 10:19:37 +00:00
|
|
|
/**
|
|
|
|
* Float to port 4500 (e.g. if a NAT is detected).
|
|
|
|
*
|
|
|
|
* The port of either endpoint is changed only if it is currently
|
|
|
|
* set to the default value of 500.
|
|
|
|
*/
|
|
|
|
void (*float_ports)(ike_sa_t *this);
|
|
|
|
|
2007-06-26 13:04:13 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Update the IKE_SAs host.
|
2007-06-26 13:04:13 +00:00
|
|
|
*
|
|
|
|
* Hosts may be NULL to use current host.
|
|
|
|
*
|
|
|
|
* @param me new local host address, or NULL
|
|
|
|
* @param other new remote host address, or NULL
|
2011-01-12 12:54:46 +00:00
|
|
|
* @param force force update
|
2007-06-26 13:04:13 +00:00
|
|
|
*/
|
2011-01-12 12:54:46 +00:00
|
|
|
void (*update_hosts)(ike_sa_t *this, host_t *me, host_t *other, bool force);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2006-07-20 10:09:32 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Get the own identification.
|
2009-09-02 15:26:36 +00:00
|
|
|
*
|
2006-07-20 10:09:32 +00:00
|
|
|
* @return identification
|
|
|
|
*/
|
|
|
|
identification_t* (*get_my_id) (ike_sa_t *this);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2006-07-20 10:09:32 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Set the own identification.
|
2009-09-02 15:26:36 +00:00
|
|
|
*
|
2006-07-20 10:09:32 +00:00
|
|
|
* @param me identification
|
|
|
|
*/
|
|
|
|
void (*set_my_id) (ike_sa_t *this, identification_t *me);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2006-07-20 10:09:32 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Get the other peer's identification.
|
2009-09-02 15:26:36 +00:00
|
|
|
*
|
2006-07-20 10:09:32 +00:00
|
|
|
* @return identification
|
|
|
|
*/
|
|
|
|
identification_t* (*get_other_id) (ike_sa_t *this);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2010-03-24 13:23:56 +00:00
|
|
|
/**
|
|
|
|
* Get the others peer identity, but prefer an EAP-Identity.
|
|
|
|
*
|
|
|
|
* @return EAP or IKEv2 identity
|
|
|
|
*/
|
|
|
|
identification_t* (*get_other_eap_id)(ike_sa_t *this);
|
|
|
|
|
2006-07-20 10:09:32 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Set the other peer's identification.
|
2009-09-02 15:26:36 +00:00
|
|
|
*
|
2006-07-20 10:09:32 +00:00
|
|
|
* @param other identification
|
|
|
|
*/
|
|
|
|
void (*set_other_id) (ike_sa_t *this, identification_t *other);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2007-05-17 17:55:02 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Get the config used to setup this IKE_SA.
|
2009-09-02 15:26:36 +00:00
|
|
|
*
|
2007-04-10 06:01:03 +00:00
|
|
|
* @return ike_config
|
2007-02-28 14:04:36 +00:00
|
|
|
*/
|
2007-04-10 06:01:03 +00:00
|
|
|
ike_cfg_t* (*get_ike_cfg) (ike_sa_t *this);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2007-02-28 14:04:36 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Set the config to setup this IKE_SA.
|
2009-09-02 15:26:36 +00:00
|
|
|
*
|
2007-04-10 06:01:03 +00:00
|
|
|
* @param config ike_config to use
|
2007-02-28 14:04:36 +00:00
|
|
|
*/
|
2007-04-10 06:01:03 +00:00
|
|
|
void (*set_ike_cfg) (ike_sa_t *this, ike_cfg_t* config);
|
2007-02-28 14:04:36 +00:00
|
|
|
|
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Get the peer config used by this IKE_SA.
|
2009-09-02 15:26:36 +00:00
|
|
|
*
|
2007-04-10 06:01:03 +00:00
|
|
|
* @return peer_config
|
2007-02-28 14:04:36 +00:00
|
|
|
*/
|
2007-04-10 06:01:03 +00:00
|
|
|
peer_cfg_t* (*get_peer_cfg) (ike_sa_t *this);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2007-02-28 14:04:36 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Set the peer config to use with this IKE_SA.
|
2009-09-02 15:26:36 +00:00
|
|
|
*
|
2007-04-10 06:01:03 +00:00
|
|
|
* @param config peer_config to use
|
2007-02-28 14:04:36 +00:00
|
|
|
*/
|
2007-04-10 06:01:03 +00:00
|
|
|
void (*set_peer_cfg) (ike_sa_t *this, peer_cfg_t *config);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2007-06-18 10:32:01 +00:00
|
|
|
/**
|
2009-04-14 10:34:24 +00:00
|
|
|
* Get the authentication config with rules of the current auth round.
|
2008-03-13 14:14:44 +00:00
|
|
|
*
|
2009-04-14 10:34:24 +00:00
|
|
|
* @param local TRUE for local rules, FALSE for remote constraints
|
|
|
|
* @return current cfg
|
2008-03-13 14:14:44 +00:00
|
|
|
*/
|
2009-04-14 10:34:24 +00:00
|
|
|
auth_cfg_t* (*get_auth_cfg)(ike_sa_t *this, bool local);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2009-12-01 10:35:30 +00:00
|
|
|
/**
|
|
|
|
* Insert a completed authentication round.
|
|
|
|
*
|
|
|
|
* @param local TRUE for own rules, FALSE for others constraints
|
|
|
|
* @param cfg auth config to append
|
|
|
|
*/
|
|
|
|
void (*add_auth_cfg)(ike_sa_t *this, bool local, auth_cfg_t *cfg);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create an enumerator over added authentication rounds.
|
|
|
|
*
|
|
|
|
* @param local TRUE for own rules, FALSE for others constraints
|
|
|
|
* @return enumerator over auth_cfg_t
|
|
|
|
*/
|
|
|
|
enumerator_t* (*create_auth_cfg_enumerator)(ike_sa_t *this, bool local);
|
|
|
|
|
2008-10-30 12:58:54 +00:00
|
|
|
/**
|
|
|
|
* Get the selected proposal of this IKE_SA.
|
|
|
|
*
|
|
|
|
* @return selected proposal
|
|
|
|
*/
|
|
|
|
proposal_t* (*get_proposal)(ike_sa_t *this);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2008-10-30 12:58:54 +00:00
|
|
|
/**
|
|
|
|
* Set the proposal selected for this IKE_SA.
|
|
|
|
*
|
|
|
|
* @param selected proposal
|
|
|
|
*/
|
|
|
|
void (*set_proposal)(ike_sa_t *this, proposal_t *proposal);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2008-11-24 12:46:06 +00:00
|
|
|
/**
|
|
|
|
* Set the message id of the IKE_SA.
|
|
|
|
*
|
|
|
|
* The IKE_SA stores two message IDs, one for initiating exchanges (send)
|
|
|
|
* and one to respond to exchanges (expect).
|
|
|
|
*
|
|
|
|
* @param initiate TRUE to set message ID for initiating
|
|
|
|
* @param mid message id to set
|
|
|
|
*/
|
|
|
|
void (*set_message_id)(ike_sa_t *this, bool initiate, u_int32_t mid);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2008-03-13 14:14:44 +00:00
|
|
|
/**
|
|
|
|
* Add an additional address for the peer.
|
2007-06-21 15:25:28 +00:00
|
|
|
*
|
|
|
|
* In MOBIKE, a peer may transmit additional addresses where it is
|
|
|
|
* reachable. These are stored in the IKE_SA.
|
|
|
|
* The own list of addresses is not stored, they are queried from
|
|
|
|
* the kernel when required.
|
2007-06-18 10:32:01 +00:00
|
|
|
*
|
2007-06-21 15:25:28 +00:00
|
|
|
* @param host host to add to list
|
2007-06-18 10:32:01 +00:00
|
|
|
*/
|
2007-06-21 15:25:28 +00:00
|
|
|
void (*add_additional_address)(ike_sa_t *this, host_t *host);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2007-06-21 15:25:28 +00:00
|
|
|
/**
|
2011-05-19 16:05:53 +00:00
|
|
|
* Create an enumerator over all additional addresses of the peer.
|
2007-06-21 15:25:28 +00:00
|
|
|
*
|
2011-05-19 16:05:53 +00:00
|
|
|
* @return enumerator over addresses
|
2007-06-21 15:25:28 +00:00
|
|
|
*/
|
2011-05-19 16:05:53 +00:00
|
|
|
enumerator_t* (*create_additional_address_enumerator)(ike_sa_t *this);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove all additional addresses of the peer.
|
|
|
|
*/
|
|
|
|
void (*remove_additional_addresses)(ike_sa_t *this);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2008-10-06 13:37:04 +00:00
|
|
|
/**
|
|
|
|
* Check if mappings have changed on a NAT for our source address.
|
|
|
|
*
|
|
|
|
* @param hash received DESTINATION_IP hash
|
|
|
|
* @return TRUE if mappings have changed
|
|
|
|
*/
|
|
|
|
bool (*has_mapping_changed)(ike_sa_t *this, chunk_t hash);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2007-06-18 10:32:01 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Enable an extension the peer supports.
|
2007-06-18 10:32:01 +00:00
|
|
|
*
|
|
|
|
* If support for an IKE extension is detected, this method is called
|
|
|
|
* to enable that extension and behave accordingly.
|
|
|
|
*
|
|
|
|
* @param extension extension to enable
|
|
|
|
*/
|
|
|
|
void (*enable_extension)(ike_sa_t *this, ike_extension_t extension);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2007-06-21 15:25:28 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Check if the peer supports an extension.
|
2007-06-21 15:25:28 +00:00
|
|
|
*
|
|
|
|
* @param extension extension to check for support
|
|
|
|
* @return TRUE if peer supports it, FALSE otherwise
|
|
|
|
*/
|
|
|
|
bool (*supports_extension)(ike_sa_t *this, ike_extension_t extension);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2007-06-21 15:25:28 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Enable/disable a condition flag for this IKE_SA.
|
2007-06-21 15:25:28 +00:00
|
|
|
*
|
|
|
|
* @param condition condition to enable/disable
|
|
|
|
* @param enable TRUE to enable condition, FALSE to disable
|
|
|
|
*/
|
|
|
|
void (*set_condition) (ike_sa_t *this, ike_condition_t condition, bool enable);
|
|
|
|
|
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Check if a condition flag is set.
|
2007-06-21 15:25:28 +00:00
|
|
|
*
|
|
|
|
* @param condition condition to check
|
|
|
|
* @return TRUE if condition flag set, FALSE otherwise
|
|
|
|
*/
|
|
|
|
bool (*has_condition) (ike_sa_t *this, ike_condition_t condition);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2007-07-03 12:32:38 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Get the number of queued MOBIKE address updates.
|
2007-07-03 12:32:38 +00:00
|
|
|
*
|
|
|
|
* @return number of pending updates
|
|
|
|
*/
|
|
|
|
u_int32_t (*get_pending_updates)(ike_sa_t *this);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2007-07-03 12:32:38 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Set the number of queued MOBIKE address updates.
|
2007-07-03 12:32:38 +00:00
|
|
|
*
|
|
|
|
* @param updates number of pending updates
|
|
|
|
*/
|
|
|
|
void (*set_pending_updates)(ike_sa_t *this, u_int32_t updates);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2008-03-26 18:40:19 +00:00
|
|
|
#ifdef ME
|
2008-04-09 18:12:22 +00:00
|
|
|
/**
|
|
|
|
* Activate mediation server functionality for this IKE_SA.
|
|
|
|
*/
|
|
|
|
void (*act_as_mediation_server) (ike_sa_t *this);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2007-10-03 15:10:41 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Get the server reflexive host.
|
2009-09-02 15:26:36 +00:00
|
|
|
*
|
2007-10-03 15:10:41 +00:00
|
|
|
* @return server reflexive host
|
|
|
|
*/
|
|
|
|
host_t* (*get_server_reflexive_host) (ike_sa_t *this);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2007-10-03 15:10:41 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Set the server reflexive host.
|
2009-09-02 15:26:36 +00:00
|
|
|
*
|
2007-10-03 15:10:41 +00:00
|
|
|
* @param host server reflexive host
|
|
|
|
*/
|
|
|
|
void (*set_server_reflexive_host) (ike_sa_t *this, host_t *host);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2008-04-01 11:38:18 +00:00
|
|
|
/**
|
|
|
|
* Get the connect ID.
|
2009-09-02 15:26:36 +00:00
|
|
|
*
|
2008-04-01 11:38:18 +00:00
|
|
|
* @return connect ID
|
|
|
|
*/
|
|
|
|
chunk_t (*get_connect_id) (ike_sa_t *this);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2007-10-03 15:10:41 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Initiate the mediation of a mediated connection (i.e. initiate a
|
2009-09-02 15:26:36 +00:00
|
|
|
* ME_CONNECT exchange to a mediation server).
|
|
|
|
*
|
|
|
|
* @param mediated_cfg peer_cfg of the mediated connection
|
|
|
|
* @return
|
2011-05-19 15:27:32 +00:00
|
|
|
* - SUCCESS if initialization started
|
|
|
|
* - DESTROY_ME if initialization failed
|
2007-10-03 15:10:41 +00:00
|
|
|
*/
|
|
|
|
status_t (*initiate_mediation) (ike_sa_t *this, peer_cfg_t *mediated_cfg);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2007-10-03 15:10:41 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Initiate the mediated connection
|
2009-09-02 15:26:36 +00:00
|
|
|
*
|
|
|
|
* @param me local endpoint (gets cloned)
|
|
|
|
* @param other remote endpoint (gets cloned)
|
|
|
|
* @param connect_id connect ID (gets cloned)
|
|
|
|
* @return
|
2011-05-19 15:27:32 +00:00
|
|
|
* - SUCCESS if initialization started
|
|
|
|
* - DESTROY_ME if initialization failed
|
2007-10-03 15:10:41 +00:00
|
|
|
*/
|
|
|
|
status_t (*initiate_mediated) (ike_sa_t *this, host_t *me, host_t *other,
|
2009-09-02 15:26:36 +00:00
|
|
|
chunk_t connect_id);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2007-10-03 15:10:41 +00:00
|
|
|
/**
|
2009-09-02 15:26:36 +00:00
|
|
|
* Relay data from one peer to another (i.e. initiate a ME_CONNECT exchange
|
|
|
|
* to a peer).
|
2007-10-03 15:10:41 +00:00
|
|
|
*
|
|
|
|
* Data is cloned.
|
2009-09-02 15:26:36 +00:00
|
|
|
*
|
|
|
|
* @param requester ID of the requesting peer
|
|
|
|
* @param connect_id data of the ME_CONNECTID payload
|
|
|
|
* @param connect_key data of the ME_CONNECTKEY payload
|
|
|
|
* @param endpoints endpoints
|
|
|
|
* @param response TRUE if this is a response
|
|
|
|
* @return
|
2011-05-19 15:27:32 +00:00
|
|
|
* - SUCCESS if relay started
|
|
|
|
* - DESTROY_ME if relay failed
|
2007-10-03 15:10:41 +00:00
|
|
|
*/
|
2009-09-02 15:26:36 +00:00
|
|
|
status_t (*relay) (ike_sa_t *this, identification_t *requester,
|
|
|
|
chunk_t connect_id, chunk_t connect_key,
|
|
|
|
linked_list_t *endpoints, bool response);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2007-10-03 15:10:41 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Send a callback to a peer.
|
2009-09-02 15:26:36 +00:00
|
|
|
*
|
2007-10-03 15:10:41 +00:00
|
|
|
* Data is cloned.
|
2009-09-02 15:26:36 +00:00
|
|
|
*
|
|
|
|
* @param peer_id ID of the other peer
|
2007-10-03 15:10:41 +00:00
|
|
|
* @return
|
2011-05-19 15:27:32 +00:00
|
|
|
* - SUCCESS if response started
|
|
|
|
* - DESTROY_ME if response failed
|
2007-10-03 15:10:41 +00:00
|
|
|
*/
|
|
|
|
status_t (*callback) (ike_sa_t *this, identification_t *peer_id);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2007-10-03 15:10:41 +00:00
|
|
|
/**
|
2008-03-26 18:40:19 +00:00
|
|
|
* Respond to a ME_CONNECT request.
|
2009-09-02 15:26:36 +00:00
|
|
|
*
|
2007-10-03 15:10:41 +00:00
|
|
|
* Data is cloned.
|
2009-09-02 15:26:36 +00:00
|
|
|
*
|
|
|
|
* @param peer_id ID of the other peer
|
|
|
|
* @param connect_id the connect ID supplied by the initiator
|
2007-10-03 15:10:41 +00:00
|
|
|
* @return
|
2011-05-19 15:27:32 +00:00
|
|
|
* - SUCCESS if response started
|
|
|
|
* - DESTROY_ME if response failed
|
2007-10-03 15:10:41 +00:00
|
|
|
*/
|
2009-09-02 15:26:36 +00:00
|
|
|
status_t (*respond) (ike_sa_t *this, identification_t *peer_id,
|
|
|
|
chunk_t connect_id);
|
2008-03-26 18:40:19 +00:00
|
|
|
#endif /* ME */
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2005-11-22 15:40:11 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Initiate a new connection.
|
2006-07-05 10:53:20 +00:00
|
|
|
*
|
2009-05-20 09:44:43 +00:00
|
|
|
* The configs are owned by the IKE_SA after the call. If the initiate
|
|
|
|
* is triggered by a packet, traffic selectors of the packet can be added
|
|
|
|
* to the CHILD_SA.
|
2009-09-02 15:26:36 +00:00
|
|
|
*
|
2007-04-10 06:01:03 +00:00
|
|
|
* @param child_cfg child config to create CHILD from
|
2009-05-08 07:59:53 +00:00
|
|
|
* @param reqid reqid to use for CHILD_SA, 0 assigne uniquely
|
2009-05-20 09:44:43 +00:00
|
|
|
* @param tsi source of triggering packet
|
|
|
|
* @param tsr destination of triggering packet.
|
2009-09-02 15:26:36 +00:00
|
|
|
* @return
|
2011-05-19 15:27:32 +00:00
|
|
|
* - SUCCESS if initialization started
|
|
|
|
* - DESTROY_ME if initialization failed
|
2006-07-20 10:09:32 +00:00
|
|
|
*/
|
2009-05-08 07:59:53 +00:00
|
|
|
status_t (*initiate) (ike_sa_t *this, child_cfg_t *child_cfg,
|
2009-05-20 09:44:43 +00:00
|
|
|
u_int32_t reqid, traffic_selector_t *tsi,
|
|
|
|
traffic_selector_t *tsr);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2006-06-22 06:36:28 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Initiates the deletion of an IKE_SA.
|
2009-09-02 15:26:36 +00:00
|
|
|
*
|
2006-07-05 10:53:20 +00:00
|
|
|
* Sends a delete message to the remote peer and waits for
|
|
|
|
* its response. If the response comes in, or a timeout occurs,
|
|
|
|
* the IKE SA gets deleted.
|
2009-09-02 15:26:36 +00:00
|
|
|
*
|
2006-06-22 06:36:28 +00:00
|
|
|
* @return
|
2011-05-19 15:27:32 +00:00
|
|
|
* - SUCCESS if deletion is initialized
|
|
|
|
* - DESTROY_ME, if the IKE_SA is not in
|
|
|
|
* an established state and can not be
|
|
|
|
* deleted (but destroyed).
|
2006-06-22 06:36:28 +00:00
|
|
|
*/
|
2006-07-05 10:53:20 +00:00
|
|
|
status_t (*delete) (ike_sa_t *this);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2007-06-21 15:25:28 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Update IKE_SAs after network interfaces have changed.
|
2007-06-21 15:25:28 +00:00
|
|
|
*
|
|
|
|
* Whenever the network interface configuration changes, the kernel
|
|
|
|
* interface calls roam() on each IKE_SA. The IKE_SA then checks if
|
|
|
|
* the new network config requires changes, and handles appropriate.
|
|
|
|
* If MOBIKE is supported, addresses are updated; If not, the tunnel is
|
|
|
|
* restarted.
|
|
|
|
*
|
2007-07-03 12:32:38 +00:00
|
|
|
* @param address TRUE if address list changed, FALSE otherwise
|
|
|
|
* @return SUCCESS, FAILED, DESTROY_ME
|
2007-06-21 15:25:28 +00:00
|
|
|
*/
|
2007-07-03 12:32:38 +00:00
|
|
|
status_t (*roam)(ike_sa_t *this, bool address);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2006-04-25 10:06:30 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Processes a incoming IKEv2-Message.
|
2006-04-25 10:06:30 +00:00
|
|
|
*
|
2009-09-02 15:26:36 +00:00
|
|
|
* Message processing may fail. If a critical failure occurs,
|
|
|
|
* process_message() return DESTROY_ME. Then the caller must
|
2011-07-20 13:57:53 +00:00
|
|
|
* destroy the IKE_SA immediately, as it is unusable.
|
2009-09-02 15:26:36 +00:00
|
|
|
*
|
2011-05-19 15:27:32 +00:00
|
|
|
* @param message message to process
|
2009-09-02 15:26:36 +00:00
|
|
|
* @return
|
2011-05-19 15:27:32 +00:00
|
|
|
* - SUCCESS
|
|
|
|
* - FAILED
|
|
|
|
* - DESTROY_ME if this IKE_SA MUST be deleted
|
2006-04-27 07:24:04 +00:00
|
|
|
*/
|
2006-07-07 07:04:07 +00:00
|
|
|
status_t (*process_message) (ike_sa_t *this, message_t *message);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2006-07-13 08:26:54 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Generate a IKE message to send it to the peer.
|
2009-09-02 15:26:36 +00:00
|
|
|
*
|
2007-02-28 14:04:36 +00:00
|
|
|
* This method generates all payloads in the message and encrypts/signs
|
|
|
|
* the packet.
|
2009-09-02 15:26:36 +00:00
|
|
|
*
|
2011-05-19 15:27:32 +00:00
|
|
|
* @param message message to generate
|
2007-02-28 14:04:36 +00:00
|
|
|
* @param packet generated output packet
|
2009-09-02 15:26:36 +00:00
|
|
|
* @return
|
2011-05-19 15:27:32 +00:00
|
|
|
* - SUCCESS
|
|
|
|
* - FAILED
|
|
|
|
* - DESTROY_ME if this IKE_SA MUST be deleted
|
2006-07-13 08:26:54 +00:00
|
|
|
*/
|
2007-02-28 14:04:36 +00:00
|
|
|
status_t (*generate_message) (ike_sa_t *this, message_t *message,
|
|
|
|
packet_t **packet);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2006-06-22 06:36:28 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Retransmits a request.
|
2009-09-02 15:26:36 +00:00
|
|
|
*
|
2007-02-28 14:04:36 +00:00
|
|
|
* @param message_id ID of the request to retransmit
|
|
|
|
* @return
|
2011-05-19 15:27:32 +00:00
|
|
|
* - SUCCESS
|
|
|
|
* - NOT_FOUND if request doesn't have to be retransmited
|
2006-09-25 06:38:58 +00:00
|
|
|
*/
|
2007-02-28 14:04:36 +00:00
|
|
|
status_t (*retransmit) (ike_sa_t *this, u_int32_t message_id);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2006-06-22 06:36:28 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Sends a DPD request to the peer.
|
2006-06-22 06:36:28 +00:00
|
|
|
*
|
2006-07-05 10:53:20 +00:00
|
|
|
* To check if a peer is still alive, periodic
|
|
|
|
* empty INFORMATIONAL messages are sent if no
|
|
|
|
* other traffic was received.
|
2009-09-02 15:26:36 +00:00
|
|
|
*
|
2006-07-05 10:53:20 +00:00
|
|
|
* @return
|
2011-05-19 15:27:32 +00:00
|
|
|
* - SUCCESS
|
|
|
|
* - DESTROY_ME, if peer did not respond
|
2006-06-23 14:02:30 +00:00
|
|
|
*/
|
2006-07-05 10:53:20 +00:00
|
|
|
status_t (*send_dpd) (ike_sa_t *this);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2006-06-23 14:02:30 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Sends a keep alive packet.
|
2006-06-23 14:02:30 +00:00
|
|
|
*
|
2006-07-05 10:53:20 +00:00
|
|
|
* To refresh NAT tables in a NAT router
|
|
|
|
* between the peers, periodic empty
|
|
|
|
* UDP packets are sent if no other traffic
|
|
|
|
* was sent.
|
2006-06-22 06:36:28 +00:00
|
|
|
*/
|
2006-07-05 10:53:20 +00:00
|
|
|
void (*send_keepalive) (ike_sa_t *this);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2008-06-22 11:24:33 +00:00
|
|
|
/**
|
2008-10-28 16:07:06 +00:00
|
|
|
* Get the keying material of this IKE_SA.
|
2008-06-22 11:24:33 +00:00
|
|
|
*
|
2008-10-28 16:07:06 +00:00
|
|
|
* @return per IKE_SA keymat instance
|
2006-06-09 15:12:43 +00:00
|
|
|
*/
|
2008-10-28 16:07:06 +00:00
|
|
|
keymat_t* (*get_keymat)(ike_sa_t *this);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2006-06-09 15:12:43 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Associates a child SA to this IKE SA
|
2009-09-02 15:26:36 +00:00
|
|
|
*
|
2006-07-07 07:04:07 +00:00
|
|
|
* @param child_sa child_sa to add
|
2006-06-09 15:12:43 +00:00
|
|
|
*/
|
2006-07-07 07:04:07 +00:00
|
|
|
void (*add_child_sa) (ike_sa_t *this, child_sa_t *child_sa);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2006-07-03 06:27:45 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Get a CHILD_SA identified by protocol and SPI.
|
2009-09-02 15:26:36 +00:00
|
|
|
*
|
2006-07-07 07:04:07 +00:00
|
|
|
* @param protocol protocol of the SA
|
|
|
|
* @param spi SPI of the CHILD_SA
|
|
|
|
* @param inbound TRUE if SPI is inbound, FALSE if outbound
|
|
|
|
* @return child_sa, or NULL if none found
|
2006-07-05 10:53:20 +00:00
|
|
|
*/
|
2009-09-02 15:26:36 +00:00
|
|
|
child_sa_t* (*get_child_sa) (ike_sa_t *this, protocol_id_t protocol,
|
2006-07-07 07:04:07 +00:00
|
|
|
u_int32_t spi, bool inbound);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2006-08-23 07:30:43 +00:00
|
|
|
/**
|
2011-05-19 15:27:32 +00:00
|
|
|
* Get the number of CHILD_SAs.
|
2009-09-02 15:26:36 +00:00
|
|
|
*
|
2011-05-19 15:27:32 +00:00
|
|
|
* @return number of CHILD_SAs
|
2006-08-23 07:30:43 +00:00
|
|
|
*/
|
2011-05-19 15:27:32 +00:00
|
|
|
int (*get_child_count) (ike_sa_t *this);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create an enumerator over all CHILD_SAs.
|
|
|
|
*
|
|
|
|
* @return enumerator
|
|
|
|
*/
|
|
|
|
enumerator_t* (*create_child_sa_enumerator) (ike_sa_t *this);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove the CHILD_SA the given enumerator points to from this IKE_SA.
|
|
|
|
*
|
|
|
|
* @param enumerator enumerator pointing to CHILD_SA
|
|
|
|
*/
|
|
|
|
void (*remove_child_sa) (ike_sa_t *this, enumerator_t *enumerator);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2006-06-22 06:36:28 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Rekey the CHILD SA with the specified reqid.
|
2006-06-22 06:36:28 +00:00
|
|
|
*
|
2006-07-05 10:53:20 +00:00
|
|
|
* Looks for a CHILD SA owned by this IKE_SA, and start the rekeing.
|
2006-06-22 06:36:28 +00:00
|
|
|
*
|
2006-07-07 07:04:07 +00:00
|
|
|
* @param protocol protocol of the SA
|
|
|
|
* @param spi inbound SPI of the CHILD_SA
|
2006-07-05 10:53:20 +00:00
|
|
|
* @return
|
2011-05-19 15:27:32 +00:00
|
|
|
* - NOT_FOUND, if IKE_SA has no such CHILD_SA
|
|
|
|
* - SUCCESS, if rekeying initiated
|
2006-06-22 06:36:28 +00:00
|
|
|
*/
|
2006-07-07 07:04:07 +00:00
|
|
|
status_t (*rekey_child_sa) (ike_sa_t *this, protocol_id_t protocol, u_int32_t spi);
|
|
|
|
|
2006-06-22 06:36:28 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Close the CHILD SA with the specified protocol/SPI.
|
2006-07-07 07:04:07 +00:00
|
|
|
*
|
|
|
|
* Looks for a CHILD SA owned by this IKE_SA, deletes it and
|
|
|
|
* notify's the remote peer about the delete. The associated
|
|
|
|
* states and policies in the kernel get deleted, if they exist.
|
|
|
|
*
|
|
|
|
* @param protocol protocol of the SA
|
|
|
|
* @param spi inbound SPI of the CHILD_SA
|
|
|
|
* @return
|
2011-05-19 15:27:32 +00:00
|
|
|
* - NOT_FOUND, if IKE_SA has no such CHILD_SA
|
|
|
|
* - SUCCESS, if delete message sent
|
2006-06-22 06:36:28 +00:00
|
|
|
*/
|
2006-07-07 07:04:07 +00:00
|
|
|
status_t (*delete_child_sa) (ike_sa_t *this, protocol_id_t protocol, u_int32_t spi);
|
|
|
|
|
2006-06-22 06:36:28 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Destroy a CHILD SA with the specified protocol/SPI.
|
2006-07-07 07:04:07 +00:00
|
|
|
*
|
|
|
|
* Looks for a CHILD SA owned by this IKE_SA and destroys it.
|
|
|
|
*
|
|
|
|
* @param protocol protocol of the SA
|
|
|
|
* @param spi inbound SPI of the CHILD_SA
|
|
|
|
* @return
|
2011-05-19 15:27:32 +00:00
|
|
|
* - NOT_FOUND, if IKE_SA has no such CHILD_SA
|
|
|
|
* - SUCCESS
|
2006-06-22 06:36:28 +00:00
|
|
|
*/
|
2006-07-07 07:04:07 +00:00
|
|
|
status_t (*destroy_child_sa) (ike_sa_t *this, protocol_id_t protocol, u_int32_t spi);
|
2006-07-27 12:18:40 +00:00
|
|
|
|
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Rekey the IKE_SA.
|
2006-07-27 12:18:40 +00:00
|
|
|
*
|
|
|
|
* Sets up a new IKE_SA, moves all CHILDs to it and deletes this IKE_SA.
|
|
|
|
*
|
|
|
|
* @return - SUCCESS, if IKE_SA rekeying initiated
|
|
|
|
*/
|
|
|
|
status_t (*rekey) (ike_sa_t *this);
|
|
|
|
|
2006-12-19 07:30:07 +00:00
|
|
|
/**
|
2008-04-11 08:14:48 +00:00
|
|
|
* Reauthenticate the IKE_SA.
|
2006-12-19 07:30:07 +00:00
|
|
|
*
|
|
|
|
* Create a completely new IKE_SA with authentication, recreates all children
|
2007-06-14 08:13:05 +00:00
|
|
|
* within the IKE_SA, closes this IKE_SA.
|
2006-12-19 07:30:07 +00:00
|
|
|
*
|
2007-06-14 08:13:05 +00:00
|
|
|
* @return DESTROY_ME to destroy the IKE_SA
|
2006-12-19 07:30:07 +00:00
|
|
|
*/
|
2008-04-11 08:14:48 +00:00
|
|
|
status_t (*reauth) (ike_sa_t *this);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Restablish the IKE_SA.
|
|
|
|
*
|
|
|
|
* Reestablish an IKE_SA after it has been closed.
|
|
|
|
*
|
|
|
|
* @return DESTROY_ME to destroy the IKE_SA
|
|
|
|
*/
|
2007-06-14 08:13:05 +00:00
|
|
|
status_t (*reestablish) (ike_sa_t *this);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2007-11-20 12:06:40 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Set the lifetime limit received from a AUTH_LIFETIME notify.
|
2007-11-20 12:06:40 +00:00
|
|
|
*
|
|
|
|
* @param lifetime lifetime in seconds
|
|
|
|
*/
|
|
|
|
void (*set_auth_lifetime)(ike_sa_t *this, u_int32_t lifetime);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2006-08-23 07:30:43 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Set the virtual IP to use for this IKE_SA and its children.
|
2007-02-28 14:04:36 +00:00
|
|
|
*
|
|
|
|
* The virtual IP is assigned per IKE_SA, not per CHILD_SA. It has the same
|
|
|
|
* lifetime as the IKE_SA.
|
2006-08-23 07:30:43 +00:00
|
|
|
*
|
2008-03-13 14:14:44 +00:00
|
|
|
* @param local TRUE to set local address, FALSE for remote
|
|
|
|
* @param ip IP to set as virtual IP
|
2006-08-23 07:30:43 +00:00
|
|
|
*/
|
2007-02-28 14:04:36 +00:00
|
|
|
void (*set_virtual_ip) (ike_sa_t *this, bool local, host_t *ip);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2006-08-23 07:30:43 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Get the virtual IP configured.
|
2006-08-23 07:30:43 +00:00
|
|
|
*
|
2007-02-28 14:04:36 +00:00
|
|
|
* @param local TRUE to get local virtual IP, FALSE for remote
|
2008-03-13 14:14:44 +00:00
|
|
|
* @return host_t *virtual IP
|
2006-08-23 07:30:43 +00:00
|
|
|
*/
|
2007-02-28 14:04:36 +00:00
|
|
|
host_t* (*get_virtual_ip) (ike_sa_t *this, bool local);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2007-02-28 14:04:36 +00:00
|
|
|
/**
|
2009-04-24 14:13:52 +00:00
|
|
|
* Register a configuration attribute to the IKE_SA.
|
2007-02-28 14:04:36 +00:00
|
|
|
*
|
2009-04-24 14:13:52 +00:00
|
|
|
* If an IRAS sends a configuration attribute it is installed and
|
|
|
|
* registered at the IKE_SA. Attributes are inherit()ed and get released
|
|
|
|
* when the IKE_SA is closed.
|
2007-02-28 14:04:36 +00:00
|
|
|
*
|
2009-04-24 14:13:52 +00:00
|
|
|
* @param handler handler installed the attribute, use for release()
|
|
|
|
* @param type configuration attribute type
|
|
|
|
* @param data associated attribute data
|
2007-02-28 14:04:36 +00:00
|
|
|
*/
|
2009-04-24 14:13:52 +00:00
|
|
|
void (*add_configuration_attribute)(ike_sa_t *this,
|
2009-11-17 13:51:50 +00:00
|
|
|
attribute_handler_t *handler,
|
2009-04-24 14:13:52 +00:00
|
|
|
configuration_attribute_type_t type, chunk_t data);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2008-11-11 06:37:37 +00:00
|
|
|
/**
|
|
|
|
* Set local and remote host addresses to be used for IKE.
|
|
|
|
*
|
|
|
|
* These addresses are communicated via the KMADDRESS field of a MIGRATE
|
|
|
|
* message sent via the NETLINK or PF _KEY kernel socket interface.
|
|
|
|
*
|
|
|
|
* @param local local kmaddress
|
|
|
|
* @param remote remote kmaddress
|
|
|
|
*/
|
|
|
|
void (*set_kmaddress) (ike_sa_t *this, host_t *local, host_t *remote);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2010-06-07 09:37:55 +00:00
|
|
|
/**
|
|
|
|
* Create enumerator over a task queue of this IKE_SA.
|
|
|
|
*
|
|
|
|
* @param queue type to enumerate
|
|
|
|
* @return enumerator over task_t
|
|
|
|
*/
|
|
|
|
enumerator_t* (*create_task_enumerator)(ike_sa_t *this, task_queue_t queue);
|
|
|
|
|
2006-07-27 12:18:40 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Inherit all attributes of other to this after rekeying.
|
2006-07-27 12:18:40 +00:00
|
|
|
*
|
2007-02-28 14:04:36 +00:00
|
|
|
* When rekeying is completed, all CHILD_SAs, the virtual IP and all
|
|
|
|
* outstanding tasks are moved from other to this.
|
2007-03-27 13:32:12 +00:00
|
|
|
* As this call may initiate inherited tasks, a status is returned.
|
2007-02-28 14:04:36 +00:00
|
|
|
*
|
2007-03-27 13:32:12 +00:00
|
|
|
* @param other other task to inherit from
|
2007-02-28 14:04:36 +00:00
|
|
|
*/
|
2011-03-15 14:20:09 +00:00
|
|
|
void (*inherit) (ike_sa_t *this, ike_sa_t *other);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2007-02-28 14:04:36 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Reset the IKE_SA, useable when initiating fails
|
2006-07-27 12:18:40 +00:00
|
|
|
*/
|
2007-02-28 14:04:36 +00:00
|
|
|
void (*reset) (ike_sa_t *this);
|
2009-09-04 11:46:09 +00:00
|
|
|
|
2006-06-22 06:36:28 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Destroys a ike_sa_t object.
|
2006-06-22 06:36:28 +00:00
|
|
|
*/
|
2006-07-05 10:53:20 +00:00
|
|
|
void (*destroy) (ike_sa_t *this);
|
2005-11-21 16:41:24 +00:00
|
|
|
};
|
|
|
|
|
2005-11-08 13:33:28 +00:00
|
|
|
/**
|
2008-03-13 14:14:44 +00:00
|
|
|
* Creates an ike_sa_t object with a specific ID.
|
2005-11-10 09:35:28 +00:00
|
|
|
*
|
2011-05-19 15:27:32 +00:00
|
|
|
* @param ike_sa_id ike_sa_id_t object to associate with new IKE_SA
|
|
|
|
* @return ike_sa_t object
|
2005-11-08 13:33:28 +00:00
|
|
|
*/
|
2006-07-05 10:53:20 +00:00
|
|
|
ike_sa_t *ike_sa_create(ike_sa_id_t *ike_sa_id);
|
2005-11-08 13:33:28 +00:00
|
|
|
|
2009-03-24 17:43:01 +00:00
|
|
|
#endif /** IKE_SA_H_ @}*/
|