summaryrefslogtreecommitdiff
path: root/lib/libc/net
diff options
context:
space:
mode:
authorJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2001-08-07 00:51:24 +0000
committerJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2001-08-07 00:51:24 +0000
commitdb1df247b3945fb810948294a11250c9df0dd9ac (patch)
tree7daeee018c9430f6a4353db1486e77e132169943 /lib/libc/net
parent8e1cfd4c4d2de3b34fe97c091a6175ec0e488561 (diff)
sorry, correct the polarity of return value on AF_INET6.
Diffstat (limited to 'lib/libc/net')
-rw-r--r--lib/libc/net/net_addrcmp.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/libc/net/net_addrcmp.c b/lib/libc/net/net_addrcmp.c
index 7d1a67ee084..a3ba89a6810 100644
--- a/lib/libc/net/net_addrcmp.c
+++ b/lib/libc/net/net_addrcmp.c
@@ -10,6 +10,8 @@ net_addrcmp(sa1, sa2)
struct sockaddr *sa1;
struct sockaddr *sa2;
{
+ int r;
+
if (sa1->sa_len != sa2->sa_len)
return (sa1->sa_len < sa2->sa_len) ? -1 : 1;
if (sa1->sa_family != sa2->sa_family)
@@ -21,11 +23,14 @@ net_addrcmp(sa1, sa2)
&((struct sockaddr_in *)sa2)->sin_addr,
sizeof(struct in_addr)));
case AF_INET6:
- return (memcmp(&((struct sockaddr_in6 *)sa1)->sin6_addr,
+ if (((struct sockaddr_in6 *)sa1)->sin6_scope_id !=
+ ((struct sockaddr_in6 *)sa2)->sin6_scpoe_id)
+ return (((struct sockaddr_in6 *)sa1)->sin6_scope_id <
+ ((struct sockaddr_in6 *)sa2)->sin6_scpoe_id)
+ ? -1 : 1;
+ return memcmp(&((struct sockaddr_in6 *)sa1)->sin6_addr,
&((struct sockaddr_in6 *)sa2)->sin6_addr,
- sizeof(struct in6_addr)) == 0 &&
- ((struct sockaddr_in6 *)sa1)->sin6_scope_id ==
- ((struct sockaddr_in6 *)sa2)->sin6_scpoe_id);
+ sizeof(struct in6_addr));
case AF_NS:
return (memcmp(&((struct sockaddr_ns *)sa1)->sns_addr,
&((struct sockaddr_ns *)sa2)->sns_addr,