From ea5f49b4214412b9e5229128e9c45dac657959e8 Mon Sep 17 00:00:00 2001 From: Michael Poole Date: Sun, 4 Jul 2010 17:58:35 -0400 Subject: [PATCH] Fix endianness of IPv6 addresses in generate_hostmask(). src/proto-common.c (generate_hostmask): The IPv6 address parts are network-endian, so convert them before printing them. --- src/proto-common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/proto-common.c b/src/proto-common.c index c04fd71..4fa2d2b 100644 --- a/src/proto-common.c +++ b/src/proto-common.c @@ -762,7 +762,7 @@ generate_hostmask(struct userNode *user, int options) sprintf(hostname, "%d.%d.*", user->ip.in6_8[12], user->ip.in6_8[13]); } else if (irc_in_addr_is_ipv6(user->ip)) { /* Who knows what the default mask should be? Use a /48 to start with. */ - sprintf(hostname, "%x:%x:%x:*", user->ip.in6[0], user->ip.in6[1], user->ip.in6[2]); + sprintf(hostname, "%x:%x:%x:*", ntohs(user->ip.in6[0]), ntohs(user->ip.in6[1]), ntohs(user->ip.in6[2])); } else { /* Unknown type; just copy IP directly. */ irc_ntop(hostname, IRC_NTOP_MAX_SIZE, &user->ip); -- 2.20.1