aboutsummaryrefslogtreecommitdiffstats
path: root/Source/charon/network/host.c
diff options
context:
space:
mode:
Diffstat (limited to 'Source/charon/network/host.c')
-rw-r--r--Source/charon/network/host.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/Source/charon/network/host.c b/Source/charon/network/host.c
index 7d120886e..245df8b05 100644
--- a/Source/charon/network/host.c
+++ b/Source/charon/network/host.c
@@ -208,11 +208,30 @@ static private_host_t *clone(private_host_t *this)
return new;
}
+/**
+ * Impelements host_t.ip_equals
+ */
+static bool ip_equals(private_host_t *this, private_host_t *other)
+{
+ switch (this->family)
+ {
+ /* IPv4 */
+ case AF_INET:
+ {
+ if ((this->address4.sin_family == other->address4.sin_family) &&
+ (this->address4.sin_addr.s_addr == other->address4.sin_addr.s_addr))
+ {
+ return TRUE;
+ }
+ }
+ }
+ return FALSE;
+}
/**
* Impelements host_t.equals
*/
-static bool ip_is_equal(private_host_t *this, private_host_t *other)
+static bool equals(private_host_t *this, private_host_t *other)
{
switch (this->family)
{
@@ -220,7 +239,8 @@ static bool ip_is_equal(private_host_t *this, private_host_t *other)
case AF_INET:
{
if ((this->address4.sin_family == other->address4.sin_family) &&
- (this->address4.sin_addr.s_addr == other->address4.sin_addr.s_addr))
+ (this->address4.sin_addr.s_addr == other->address4.sin_addr.s_addr) &&
+ (this->address4.sin_port == other->address4.sin_port))
{
return TRUE;
}
@@ -253,7 +273,8 @@ static private_host_t *host_create_empty()
this->public.get_address = (char* (*) (host_t *))get_address;
this->public.get_address_as_chunk = (chunk_t (*) (host_t *)) get_address_as_chunk;
this->public.get_port = (u_int16_t (*) (host_t *))get_port;
- this->public.ip_is_equal = (bool (*) (host_t *,host_t *)) ip_is_equal;
+ this->public.ip_equals = (bool (*) (host_t *,host_t *)) ip_equals;
+ this->public.equals = (bool (*) (host_t *,host_t *)) equals;
this->public.is_default_route = (bool (*) (host_t *)) is_default_route;
this->public.destroy = (void (*) (host_t*))destroy;