[IPv6 IRC-DEV] Modulo Hispano-IPv6 ipv6/ircd IPcheck.c,1.3,1.4 match.c,1.2,1.3 res.c,1.3,1.4 s_bsd.c
Brought to you by:
zolty
Update of /cvsroot/irc-dev/ipv6/ircd In directory usw-pr-cvs1:/tmp/cvs-serv18553/ircd Modified Files: IPcheck.c match.c res.c s_bsd.c s_conf.c s_debug.c s_ping.c s_serv.c s_user.c support.c whocmds.c Log Message: INET6.5 Index: IPcheck.c =================================================================== RCS file: /cvsroot/irc-dev/ipv6/ircd/IPcheck.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- IPcheck.c 12 Sep 2002 19:02:14 -0000 1.3 +++ IPcheck.c 14 Sep 2002 22:44:51 -0000 1.4 @@ -96,6 +96,17 @@ * Calculate a `hash' value between 0 and HASHTABSIZE, from the internet address `IN_ADDR'. * Apply it immedeately to the table, effectively hiding the table itself. */ +#ifdef INET6 +/* + * CALCULATE_HASH for IPv6 address + */ +/* FIXME-ZOLTAN: Adaptar el hash al ipv6 */ +// register char ip[sizeof(struct IN_ADDR)]; +#define CALCULATE_HASH(IN_ADDR) \ + struct IPregistry_vector *hash; \ + do { register unsigned int ip = (IN_ADDR).S_ADDR; \ + hash = &IPregistry_hashtable[((ip >> 14) + (ip >> 7) + ip) & (HASHTABSIZE - 1)]; } while(0) +#else /* * CALCULATE_HASH for IPv4 address */ @@ -103,6 +114,7 @@ struct IPregistry_vector *hash; \ do { register unsigned int ip = (IN_ADDR).S_ADDR; \ hash = &IPregistry_hashtable[((ip >> 14) + (ip >> 7) + ip) & (HASHTABSIZE - 1)]; } while(0) +#endif /* INET6 */ /* * Fit `now' in an unsigned short, the advantage is that we use less memory `struct IPregistry::last_connect' can be smaller Index: match.c =================================================================== RCS file: /cvsroot/irc-dev/ipv6/ircd/match.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- match.c 12 Sep 2002 19:02:14 -0000 1.2 +++ match.c 14 Sep 2002 22:44:51 -0000 1.3 @@ -1006,8 +1006,14 @@ } while (*m++); +#ifdef INET6 + /* still IPv4 */ + imask->bits.s_addr = htonl(bits); + imask->mask.s_addr = htonl(filt); +#else imask->bits.S_ADDR = htonl(bits); imask->mask.S_ADDR = htonl(filt); +#endif imask->fall = unco; return ((bits & ~filt) ? -1 : 0); Index: res.c =================================================================== RCS file: /cvsroot/irc-dev/ipv6/ircd/res.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- res.c 12 Sep 2002 19:02:14 -0000 1.3 +++ res.c 14 Sep 2002 22:44:51 -0000 1.4 @@ -30,6 +30,7 @@ #include "support.h" #include "common.h" #include "sprintf_irc.h" +#include "inet.h" RCSTAG_CC("$Id$"); @@ -215,14 +216,25 @@ if (!_res.nscount) { _res.nscount = 1; +#ifdef INET6 + /* still IPv4 */ + _res.nsaddr_list[0].sin_addr.s_addr = + inet_pton(AF_INET, "127.0.0.1", &_res.nsaddr_list[0].sin_addr.s_addr); +#else _res.nsaddr_list[0].SIN_ADDR.S_ADDR = inet_addr("127.0.0.1"); +#endif } #ifdef DEBUGMODE _res.options |= RES_DEBUG; #endif alarm(2); +#ifdef INET6 + /* still IPv4 */ + fd = socket(AF_INET, SOCK_DGRAM, 0); +#else fd = socket(AFINET, SOCK_DGRAM, 0); +#endif alarm(0); if (fd < 0) { @@ -233,7 +245,12 @@ * socket at initialization time, it's pointless to continue. */ alarm(2); +#ifdef INET6 + /* still IPv4 */ + if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) +#else if ((fd = socket(AFINET, SOCK_DGRAM, 0)) < 0) +#endif { alarm(0); Debug((DEBUG_ERROR, "init_resolver: socket: No more sockets")); @@ -318,8 +335,11 @@ else memset(&nreq->cinfo, 0, sizeof(Link)); nreq->timeout = 4; /* start at 4 and exponential inc. */ +#ifdef INET6 + nreq->addr = in6addr_any; +#else nreq->addr.S_ADDR = INADDR_NONE; - +#endif nreq->he.h.h_addrtype = AFINET; nreq->he.h.h_length = sizeof(struct IN_ADDR); add_request(nreq); @@ -436,7 +456,12 @@ for (i = 0; i < max; ++i) { +#ifdef INET6 + /* still IPv4 */ + _res.nsaddr_list[i].sin_family = AF_INET; +#else _res.nsaddr_list[i].SIN_FAMILY = AFINET; +#endif if (sendto(resfd, msg, len, 0, (struct SOCKADDR *)&(_res.nsaddr_list[i]), sizeof(struct SOCKADDR)) == len) { @@ -554,7 +579,11 @@ if ((rptr = make_request(lp)) == NULL) return -1; rptr->type = T_PTR; +#ifdef INET6 + memcpy(rptr->addr.S_ADDR, numb->S_ADDR, IN6ADDRSZ); +#else rptr->addr.S_ADDR = numb->S_ADDR; +#endif } return (query_name(ipbuf, C_IN, T_PTR, rptr)); } @@ -846,7 +875,12 @@ Reg1 HEADER *hptr; Reg2 ResRQ *rptr = NULL; aCache *cp = NULL; +#ifdef INET6 + /* still IPv4 */ + struct sockaddr_in sin; +#else struct SOCKADDR_IN sin; +#endif int a, max; size_t rc, len = sizeof(sin); @@ -888,9 +922,16 @@ for (a = 0; a < max; a++) { +#ifdef INET6 + /* still IPv4 */ + if (!_res.nsaddr_list[a].sin_addr.s_addr || + !memcmp((char *)&sin.sin_addr, (char *)&_res.nsaddr_list[a].sin_addr, + sizeof(struct in_addr))) +#else if (!_res.nsaddr_list[a].SIN_ADDR.S_ADDR || !memcmp((char *)&sin.SIN_ADDR, (char *)&_res.nsaddr_list[a].SIN_ADDR, sizeof(struct IN_ADDR))) +#endif break; } if (a == max) @@ -1406,8 +1447,15 @@ hashv = hash_number((unsigned char *)numb); cp = hashtable[hashv].num_list; +#ifdef INET6 + Debug((DEBUG_DNS, + "find_cache_number:find %s[%08x%08x%08x%08x]: hashv = %d", + inetntoa(*numb), numb->S_ADDR[0], numb->S_ADDR[1], + numb->S_ADDR[2], numb->S_ADDR[3], hashv)); +#else Debug((DEBUG_DNS, "find_cache_number:find %s[%08x]: hashv = %d", inetntoa(*numb), ntohl(numb->S_ADDR), hashv)); +#endif for (; cp; cp = cp->hnum_next) { Index: s_bsd.c =================================================================== RCS file: /cvsroot/irc-dev/ipv6/ircd/s_bsd.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- s_bsd.c 12 Sep 2002 19:19:00 -0000 1.4 +++ s_bsd.c 14 Sep 2002 22:44:51 -0000 1.5 @@ -103,14 +103,13 @@ #define IP_LOOKUP_OK ":%s NOTICE IP_LOOKUP :*** Found your hostname.\r\n" #define IP_LOOKUP_CACHE ":%s NOTICE IP_LOOKUP :*** Found your hostname (CACHED!).\r\n" #define IP_LOOKUP_FAIL ":%s NOTICE IP_LOOKUP :*** Couldn't resolve your hostname.\r\n" +#ifdef INET6 +#define IP_LOOKUP_BAD ":%s NOTICE IP_LOOKUP :*** IP# Mismatch: %s != %s[%08x%08x%08x%08x], ignoring hostname.\r\n" +#else #define IP_LOOKUP_BAD ":%s NOTICE IP_LOOKUP :*** IP# Mismatch: %s != %s[%08x], ignoring hostname.\r\n" - - - -#ifndef IN_LOOPBACKNET -#define IN_LOOPBACKNET 0x7f #endif + aClient *loc_clients[MAXCONNECTIONS]; int highest_fd = 0, udpfd = -1, resfd = -1; unsigned int readcalls = 0; @@ -251,8 +250,16 @@ size_t len = sizeof(server); char ipname[20]; + if (BadPtr(name)) + name = "*"; ad[0] = ad[1] = ad[2] = ad[3] = 0; +#ifdef INET6 + if (*name == '*') + sprintf_irc(ipname, "::"); + else + sprintf_irc(ipname, "%s", name); +#else /* * do it this way because building ip# from separate values for each * byte requires endian knowledge or some nasty messing. Also means @@ -260,6 +267,7 @@ */ sscanf(name, "%d.%d.%d.%d", &ad[0], &ad[1], &ad[2], &ad[3]); sprintf_irc(ipname, "%d.%d.%d.%d", ad[0], ad[1], ad[2], ad[3]); +#endif if (cptr != &me) { @@ -302,6 +310,7 @@ if (port) { server.SIN_FAMILY = AFINET; +/* FIXME-ZOLTAN */ #ifndef VIRTUAL_HOST server.SIN_ADDR.S_ADDR = INADDR_ANY; #else @@ -341,7 +350,11 @@ } if (cptr->fd > highest_fd) highest_fd = cptr->fd; +#ifdef INET6 + memcpy(cptr->ip.S_ADDR, server.SIN_ADDR.S_ADDR, IN6ADDRSZ); +#else cptr->ip.S_ADDR = inet_addr(ipname); +#endif #ifdef TESTNET cptr->port = ntohs(server.SIN_PORT) - 10000; #else @@ -654,7 +667,11 @@ return -1; } strcpy(sockn, inetntoa(sk.SIN_ADDR)); +#ifdef INET6 + if (IN6_IS_ADDR_LOOPBACK(&sk.SIN_ADDR)) +#else if (inet_netof(sk.SIN_ADDR) == IN_LOOPBACKNET) +#endif { cptr->hostp = NULL; strncpy(sockn, me.name, HOSTLEN); @@ -706,13 +723,25 @@ break; if (!hp->h_addr_list[i]) { +#ifdef INET6 + sendto_op_mask(SNO_IPMISMATCH, "IP# Mismatch: %s != %s[%08x%08x%08x%08x]", + inetntoa(cptr->ip), hp->h_name, + ((unsigned long *)hp->h_addr)[0], ((unsigned long *)hp->h_addr)[1], + ((unsigned long *)hp->h_addr)[2], ((unsigned long *)hp->h_addr)[3]); +#else sendto_op_mask(SNO_IPMISMATCH, "IP# Mismatch: %s != %s[%08x]", inetntoa(cptr->ip), hp->h_name, *((unsigned int *)hp->h_addr)); +#endif if (IsUserPort(cptr)) { sprintf_irc(sendbuf, IP_LOOKUP_BAD, me.name, inetntoa(cptr->ip), hp->h_name, +#ifdef INET6 + ((unsigned long *)hp->h_addr)[0], ((unsigned long *)hp->h_addr)[1], + ((unsigned long *)hp->h_addr)[2], ((unsigned long *)hp->h_addr)[3]); +#else *((unsigned int *)hp->h_addr)); +#endif write(cptr->fd, sendbuf, strlen(sendbuf)); } hp = NULL; @@ -793,8 +822,13 @@ Debug((DEBUG_DNS, "ch_cl: access ok: %s[%s]", cptr->name, sockname)); +#ifdef INET6 + if (IN6_IS_ADDR_LOOPBACK(&cptr->ip) || IsUnixSocket(cptr) || + !memcmp(cptr->ip.s6_addr, mysk.sin6_addr.s6_addr, 8)) +#else if (inet_netof(cptr->ip) == IN_LOOPBACKNET || IsUnixSocket(cptr) || inet_netof(cptr->ip) == inet_netof(mysk.SIN_ADDR)) +#endif { ircstp->is_loc++; cptr->flags |= FLAGS_LOCAL; @@ -912,8 +946,15 @@ break; if (!hp->h_addr_list[i]) { +#ifdef INET6 + sendto_op_mask(SNO_IPMISMATCH, "IP# Mismatch: %s != %s[%08x%08x%08x%08x]", + inetntoa(cptr->ip), hp->h_name, + ((unsigned long *)hp->h_addr)[0], ((unsigned long *)hp->h_addr)[1], + ((unsigned long *)hp->h_addr)[2], ((unsigned long *)hp->h_addr)[3]); +#else sendto_op_mask(SNO_IPMISMATCH, "IP# Mismatch: %s != %s[%08x]", inetntoa(cptr->ip), hp->h_name, *((unsigned int *)hp->h_addr)); +#endif hp = NULL; } } @@ -1001,7 +1042,11 @@ attach_conf(cptr, c_conf); attach_confs(cptr, name, CONF_HUB | CONF_LEAF | CONF_UWORLD); +#ifdef INET6 + if ((AND16(c_conf->ipnum.s6_addr) == 255) && !IsUnixSocket(cptr)) +#else if ((c_conf->ipnum.S_ADDR == INADDR_NONE) && !IsUnixSocket(cptr)) +#endif memcpy(&c_conf->ipnum, &cptr->ip, sizeof(struct IN_ADDR)); if (!IsUnixSocket(cptr)) get_sockhost(cptr, c_conf->host); @@ -2252,9 +2297,16 @@ nextdnscheck = 1; s = strchr(aconf->host, '@'); s++; /* should NEVER be NULL */ + +#ifdef INET6 + if (!inetpton(AFINET, s, aconf->ipnum.S_ADDR)) + { + memset(aconf->ipnum.S_ADDR, 0x0, sizeof(struct IN_ADDR)); +#else if ((aconf->ipnum.S_ADDR = inet_addr(s)) == INADDR_NONE) { aconf->ipnum.S_ADDR = INADDR_ANY; +#endif hp = gethost_byname(s, &lin); Debug((DEBUG_NOTICE, "co_sv: hp %p ac %p na %s ho %s", hp, aconf, aconf->name, s)); @@ -2469,9 +2521,15 @@ * conf line, whether as a result of the hostname lookup or the ip# * being present instead. If we dont know it, then the connect fails. */ +#ifdef INET6 + if (!inet_pton(AFINET, aconf->host, aconf->ipnum.S_ADDR)) + memcpy(aconf->ipnum.S_ADDR, minus_one, IN6ADDRSZ); + if (AND16(aconf->ipnum.S_ADDR) == 255) +#else if (isDigit(*aconf->host) && (aconf->ipnum.S_ADDR == INADDR_NONE)) aconf->ipnum.S_ADDR = inet_addr(aconf->host); if (aconf->ipnum.S_ADDR == INADDR_NONE) +#endif { hp = cptr->hostp; if (!hp) @@ -2549,7 +2607,11 @@ */ memset(&mysk, 0, sizeof(mysk)); mysk.SIN_FAMILY = AFINET; +#ifdef INET6 + memset(mysk.SIN_ADDR.S_ADDR, 0x0, sizeof(struct IN_ADDR)); +#else mysk.SIN_ADDR.S_ADDR = INADDR_ANY; +#endif if (!aconf || BadPtr(aconf->host)) return; @@ -2557,9 +2619,16 @@ if (!BadPtr(aconf->passwd) && 0 != strcmp(aconf->passwd, "*")) { +#ifdef INET6 + memcpy(mysk.SIN_ADDR.S_ADDR, minus_one, IN6ADDRSZ); + if (AND16(mysk.SIN_ADDR.S_ADDR) == 255) + memset(mysk.SIN_ADDR.S_ADDR, 0x0, sizeof(struct IN_ADDR)); +#else mysk.SIN_ADDR.S_ADDR = inet_addr(aconf->passwd); if (INADDR_NONE == mysk.SIN_ADDR.S_ADDR) mysk.SIN_ADDR.S_ADDR = INADDR_ANY; +#endif + #ifdef VIRTUAL_HOST memcpy(&vserv, &mysk, sizeof(struct SOCKADDR_IN)); #endif Index: s_conf.c =================================================================== RCS file: /cvsroot/irc-dev/ipv6/ircd/s_conf.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- s_conf.c 14 Sep 2002 14:42:05 -0000 1.4 +++ s_conf.c 14 Sep 2002 22:44:51 -0000 1.5 @@ -1184,16 +1184,32 @@ ln.value.aconf = aconf; ln.flags = ASYNC_CONF; +#ifdef INET6 + if (inetpton(AF_INET6, s, aconf->ipnum.s6_addr)) + ; +#else if (isDigit(*s)) aconf->ipnum.S_ADDR = inet_addr(s); +#endif else if ((hp = gethost_byname(s, &ln))) memcpy(&(aconf->ipnum), hp->h_addr, sizeof(struct IN_ADDR)); - +#ifdef INET6 + else + { + memcpy(aconf->ipnum.S_ADDR, minus_one, IN6ADDRSZ); + goto badlookup; + } +#else if (aconf->ipnum.S_ADDR == INADDR_NONE) goto badlookup; +#endif return 0; badlookup: +#ifdef INET6 + if (AND16(aconf->ipnum.S_ADDR) == 255) +#else if (aconf->ipnum.S_ADDR == INADDR_NONE) +#endif memset(&aconf->ipnum, 0, sizeof(struct IN_ADDR)); Debug((DEBUG_ERROR, "Host/server name error: (%s) (%s)", aconf->host, aconf->name)); Index: s_debug.c =================================================================== RCS file: /cvsroot/irc-dev/ipv6/ircd/s_debug.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- s_debug.c 11 Sep 2002 10:09:09 -0000 1.1.1.1 +++ s_debug.c 14 Sep 2002 22:44:51 -0000 1.2 @@ -187,6 +187,9 @@ #ifdef USE_SYSLOG 'Y', #endif +#ifdef INET6 + '6', +#endif '.','E','S','N','E','T','.', #if CLIENT_FLOOD > 999 (char)('0' + (CLIENT_FLOOD/1000) % 10), Index: s_ping.c =================================================================== RCS file: /cvsroot/irc-dev/ipv6/ircd/s_ping.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- s_ping.c 12 Sep 2002 19:02:15 -0000 1.3 +++ s_ping.c 14 Sep 2002 22:44:51 -0000 1.4 @@ -284,9 +284,15 @@ s = strchr(cptr->sockhost, '@'); s++; /* should never be NULL; cptr->sockhost is actually a conf->host */ +#ifdef INET6 + if (!inetpton(AF_INET6, s, cptr->ip.S_ADDR)) + { + memcpy(cptr->ip.S_ADDR, minus_one, IN6ADDRSZ); +#else if ((cptr->ip.S_ADDR = inet_addr(s)) == INADDR_NONE) { cptr->ip.S_ADDR = INADDR_ANY; +#endif hp = gethost_byname(s, &lin); Debug((DEBUG_NOTICE, "ping_sv: hp %p ac %p ho %s", hp, cptr, s)); if (!hp) Index: s_serv.c =================================================================== RCS file: /cvsroot/irc-dev/ipv6/ircd/s_serv.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- s_serv.c 12 Sep 2002 19:02:15 -0000 1.2 +++ s_serv.c 14 Sep 2002 22:44:51 -0000 1.3 @@ -1045,7 +1045,20 @@ NumServ(acptr->user->server), acptr->name, acptr->hopcount + 1, acptr->lastnick, acptr->user->username, acptr->user->host, +#ifdef INET6 + /* FIXME-ZOLTAN */ +/* + s, inttobase64(xxx_buf, ntohl(acptr->ip.S_ADDR), 6), + s, + inttobase64(xxx_buf, ntohl(acptr->ip.S_ADDR[0]), 6), + inttobase64(xxx_buf, ntohl(acptr->ip.S_ADDR[1]), 6), + inttobase64(xxx_buf, ntohl(acptr->ip.S_ADDR[2]), 6), + inttobase64(xxx_buf, ntohl(acptr->ip.S_ADDR[3]), 6), +*/ + s, "AAAAAA", +#else s, inttobase64(xxx_buf, ntohl(acptr->ip.S_ADDR), 6), +#endif NumNick(acptr), acptr->info); } } Index: s_user.c =================================================================== RCS file: /cvsroot/irc-dev/ipv6/ircd/s_user.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- s_user.c 12 Sep 2002 19:19:00 -0000 1.3 +++ s_user.c 14 Sep 2002 22:44:51 -0000 1.4 @@ -730,7 +730,20 @@ "%s NICK %s %d %d %s %s %s%s %s%s :%s", NumServ(user->server), nick, sptr->hopcount + 1, (int)(sptr->lastnick), user->username, user->host, tmpstr, +#ifdef INET6 + /* FIXME-ZOLTAN */ +/* + inttobase64(ip_base64, ntohl(sptr->ip.S_ADDR), 6), + + inttobase64(xxx_buf, ntohl(acptr->ip.S_ADDR[0]), 6), + inttobase64(xxx_buf, ntohl(acptr->ip.S_ADDR[1]), 6), + inttobase64(xxx_buf, ntohl(acptr->ip.S_ADDR[2]), 6), + inttobase64(xxx_buf, ntohl(acptr->ip.S_ADDR[3]), 6), +*/ + "AAAAAA", +#else inttobase64(ip_base64, ntohl(sptr->ip.S_ADDR), 6), +#endif NumNick(sptr), sptr->info); for (lp = me.serv->down; lp; lp = lp->next) { @@ -1568,13 +1581,22 @@ if (Protocol(cptr) < 10) { SetRemoteNumNick(sptr, nnp9); +#ifdef INET6 + memset(sptr->ip.S_ADDR, 0x0, sizeof(struct IN_ADDR)); +#else sptr->ip.S_ADDR = 0; +#endif } else { #endif SetRemoteNumNick(sptr, parv[parc - 2]); +#ifdef INET6 +// if (!inetpton(AFINET, parv[parc - 3], sptr->ip.S_ADDR)) + memcpy(sptr->ip.S_ADDR, minus_one, IN6ADDRSZ); +#else sptr->ip.S_ADDR = htonl(base64toint(parv[parc - 3])); +#endif /* IP# of remote client */ #ifndef NO_PROTOCOL9 } Index: support.c =================================================================== RCS file: /cvsroot/irc-dev/ipv6/ircd/support.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- support.c 12 Sep 2002 19:02:15 -0000 1.2 +++ support.c 14 Sep 2002 22:44:51 -0000 1.3 @@ -126,6 +126,33 @@ return buf; } +#ifdef INET6 +/* + * inetpton(af, src, dst) + * + * This is a wrapper for inet_pton(), so we can use ipv4 addresses + * with an af of AF_INET6, and that it gets converted to ipv4 mapped ipv6. + * + */ +int inetpton(int af, const char *src, void *dst) +{ + int i; + + /* an empty string should listen to all */ + if (af == AF_INET6 && *src && !strchr(src, ':')) + { + i = inet_pton(AF_INET, src, dst); + + /* ugly hack */ + memcpy(dst + 12, dst, 4); + memset(dst, 0, 10); + memset(dst + 10, 0xff, 2); + return i; + } + return inet_pton(af, src, dst); +} +#endif + #ifndef HAVE_INET_NETOF /* * inet_netof -- return the net portion of an internet number Index: whocmds.c =================================================================== RCS file: /cvsroot/irc-dev/ipv6/ircd/whocmds.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- whocmds.c 12 Sep 2002 19:19:00 -0000 1.3 +++ whocmds.c 14 Sep 2002 22:44:51 -0000 1.4 @@ -637,10 +637,17 @@ || matchexec(acptr->info, mymask, minlen)) && ((!(matchsel & WHO_FIELD_NIP)) || (IsHidden(acptr) && !IsHiddenViewer(sptr)) - || ((((acptr->ip.S_ADDR & imask.mask.S_ADDR) != - imask.bits.S_ADDR)) || (imask.fall +#ifdef INET6 + /* still IPv4 */ + || (((((long)acptr->ip.S_ADDR & (long)imask.mask.s_addr) != + (long)imask.bits.s_addr)) || (imask.fall + && matchexec(inetntoa(acptr->ip), mymask, minlen))))) +#else + || (((((long)acptr->ip.S_ADDR & (long)imask.mask.S_ADDR) != + (long)imask.bits.S_ADDR)) || (imask.fall && matchexec(inet_ntoa(acptr->ip), mymask, minlen))))) - continue; +#endif + continue; #else if ((mask) && ((!(matchsel & WHO_FIELD_NIC)) @@ -654,10 +661,17 @@ && ((!(matchsel & WHO_FIELD_REN)) || matchexec(acptr->info, mymask, minlen)) && ((!(matchsel & WHO_FIELD_NIP)) - || ((((acptr->ip.S_ADDR & imask.mask.S_ADDR) != - imask.bits.S_ADDR)) || (imask.fall +#ifdef INET6 + /* still IPv4 */ + || (((((long)acptr->ip.S_ADDR & (long)imask.mask.s_addr) != + (long)imask.bits.s_addr)) || (imask.fall + && matchexec(inetntoa(acptr->ip), mymask, minlen))))) +#else + || (((((long)acptr->ip.S_ADDR & (long)imask.mask.S_ADDR) != + (long)imask.bits.S_ADDR)) || (imask.fall && matchexec(inet_ntoa(acptr->ip), mymask, minlen))))) - continue; +#endif + continue; #endif if (!SHOW_MORE(sptr, counter)) break; @@ -698,10 +712,17 @@ || matchexec(acptr->info, mymask, minlen)) && ((!(matchsel & WHO_FIELD_NIP)) || (IsHidden(acptr) && !IsHiddenViewer(sptr)) - || ((((acptr->ip.S_ADDR & imask.mask.S_ADDR) != imask.bits.S_ADDR)) - || (imask.fall +#ifdef INET6 + /* still IPv4 */ + || (((((long)acptr->ip.S_ADDR & (long)imask.mask.s_addr) != + (long)imask.bits.s_addr)) || (imask.fall + && matchexec(inetntoa(acptr->ip), mymask, minlen))))) +#else + || (((((long)acptr->ip.S_ADDR & (long)imask.mask.S_ADDR) != + (long)imask.bits.S_ADDR)) || (imask.fall && matchexec(inet_ntoa(acptr->ip), mymask, minlen))))) - continue; +#endif + continue; #else if ((mask) && ((!(matchsel & WHO_FIELD_NIC)) @@ -715,10 +736,17 @@ && ((!(matchsel & WHO_FIELD_REN)) || matchexec(acptr->info, mymask, minlen)) && ((!(matchsel & WHO_FIELD_NIP)) - || ((((acptr->ip.S_ADDR & imask.mask.S_ADDR) != imask.bits.S_ADDR)) - || (imask.fall +#ifdef INET6 + /* still IPv4 */ + || (((((long)acptr->ip.S_ADDR & (long)imask.mask.s_addr) != + (long)imask.bits.s_addr)) || (imask.fall + && matchexec(inetntoa(acptr->ip), mymask, minlen))))) +#else + || (((((long)acptr->ip.S_ADDR & (long)imask.mask.S_ADDR) != + (long)imask.bits.S_ADDR)) || (imask.fall && matchexec(inet_ntoa(acptr->ip), mymask, minlen))))) - continue; +#endif + continue; #endif if (!SHOW_MORE(sptr, counter)) break; |