diff options
author | Tobias Brunner <tobias@strongswan.org> | 2015-10-16 12:26:57 +0200 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2016-03-08 10:21:57 +0100 |
commit | f6a5e6b6a94cd6f9d63035ad82cc0abbfa59b46a (patch) | |
tree | 543662472717d9ce2f53257c554d6c3fd91aab24 /src | |
parent | 3af23606bfe7047a5edd6b4d026bdf2188643376 (diff) | |
download | strongswan-f6a5e6b6a94cd6f9d63035ad82cc0abbfa59b46a.tar.bz2 strongswan-f6a5e6b6a94cd6f9d63035ad82cc0abbfa59b46a.tar.xz |
peer-cfg: Use new method to compare linked lists in equals()
This also compares the complete lists not only the first two items.
Diffstat (limited to 'src')
-rw-r--r-- | src/libcharon/config/peer_cfg.c | 39 |
1 files changed, 3 insertions, 36 deletions
diff --git a/src/libcharon/config/peer_cfg.c b/src/libcharon/config/peer_cfg.c index 8a8c5b7a5..a0e336201 100644 --- a/src/libcharon/config/peer_cfg.c +++ b/src/libcharon/config/peer_cfg.c @@ -538,10 +538,6 @@ static bool auth_cfg_equal(private_peer_cfg_t *this, private_peer_cfg_t *other) METHOD(peer_cfg_t, equals, bool, private_peer_cfg_t *this, private_peer_cfg_t *other) { - enumerator_t *e1, *e2; - host_t *vip1, *vip2; - char *pool1, *pool2; - if (this == other) { return TRUE; @@ -550,44 +546,15 @@ METHOD(peer_cfg_t, equals, bool, { return FALSE; } - - if (this->vips->get_count(this->vips) != other->vips->get_count(other->vips)) + if (!this->vips->equals_offset(this->vips, other->vips, + offsetof(host_t, ip_equals))) { return FALSE; } - e1 = create_virtual_ip_enumerator(this); - e2 = create_virtual_ip_enumerator(other); - if (e1->enumerate(e1, &vip1) && e2->enumerate(e2, &vip2)) - { - if (!vip1->ip_equals(vip1, vip2)) - { - e1->destroy(e1); - e2->destroy(e2); - return FALSE; - } - } - e1->destroy(e1); - e2->destroy(e2); - - if (this->pools->get_count(this->pools) != - other->pools->get_count(other->pools)) + if (!this->pools->equals_function(this->pools, other->pools, (void*)streq)) { return FALSE; } - e1 = create_pool_enumerator(this); - e2 = create_pool_enumerator(other); - if (e1->enumerate(e1, &pool1) && e2->enumerate(e2, &pool2)) - { - if (!streq(pool1, pool2)) - { - e1->destroy(e1); - e2->destroy(e2); - return FALSE; - } - } - e1->destroy(e1); - e2->destroy(e2); - return ( get_ike_version(this) == get_ike_version(other) && this->cert_policy == other->cert_policy && |