further MOBIKE stuff:

kernel properly reports network reconfiguration and informs all IKE_SAs
  MOBIKE in IKE_AUTH: MOBIKE_SUPPORTED notify and address exchange
  reestablishment of IKE_SAs on network reconfiguration kinda works
  not stable yet!
This commit is contained in:
Martin Willi
2007-06-21 15:25:28 +00:00
parent c25ef47702
commit 17d92e9732
22 changed files with 1131 additions and 372 deletions
+86 -29
View File
@@ -26,6 +26,7 @@
#define IKE_SA_H_
typedef enum ike_extension_t ike_extension_t;
typedef enum ike_condition_t ike_condition_t;
typedef enum ike_sa_state_t ike_sa_state_t;
typedef struct ike_sa_t ike_sa_t;
@@ -79,12 +80,38 @@ enum ike_extension_t {
/**
* peer supports NAT traversal as specified in RFC4306
*/
EXT_NATT,
EXT_NATT = (1<<0),
/**
* peer supports MOBIKE (RFC4555)
*/
EXT_MOBIKE,
EXT_MOBIKE = (1<<1),
};
/**
* @brief Conditions of an IKE_SA, change during its lifetime
*/
enum ike_condition_t {
/**
* Connection is natted somewhere
*/
COND_NAT_ANY = (1<<0),
/**
* we are behind NAT
*/
COND_NAT_HERE = (1<<1),
/**
* other is behind NAT
*/
COND_NAT_THERE = (1<<2),
/**
* peer is currently not reachable (due missing route, ...)
*/
COND_STALE = (1<<3),
};
/**
@@ -336,13 +363,25 @@ struct ike_sa_t {
void (*set_peer_cfg) (ike_sa_t *this, peer_cfg_t *config);
/**
* @brief Check if the peer supports an extension.
* @brief Add an additional address for the peer.
*
* 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.
*
* @param this calling object
* @param extension extension to check for support
* @return TRUE if peer supports it, FALSE otherwise
* @param host host to add to list
*/
bool (*supports_extension)(ike_sa_t *this, ike_extension_t extension);
void (*add_additional_address)(ike_sa_t *this, host_t *host);
/**
* @brief Create an iterator over all additional addresses of the peer.
*
* @param this calling object
* @return iterator over addresses
*/
iterator_t* (*create_additional_address_iterator)(ike_sa_t *this);
/**
* @brief Enable an extension the peer supports.
@@ -355,6 +394,33 @@ struct ike_sa_t {
*/
void (*enable_extension)(ike_sa_t *this, ike_extension_t extension);
/**
* @brief Check if the peer supports an extension.
*
* @param this calling object
* @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);
/**
* @brief Enable/disable a condition flag for this IKE_SA.
*
* @param this calling object
* @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);
/**
* @brief Check if a condition flag is set.
*
* @param this calling object
* @param condition condition to check
* @return TRUE if condition flag set, FALSE otherwise
*/
bool (*has_condition) (ike_sa_t *this, ike_condition_t condition);
/**
* @brief Initiate a new connection.
*
@@ -424,6 +490,20 @@ struct ike_sa_t {
*/
status_t (*delete) (ike_sa_t *this);
/**
* @brief Update IKE_SAs after network interfaces have changed.
*
* 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.
*
* @param
* @return
*/
status_t (*roam)(ike_sa_t *this);
/**
* @brief Processes a incoming IKEv2-Message.
*
@@ -493,29 +573,6 @@ struct ike_sa_t {
* @param this calling object
*/
void (*send_keepalive) (ike_sa_t *this);
/**
* @brief Check if NAT traversal is enabled for this IKE_SA.
*
* @param this calling object
* @return TRUE if NAT traversal enabled
*/
bool (*is_natt_enabled) (ike_sa_t *this);
/**
* @brief Enable NAT detection for this IKE_SA.
*
* If a Network address translation is detected with
* NAT_DETECTION notifys, a SA must switch to ports
* 4500. To enable this behavior, call enable_natt().
* It is relevant which peer is NATted, this is specified
* with the "local" parameter. Call it twice when both
* are NATted.
*
* @param this calling object
* @param local TRUE, if we are NATted, FALSE if other
*/
void (*enable_natt) (ike_sa_t *this, bool local);
/**
* @brief Derive all keys and create the transforms for IKE communication.