--- embedaddon/strongswan/src/libcharon/sa/ike_sa.h 2020/06/03 09:46:45 1.1.1.1 +++ embedaddon/strongswan/src/libcharon/sa/ike_sa.h 2021/03/17 00:20:09 1.1.1.2 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006-2019 Tobias Brunner + * Copyright (C) 2006-2020 Tobias Brunner * Copyright (C) 2006 Daniel Roethlisberger * Copyright (C) 2005-2009 Martin Willi * Copyright (C) 2005 Jan Hutter @@ -28,6 +28,7 @@ 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 enum statistic_t statistic_t; +typedef enum update_hosts_flag_t update_hosts_flag_t; typedef struct ike_sa_t ike_sa_t; #include @@ -265,6 +266,25 @@ enum statistic_t { }; /** + * Flags used when updating addresses + */ +enum update_hosts_flag_t { + /** Force updating the local address (otherwise not updated if an address + * is already set). */ + UPDATE_HOSTS_FORCE_LOCAL = (1<<0), + /** Force updating the remote address (otherwise only updated if peer is + * behind a NAT). */ + UPDATE_HOSTS_FORCE_REMOTE = (1<<1), + /** Force updating both addresses. */ + UPDATE_HOSTS_FORCE_ADDRS = UPDATE_HOSTS_FORCE_LOCAL|UPDATE_HOSTS_FORCE_REMOTE, + /** Force updating the CHILD_SAs even if no addresses changed, useful if + * NAT state may have changed. */ + UPDATE_HOSTS_FORCE_CHILDREN = (1<<2), + /** Force updating everything. */ + UPDATE_HOSTS_FORCE_ALL = UPDATE_HOSTS_FORCE_ADDRS|UPDATE_HOSTS_FORCE_CHILDREN, +}; + +/** * State of an IKE_SA. * * An IKE_SA passes various states in its lifetime. A newly created @@ -454,15 +474,16 @@ struct ike_sa_t { void (*float_ports)(ike_sa_t *this); /** - * Update the IKE_SAs host. + * Update the IKE_SAs host and CHILD_SAs. * * Hosts may be NULL to use current host. * * @param me new local host address, or NULL * @param other new remote host address, or NULL - * @param force force update + * @param flags flags to force certain updates */ - void (*update_hosts)(ike_sa_t *this, host_t *me, host_t *other, bool force); + void (*update_hosts)(ike_sa_t *this, host_t *me, host_t *other, + update_hosts_flag_t flags); /** * Get the own identification. @@ -872,10 +893,11 @@ struct ike_sa_t { * * @param message_id ID of the request to retransmit * @return - * - SUCCESS - * - NOT_FOUND if request doesn't have to be retransmitted + * - SUCCESS if retransmit was sent + * - INVALID_STATE if no retransmit required + * - DESTROY_ME if this IKE_SA MUST be deleted */ - status_t (*retransmit) (ike_sa_t *this, uint32_t message_id); + status_t (*retransmit)(ike_sa_t *this, uint32_t message_id); /** * Sends a DPD request to the peer.