diff options
author | Martin Willi <martin@revosec.ch> | 2014-04-24 14:19:12 +0200 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2014-05-16 16:01:21 +0200 |
commit | 3312c447ef099db8a95a553d7203ac28a58e062a (patch) | |
tree | 0866fc6c9e889874e9859268016dd8a15a26f827 /src | |
parent | 8642f8bdb782e35be84183351a20a3df33e55586 (diff) | |
download | strongswan-3312c447ef099db8a95a553d7203ac28a58e062a.tar.bz2 strongswan-3312c447ef099db8a95a553d7203ac28a58e062a.tar.xz |
ike-cfg: Allow passing NULL to add_proposal()
This simplifies adding default proposals with constructors potentially
returning NULL.
Diffstat (limited to 'src')
-rw-r--r-- | src/libcharon/config/ike_cfg.c | 5 | ||||
-rw-r--r-- | src/libcharon/config/ike_cfg.h | 5 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/libcharon/config/ike_cfg.c b/src/libcharon/config/ike_cfg.c index e08bb3f67..42a3e9057 100644 --- a/src/libcharon/config/ike_cfg.c +++ b/src/libcharon/config/ike_cfg.c @@ -281,7 +281,10 @@ METHOD(ike_cfg_t, get_dscp, u_int8_t, METHOD(ike_cfg_t, add_proposal, void, private_ike_cfg_t *this, proposal_t *proposal) { - this->proposals->insert_last(this->proposals, proposal); + if (proposal) + { + this->proposals->insert_last(this->proposals, proposal); + } } METHOD(ike_cfg_t, get_proposals, linked_list_t*, diff --git a/src/libcharon/config/ike_cfg.h b/src/libcharon/config/ike_cfg.h index f9e4fbebc..adfcabf70 100644 --- a/src/libcharon/config/ike_cfg.h +++ b/src/libcharon/config/ike_cfg.h @@ -148,9 +148,10 @@ struct ike_cfg_t { * Adds a proposal to the list. * * The first added proposal has the highest priority, the last - * added the lowest. + * added the lowest. It is safe to add NULL as proposal, which has no + * effect. * - * @param proposal proposal to add + * @param proposal proposal to add, or NULL */ void (*add_proposal) (ike_cfg_t *this, proposal_t *proposal); |