identification_t *other_id;
/**
- * set of extensions the peer supports
+ * Set of extensions the peer supports
*/
ike_extension_t extensions;
/**
- * set of condition flags currently enabled for this IKE_SA
+ * Set of private xtensions the peer supports
+ */
+ ike_extension_t private_extensions;
+
+ /**
+ * Set of condition flags currently enabled for this IKE_SA
*/
ike_condition_t conditions;
+ /**
+ * Set of private condition flags currently enabled for this IKE_SA
+ */
+ ike_condition_t private_conditions;
+
/**
* Array containing the child sa's of the current IKE_SA.
*/
METHOD(ike_sa_t, enable_extension, void,
private_ike_sa_t *this, ike_extension_t extension)
{
- this->extensions |= extension;
+ ike_extension_t *ptr;
+ ptr = (extension & EXT_PRIVATE_MARKER) ? &this->private_extensions
+ : &this->extensions;
+ *ptr |= (extension & ~EXT_PRIVATE_MARKER);
}
METHOD(ike_sa_t, supports_extension, bool,
private_ike_sa_t *this, ike_extension_t extension)
{
- return (this->extensions & extension) != FALSE;
+ ike_extension_t *ptr;
+ ptr = (extension & EXT_PRIVATE_MARKER) ? &this->private_extensions
+ : &this->extensions;
+ return (*ptr & extension) != 0;
}
METHOD(ike_sa_t, has_condition, bool,
private_ike_sa_t *this, ike_condition_t condition)
{
- return (this->conditions & condition) != FALSE;
+ ike_condition_t *ptr;
+ ptr = (condition & COND_PRIVATE_MARKER) ? &this->private_conditions
+ : &this->conditions;
+ return (*ptr & condition) != 0;
}
METHOD(ike_sa_t, set_condition, void,
private_ike_sa_t *this, ike_condition_t condition, bool enable)
{
+ ike_condition_t *ptr;
+
if (has_condition(this, condition) != enable)
{
+ ptr = (condition & COND_PRIVATE_MARKER) ? &this->private_conditions
+ : &this->conditions;
if (enable)
{
- this->conditions |= condition;
+ *ptr |= (condition & ~COND_PRIVATE_MARKER);
switch (condition)
{
case COND_NAT_HERE:
}
else
{
- this->conditions &= ~condition;
+ *ptr &= ~(condition & ~COND_PRIVATE_MARKER);
switch (condition)
{
case COND_NAT_HERE:
/* apply extensions and conditions with a few exceptions */
this->extensions = other->extensions;
+ this->private_extensions = other->private_extensions;
this->conditions = other->conditions;
+ this->private_conditions = other->private_conditions;
this->conditions &= ~COND_STALE;
this->conditions &= ~COND_REAUTHENTICATING;
}
/**
* Extensions (or optional features) the peer supports
+ *
+ * Private extensions can be defined by using the EXT_PRIVATE_MARKER marker.
*/
enum ike_extension_t {
* IKEv2 Intermediate Exchange, RFC 9242
*/
EXT_IKE_INTERMEDIATE = (1<<17),
+
+ /**
+ * MSB marker to separate private extensions
+ */
+ EXT_PRIVATE_MARKER = (1<<31),
};
/**
* Conditions of an IKE_SA, change during its lifetime
+ *
+ * Private conditions can be defined by using the COND_PRIVATE_MARKER marker.
*/
enum ike_condition_t {
* An OCSP status request was received
*/
COND_OCSP_REQUEST = (1<<15),
+
+ /**
+ * MSB marker to separate private conditions
+ */
+ COND_PRIVATE_MARKER = (1<<31),
};
/**