summaryrefslogtreecommitdiff
path: root/src/core/network.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/network.c')
-rw-r--r--src/core/network.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/core/network.c b/src/core/network.c
index 52619e4f..4963a542 100644
--- a/src/core/network.c
+++ b/src/core/network.c
@@ -57,6 +57,18 @@ IPADDR ip4_any = {
#endif
};
+int net_ip_compare(IPADDR *ip1, IPADDR *ip2)
+{
+ if (ip1->family != ip2->family)
+ return 0;
+
+ if (ip1->family == AF_INET6)
+ return memcmp(&ip1->ip, &ip2->ip, sizeof(ip1->ip)) == 0;
+
+ return memcmp(&ip1->ip, &ip2->ip, 4) == 0;
+}
+
+
static void sin_set_ip(union sockaddr_union *so, const IPADDR *ip)
{
if (ip == NULL) {