Always send a configuration payload in IKEv1 TRANSACTIONs, even if it is empty
This commit is contained in:
@@ -232,7 +232,7 @@ static void process_payloads(private_mode_config_t *this, message_t *message)
|
|||||||
METHOD(task_t, build_i, status_t,
|
METHOD(task_t, build_i, status_t,
|
||||||
private_mode_config_t *this, message_t *message)
|
private_mode_config_t *this, message_t *message)
|
||||||
{
|
{
|
||||||
cp_payload_t *cp = NULL;
|
cp_payload_t *cp;
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
attribute_handler_t *handler;
|
attribute_handler_t *handler;
|
||||||
peer_cfg_t *config;
|
peer_cfg_t *config;
|
||||||
@@ -241,6 +241,8 @@ METHOD(task_t, build_i, status_t,
|
|||||||
linked_list_t *vips;
|
linked_list_t *vips;
|
||||||
host_t *host;
|
host_t *host;
|
||||||
|
|
||||||
|
cp = cp_payload_create_type(CONFIGURATION_V1, CFG_REQUEST);
|
||||||
|
|
||||||
vips = linked_list_create();
|
vips = linked_list_create();
|
||||||
|
|
||||||
/* reuse virtual IP if we already have one */
|
/* reuse virtual IP if we already have one */
|
||||||
@@ -264,7 +266,6 @@ METHOD(task_t, build_i, status_t,
|
|||||||
|
|
||||||
if (vips->get_count(vips))
|
if (vips->get_count(vips))
|
||||||
{
|
{
|
||||||
cp = cp_payload_create_type(CONFIGURATION_V1, CFG_REQUEST);
|
|
||||||
enumerator = vips->create_enumerator(vips);
|
enumerator = vips->create_enumerator(vips);
|
||||||
while (enumerator->enumerate(enumerator, &host))
|
while (enumerator->enumerate(enumerator, &host))
|
||||||
{
|
{
|
||||||
@@ -278,19 +279,13 @@ METHOD(task_t, build_i, status_t,
|
|||||||
this->ike_sa->get_other_id(this->ike_sa), vips);
|
this->ike_sa->get_other_id(this->ike_sa), vips);
|
||||||
while (enumerator->enumerate(enumerator, &handler, &type, &data))
|
while (enumerator->enumerate(enumerator, &handler, &type, &data))
|
||||||
{
|
{
|
||||||
configuration_attribute_t *ca;
|
|
||||||
entry_t *entry;
|
entry_t *entry;
|
||||||
|
|
||||||
DBG2(DBG_IKE, "building %N attribute",
|
DBG2(DBG_IKE, "building %N attribute",
|
||||||
configuration_attribute_type_names, type);
|
configuration_attribute_type_names, type);
|
||||||
ca = configuration_attribute_create_chunk(CONFIGURATION_ATTRIBUTE_V1,
|
cp->add_attribute(cp,
|
||||||
type, data);
|
configuration_attribute_create_chunk(CONFIGURATION_ATTRIBUTE_V1,
|
||||||
if (!cp)
|
type, data));
|
||||||
{
|
|
||||||
cp = cp_payload_create_type(CONFIGURATION_V1, CFG_REQUEST);
|
|
||||||
}
|
|
||||||
cp->add_attribute(cp, ca);
|
|
||||||
|
|
||||||
INIT(entry,
|
INIT(entry,
|
||||||
.type = type,
|
.type = type,
|
||||||
.handler = handler,
|
.handler = handler,
|
||||||
@@ -301,10 +296,8 @@ METHOD(task_t, build_i, status_t,
|
|||||||
|
|
||||||
vips->destroy(vips);
|
vips->destroy(vips);
|
||||||
|
|
||||||
if (cp)
|
message->add_payload(message, (payload_t*)cp);
|
||||||
{
|
|
||||||
message->add_payload(message, (payload_t*)cp);
|
|
||||||
}
|
|
||||||
return NEED_MORE;
|
return NEED_MORE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -321,12 +314,14 @@ METHOD(task_t, build_r, status_t,
|
|||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
configuration_attribute_type_t type;
|
configuration_attribute_type_t type;
|
||||||
chunk_t value;
|
chunk_t value;
|
||||||
cp_payload_t *cp = NULL;
|
cp_payload_t *cp;
|
||||||
peer_cfg_t *config;
|
peer_cfg_t *config;
|
||||||
identification_t *id;
|
identification_t *id;
|
||||||
linked_list_t *vips, *pools;
|
linked_list_t *vips, *pools;
|
||||||
host_t *requested;
|
host_t *requested;
|
||||||
|
|
||||||
|
cp = cp_payload_create_type(CONFIGURATION_V1, CFG_REPLY);
|
||||||
|
|
||||||
id = this->ike_sa->get_other_eap_id(this->ike_sa);
|
id = this->ike_sa->get_other_eap_id(this->ike_sa);
|
||||||
config = this->ike_sa->get_peer_cfg(this->ike_sa);
|
config = this->ike_sa->get_peer_cfg(this->ike_sa);
|
||||||
vips = linked_list_create();
|
vips = linked_list_create();
|
||||||
@@ -349,10 +344,6 @@ METHOD(task_t, build_r, status_t,
|
|||||||
{
|
{
|
||||||
DBG1(DBG_IKE, "assigning virtual IP %H to peer '%Y'", found, id);
|
DBG1(DBG_IKE, "assigning virtual IP %H to peer '%Y'", found, id);
|
||||||
this->ike_sa->add_virtual_ip(this->ike_sa, FALSE, found);
|
this->ike_sa->add_virtual_ip(this->ike_sa, FALSE, found);
|
||||||
if (!cp)
|
|
||||||
{
|
|
||||||
cp = cp_payload_create_type(CONFIGURATION_V1, CFG_REPLY);
|
|
||||||
}
|
|
||||||
cp->add_attribute(cp, build_vip(found));
|
cp->add_attribute(cp, build_vip(found));
|
||||||
vips->insert_last(vips, found);
|
vips->insert_last(vips, found);
|
||||||
}
|
}
|
||||||
@@ -369,10 +360,6 @@ METHOD(task_t, build_r, status_t,
|
|||||||
hydra->attributes, pools, id, vips);
|
hydra->attributes, pools, id, vips);
|
||||||
while (enumerator->enumerate(enumerator, &type, &value))
|
while (enumerator->enumerate(enumerator, &type, &value))
|
||||||
{
|
{
|
||||||
if (!cp)
|
|
||||||
{
|
|
||||||
cp = cp_payload_create_type(CONFIGURATION_V1, CFG_REPLY);
|
|
||||||
}
|
|
||||||
DBG2(DBG_IKE, "building %N attribute",
|
DBG2(DBG_IKE, "building %N attribute",
|
||||||
configuration_attribute_type_names, type);
|
configuration_attribute_type_names, type);
|
||||||
cp->add_attribute(cp,
|
cp->add_attribute(cp,
|
||||||
@@ -383,11 +370,9 @@ METHOD(task_t, build_r, status_t,
|
|||||||
vips->destroy_offset(vips, offsetof(host_t, destroy));
|
vips->destroy_offset(vips, offsetof(host_t, destroy));
|
||||||
pools->destroy(pools);
|
pools->destroy(pools);
|
||||||
|
|
||||||
if (cp)
|
cp->set_identifier(cp, this->identifier);
|
||||||
{
|
message->add_payload(message, (payload_t*)cp);
|
||||||
cp->set_identifier(cp, this->identifier);
|
|
||||||
message->add_payload(message, (payload_t*)cp);
|
|
||||||
}
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user