proposal-substructure: Start numbering IKEv1 proposals with 1
authorTobias Brunner <tobias@strongswan.org>
Fri, 7 Feb 2020 08:45:56 +0000 (09:45 +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 802adac..d7e1d28 100644 (file)
@@ -1530,7 +1530,9 @@ static void set_data(private_proposal_substructure_t *this, proposal_t *proposal
                default:
                        break;
        }
                default:
                        break;
        }
-       this->proposal_number = proposal->get_number(proposal);
+       /* default to 1 if no number is set (mainly for IKEv1, for IKEv2 the numbers
+        * are explicitly set when proposals are added to the SA payload) */
+       this->proposal_number = proposal->get_number(proposal) ?: 1;
        this->protocol_id = proposal->get_protocol(proposal);
        compute_length(this);
 }
        this->protocol_id = proposal->get_protocol(proposal);
        compute_length(this);
 }