summaryrefslogtreecommitdiff
path: root/toxcore/network.c
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2013-09-15 15:53:34 -0700
committerirungentoo <irungentoo@gmail.com>2013-09-15 15:53:34 -0700
commitb6377dfd25752a72dfdbc5139bc33d8b83759b1e (patch)
treef0529784cf1333d48d646f0a9fadbe8f842604ba /toxcore/network.c
parent6bb9f94ff144f7f06aadc3d264d861dc1ca36ffb (diff)
parentee1cc34d551f978c63402e7ad6a33e410636a277 (diff)
Merge pull request #580 from FullName/networking_test
Fix in ip_equal, plus testing code which led to that fix...
Diffstat (limited to 'toxcore/network.c')
-rw-r--r--toxcore/network.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/toxcore/network.c b/toxcore/network.c
index fe2ef238..4b6dc3be 100644
--- a/toxcore/network.c
+++ b/toxcore/network.c
@@ -518,10 +518,10 @@ int ip_equal(IP *a, IP *b)
518 518
519 /* different family: check on the IPv6 one if it is the IPv4 one embedded */ 519 /* different family: check on the IPv6 one if it is the IPv4 one embedded */
520 if ((a->family == AF_INET) && (b->family == AF_INET6)) { 520 if ((a->family == AF_INET) && (b->family == AF_INET6)) {
521 if (IN6_IS_ADDR_V4COMPAT(&b->ip6.in6_addr)) 521 if (IN6_IS_ADDR_V4MAPPED(&b->ip6.in6_addr))
522 return (a->ip4.in_addr.s_addr == b->ip6.uint32[3]); 522 return (a->ip4.in_addr.s_addr == b->ip6.uint32[3]);
523 } else if ((a->family == AF_INET6) && (b->family == AF_INET)) { 523 } else if ((a->family == AF_INET6) && (b->family == AF_INET)) {
524 if (IN6_IS_ADDR_V4COMPAT(&a->ip6.in6_addr)) 524 if (IN6_IS_ADDR_V4MAPPED(&a->ip6.in6_addr))
525 return (a->ip6.uint32[3] == b->ip4.in_addr.s_addr); 525 return (a->ip6.uint32[3] == b->ip4.in_addr.s_addr);
526 } 526 }
527 527