IPv6 support (hopefully with fewer future transition pains)
[ircu2.10.12-pk.git] / ircd / m_who.c
index 797b5a87e581be327f8c113c3b7c3af810e8193e..c4fd81f2a93a805fa891865905f2d9648b6bb990 100644 (file)
@@ -351,12 +351,14 @@ int m_who(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
      real mask and try to match all relevant fields */
   if (!(commas || (counter < 1)))
   {
+    struct irc_in_addr imask;
     int minlen, cset;
-    static struct in_mask imask;
+    unsigned char ibits;
+
     if (mask)
     {
       matchcomp(mymask, &minlen, &cset, mask);
-      if (matchcompIP(&imask, mask))
+      if (!ipmask_parse(mask, &imask, &ibits))
         matchsel &= ~WHO_FIELD_NIP;
       if ((minlen > NICKLEN) || !(cset & NTL_IRCNK))
         matchsel &= ~WHO_FIELD_NIC;
@@ -401,9 +403,7 @@ int m_who(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
               || matchexec(cli_info(acptr), mymask, minlen))
               && ((!(matchsel & WHO_FIELD_NIP))
              || (HasHiddenHost(acptr) && !IsAnOper(sptr))
-              || ((((cli_ip(acptr).s_addr & imask.mask.s_addr) !=
-              imask.bits.s_addr)) || (imask.fall
-              && matchexec(ircd_ntoa((const char*) &(cli_ip(acptr))), mymask, minlen)))))
+              || !ipmask_check(&cli_ip(acptr), &imask, ibits)))
             continue;
           if (!SHOW_MORE(sptr, counter))
             break;
@@ -439,9 +439,7 @@ int m_who(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
             || matchexec(cli_info(acptr), mymask, minlen))
             && ((!(matchsel & WHO_FIELD_NIP))
            || (HasHiddenHost(acptr) && !IsAnOper(sptr))
-            || ((((cli_ip(acptr).s_addr & imask.mask.s_addr) != imask.bits.s_addr))
-            || (imask.fall
-            && matchexec(ircd_ntoa((const char*) &(cli_ip(acptr))), mymask, minlen)))))
+            || !ipmask_check(&cli_ip(acptr), &imask, ibits)))
           continue;
         if (!SHOW_MORE(sptr, counter))
           break;