Add NO_EXT_SEQ_NUMBER to proposal only if it has not been specified in string
authorMartin Willi <martin@revosec.ch>
Mon, 18 Apr 2011 13:43:59 +0000 (15:43 +0200)
committerMartin Willi <martin@revosec.ch>
Wed, 20 Apr 2011 10:26:58 +0000 (12:26 +0200)
src/libcharon/config/proposal.c

index 956edac..2251b82 100644 (file)
@@ -544,6 +544,16 @@ static void check_proposal(private_proposal_t *this)
                        free(alg);
                }
        }
+
+       if (this->protocol == PROTO_AH || this->protocol == PROTO_ESP)
+       {
+               e = this->esns->create_enumerator(this->esns);
+               if (!e->enumerate(e, &alg))
+               {       /* ESN not specified, assume not supported */
+                       add_algorithm(this, EXTENDED_SEQUENCE_NUMBERS, NO_EXT_SEQ_NUMBERS, 0);
+               }
+               e->destroy(e);
+       }
 }
 
 /**
@@ -913,9 +923,5 @@ proposal_t *proposal_create_from_string(protocol_id_t protocol, const char *algs
 
        check_proposal(this);
 
-       if (protocol == PROTO_AH || protocol == PROTO_ESP)
-       {
-               add_algorithm(this, EXTENDED_SEQUENCE_NUMBERS, NO_EXT_SEQ_NUMBERS, 0);
-       }
        return &this->public;
 }