Added encapsulation mode transform attribute to IPComp proposal.
authorTobias Brunner <tobias@strongswan.org>
Fri, 25 May 2012 07:24:49 +0000 (09:24 +0200)
committerTobias Brunner <tobias@strongswan.org>
Fri, 25 May 2012 07:26:42 +0000 (09:26 +0200)
src/libcharon/encoding/payloads/proposal_substructure.c
src/libcharon/encoding/payloads/proposal_substructure.h
src/libcharon/encoding/payloads/sa_payload.c

index ba71820..afeeb09 100644 (file)
@@ -1519,7 +1519,7 @@ proposal_substructure_t *proposal_substructure_create_from_proposals_v1(
  */
 proposal_substructure_t *proposal_substructure_create_for_ipcomp_v1(
                        u_int32_t lifetime, u_int64_t lifebytes, u_int16_t cpi,
-                       u_int8_t proposal_number)
+                       ipsec_mode_t mode, bool udp, u_int8_t proposal_number)
 {
        private_proposal_substructure_t *this;
        transform_substructure_t *transform;
@@ -1532,6 +1532,9 @@ proposal_substructure_t *proposal_substructure_create_for_ipcomp_v1(
        transform = transform_substructure_create_type(TRANSFORM_SUBSTRUCTURE_V1,
                                                                                                   1, IKEV1_IPCOMP_DEFLATE);
 
+       transform->add_transform_attribute(transform,
+               transform_attribute_create_value(TRANSFORM_ATTRIBUTE_V1,
+                                                       TATTR_PH2_ENCAP_MODE, get_ikev1_mode(mode, udp)));
        if (lifetime)
        {
                transform->add_transform_attribute(transform,
index 720f979..5d42a61 100644 (file)
@@ -205,14 +205,16 @@ proposal_substructure_t *proposal_substructure_create_from_proposals_v1(
  * Creates an IKEv1 proposal_substructure_t for IPComp with the given
  * proposal_number (e.g. of a ESP proposal to bundle them).
  *
- * @param lifetime     lifetime in seconds
- * @param lifebytes    lifebytes, in bytes
+ * @param lifetime                     lifetime in seconds
+ * @param lifebytes                    lifebytes, in bytes
  * @param cpi                          the CPI to be used
+ * @param mode                         IPsec encapsulation mode, TRANSPORT or TUNNEL
+ * @param udp                          TRUE to use UDP encapsulation
  * @param proposal_number      the proposal number of the proposal to be linked
  * @return                                     IKEv1 proposal_substructure_t PROPOSAL_SUBSTRUCTURE_V1
  */
 proposal_substructure_t *proposal_substructure_create_for_ipcomp_v1(
                        u_int32_t lifetime, u_int64_t lifebytes, u_int16_t cpi,
-                       u_int8_t proposal_number);
+                       ipsec_mode_t mode, bool udp, u_int8_t proposal_number);
 
 #endif /** PROPOSAL_SUBSTRUCTURE_H_ @}*/
index 92c1a9b..adf19aa 100644 (file)
@@ -571,7 +571,7 @@ sa_payload_t *sa_payload_create_from_proposals_v1(linked_list_t *proposals,
                u_int8_t proposal_number = substruct->get_proposal_number(substruct);
 
                substruct = proposal_substructure_create_for_ipcomp_v1(lifetime,
-                                       lifebytes, cpi, proposal_number);
+                                       lifebytes, cpi, mode, udp, proposal_number);
                this->proposals->insert_last(this->proposals, substruct);
                substruct->set_is_last_proposal(substruct, FALSE);
                /* add the proposals again without IPComp */