Use vendor id payload for IKEv1 payloads, too
This commit is contained in:
parent
ecf854a00b
commit
837298c590
|
@ -192,7 +192,8 @@ payload_t *payload_create(payload_type_t type)
|
|||
case DELETE:
|
||||
return (payload_t*)delete_payload_create(0);
|
||||
case VENDOR_ID:
|
||||
return (payload_t*)vendor_id_payload_create();
|
||||
case VENDOR_ID_V1:
|
||||
return (payload_t*)vendor_id_payload_create(type);
|
||||
case CONFIGURATION:
|
||||
return (payload_t*)cp_payload_create();
|
||||
case CONFIGURATION_ATTRIBUTE:
|
||||
|
|
|
@ -55,6 +55,11 @@ struct private_vendor_id_payload_t {
|
|||
* The contained data.
|
||||
*/
|
||||
chunk_t data;
|
||||
|
||||
/**
|
||||
* Either a IKEv1 or a IKEv2 vendor ID payload
|
||||
*/
|
||||
payload_type_t type;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -111,7 +116,7 @@ METHOD(payload_t, get_encoding_rules, void,
|
|||
METHOD(payload_t, get_type, payload_type_t,
|
||||
private_vendor_id_payload_t *this)
|
||||
{
|
||||
return VENDOR_ID;
|
||||
return this->type;
|
||||
}
|
||||
|
||||
METHOD(payload_t, get_next_type, payload_type_t,
|
||||
|
@ -148,7 +153,8 @@ METHOD2(payload_t, vendor_id_payload_t, destroy, void,
|
|||
/*
|
||||
* Described in header
|
||||
*/
|
||||
vendor_id_payload_t *vendor_id_payload_create_data(chunk_t data)
|
||||
vendor_id_payload_t *vendor_id_payload_create_data(payload_type_t type,
|
||||
chunk_t data)
|
||||
{
|
||||
private_vendor_id_payload_t *this;
|
||||
|
||||
|
@ -169,6 +175,7 @@ vendor_id_payload_t *vendor_id_payload_create_data(chunk_t data)
|
|||
.next_payload = NO_PAYLOAD,
|
||||
.payload_length = VENDOR_ID_PAYLOAD_HEADER_LENGTH + data.len,
|
||||
.data = data,
|
||||
.type = type,
|
||||
);
|
||||
return &this->public;
|
||||
}
|
||||
|
@ -176,7 +183,7 @@ vendor_id_payload_t *vendor_id_payload_create_data(chunk_t data)
|
|||
/*
|
||||
* Described in header
|
||||
*/
|
||||
vendor_id_payload_t *vendor_id_payload_create()
|
||||
vendor_id_payload_t *vendor_id_payload_create(payload_type_t type)
|
||||
{
|
||||
return vendor_id_payload_create_data(chunk_empty);
|
||||
return vendor_id_payload_create_data(type, chunk_empty);
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ typedef struct vendor_id_payload_t vendor_id_payload_t;
|
|||
#define VENDOR_ID_PAYLOAD_HEADER_LENGTH 4
|
||||
|
||||
/**
|
||||
* Class representing an IKEv2 VENDOR ID payload.
|
||||
* Class representing an IKEv1/IKEv2 VENDOR ID payload.
|
||||
*
|
||||
* The VENDOR ID payload format is described in RFC section 3.12.
|
||||
*/
|
||||
|
@ -58,18 +58,21 @@ struct vendor_id_payload_t {
|
|||
};
|
||||
|
||||
/**
|
||||
* Creates an empty Vendor ID payload.
|
||||
* Creates an empty Vendor ID payload for IKEv1 or IKEv2.
|
||||
*
|
||||
* @@param type VENDOR_ID or VENDOR_ID_V1
|
||||
* @return vendor ID payload
|
||||
*/
|
||||
vendor_id_payload_t *vendor_id_payload_create();
|
||||
vendor_id_payload_t *vendor_id_payload_create(payload_type_t type);
|
||||
|
||||
/**
|
||||
* Creates a vendor ID payload using a chunk of data
|
||||
*
|
||||
* @param type VENDOR_ID or VENDOR_ID_V1
|
||||
* @param data data to use in vendor ID payload, gets owned by payload
|
||||
* @return vendor ID payload
|
||||
*/
|
||||
vendor_id_payload_t *vendor_id_payload_create_data(chunk_t data);
|
||||
vendor_id_payload_t *vendor_id_payload_create_data(payload_type_t type,
|
||||
chunk_t data);
|
||||
|
||||
#endif /** VENDOR_ID_PAYLOAD_H_ @}*/
|
||||
|
|
|
@ -57,7 +57,8 @@ METHOD(task_t, build, status_t,
|
|||
{
|
||||
vendor_id_payload_t *vid;
|
||||
|
||||
vid = vendor_id_payload_create_data(chunk_clone(strongswan_vid));
|
||||
vid = vendor_id_payload_create_data(VENDOR_ID,
|
||||
chunk_clone(strongswan_vid));
|
||||
message->add_payload(message, &vid->payload_interface);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue