]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
proposal-substructure: Store transform number for IKEv1 proposals
authorTobias Brunner <tobias@strongswan.org>
Thu, 6 Feb 2020 14:46:05 +0000 (15:46 +0100)
committerTobias Brunner <tobias@strongswan.org>
Fri, 6 Mar 2020 09:31:30 +0000 (10:31 +0100)
src/libcharon/encoding/payloads/proposal_substructure.c

index 2d0cb1f829f0f89be820a80eb4d618cb9dd4c921..4cf0340b562f8845864c838b7e1504f8a33bd996 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012-2014 Tobias Brunner
+ * Copyright (C) 2012-2020 Tobias Brunner
  * Copyright (C) 2005-2010 Martin Willi
  * Copyright (C) 2005 Jan Hutter
  * HSR Hochschule fuer Technik Rapperswil
@@ -1004,18 +1004,25 @@ METHOD(proposal_substructure_t, get_proposals, void,
        enumerator = this->transforms->create_enumerator(this->transforms);
        while (enumerator->enumerate(enumerator, &transform))
        {
-               if (!proposal)
-               {
-                       proposal = proposal_create(this->protocol_id, this->proposal_number);
-                       proposal->set_spi(proposal, spi);
-                       proposals->insert_last(proposals, proposal);
-               }
                if (this->type == PLV2_PROPOSAL_SUBSTRUCTURE)
                {
+                       if (!proposal)
+                       {
+                               proposal = proposal_create(this->protocol_id,
+                                                                                  this->proposal_number);
+                               proposal->set_spi(proposal, spi);
+                               proposals->insert_last(proposals, proposal);
+                       }
                        add_to_proposal_v2(proposal, transform);
                }
                else
                {
+                       /* create a new proposal for each transform in IKEv1 */
+                       proposal = proposal_create_v1(
+                                                       this->protocol_id, this->proposal_number,
+                                                       transform->get_transform_type_or_number(transform));
+                       proposal->set_spi(proposal, spi);
+                       proposals->insert_last(proposals, proposal);
                        switch (this->protocol_id)
                        {
                                case PROTO_IKE:
@@ -1028,8 +1035,6 @@ METHOD(proposal_substructure_t, get_proposals, void,
                                default:
                                        break;
                        }
-                       /* create a new proposal for each transform in IKEv1 */
-                       proposal = NULL;
                }
        }
        enumerator->destroy(enumerator);