summaryrefslogtreecommitdiff
path: root/src/libstrongswan/ipsec
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@debian.org>2016-07-16 15:19:53 +0200
committerYves-Alexis Perez <corsac@debian.org>2016-07-16 15:19:53 +0200
commitbf372706c469764d59e9f29c39e3ecbebd72b8d2 (patch)
tree0f0e296e2d50e4a7faf99ae6fa428d2681e81ea1 /src/libstrongswan/ipsec
parent518dd33c94e041db0444c7d1f33da363bb8e3faf (diff)
downloadvyos-strongswan-bf372706c469764d59e9f29c39e3ecbebd72b8d2.tar.gz
vyos-strongswan-bf372706c469764d59e9f29c39e3ecbebd72b8d2.zip
Imported Upstream version 5.5.0
Diffstat (limited to 'src/libstrongswan/ipsec')
-rw-r--r--src/libstrongswan/ipsec/ipsec_types.c16
-rw-r--r--src/libstrongswan/ipsec/ipsec_types.h29
2 files changed, 35 insertions, 10 deletions
diff --git a/src/libstrongswan/ipsec/ipsec_types.c b/src/libstrongswan/ipsec/ipsec_types.c
index f2ee11ee8..a52a1eb51 100644
--- a/src/libstrongswan/ipsec/ipsec_types.c
+++ b/src/libstrongswan/ipsec/ipsec_types.c
@@ -40,6 +40,22 @@ ENUM(ipcomp_transform_names, IPCOMP_NONE, IPCOMP_LZJH,
/*
* See header
*/
+bool ipsec_sa_cfg_equals(ipsec_sa_cfg_t *a, ipsec_sa_cfg_t *b)
+{
+ return a->mode == b->mode &&
+ a->reqid == b->reqid &&
+ a->policy_count == b->policy_count &&
+ a->esp.use == b->esp.use &&
+ a->esp.spi == b->esp.spi &&
+ a->ah.use == b->ah.use &&
+ a->ah.spi == b->ah.spi &&
+ a->ipcomp.transform == b->ipcomp.transform &&
+ a->ipcomp.cpi == b->ipcomp.cpi;
+}
+
+/*
+ * See header
+ */
bool mark_from_string(const char *value, mark_t *mark)
{
char *endptr;
diff --git a/src/libstrongswan/ipsec/ipsec_types.h b/src/libstrongswan/ipsec/ipsec_types.h
index fa122af30..c93d95562 100644
--- a/src/libstrongswan/ipsec/ipsec_types.h
+++ b/src/libstrongswan/ipsec/ipsec_types.h
@@ -123,26 +123,35 @@ struct ipsec_sa_cfg_t {
/** mode of SA (tunnel, transport) */
ipsec_mode_t mode;
/** unique ID */
- u_int32_t reqid;
+ uint32_t reqid;
/** number of policies of the same kind (in/out/fwd) attached to SA */
- u_int32_t policy_count;
+ uint32_t policy_count;
/** details about ESP/AH */
struct {
/** TRUE if this protocol is used */
bool use;
/** SPI for ESP/AH */
- u_int32_t spi;
+ uint32_t spi;
} esp, ah;
/** details about IPComp */
struct {
/** the IPComp transform used */
- u_int16_t transform;
+ uint16_t transform;
/** CPI for IPComp */
- u_int16_t cpi;
+ uint16_t cpi;
} ipcomp;
};
/**
+ * Compare two ipsec_sa_cfg_t objects for equality.
+ *
+ * @param a first object
+ * @param b second object
+ * @return TRUE if both objects are equal
+ */
+bool ipsec_sa_cfg_equals(ipsec_sa_cfg_t *a, ipsec_sa_cfg_t *b);
+
+/**
* A lifetime_cfg_t defines the lifetime limits of an SA.
*
* Set any of these values to 0 to ignore.
@@ -150,11 +159,11 @@ struct ipsec_sa_cfg_t {
struct lifetime_cfg_t {
struct {
/** Limit before the SA gets invalid. */
- u_int64_t life;
+ uint64_t life;
/** Limit before the SA gets rekeyed. */
- u_int64_t rekey;
+ uint64_t rekey;
/** The range of a random value subtracted from rekey. */
- u_int64_t jitter;
+ uint64_t jitter;
} time, bytes, packets;
};
@@ -163,9 +172,9 @@ struct lifetime_cfg_t {
*/
struct mark_t {
/** Mark value */
- u_int32_t value;
+ uint32_t value;
/** Mark mask */
- u_int32_t mask;
+ uint32_t mask;
};
/**