[IPv6 IRC-DEV] Modulo Hispano-IPv6 ipv6/ircd IPcheck.c,1.4,1.5 ircd.c,1.3,1.4 s_bsd.c,1.5,1.6 s_conf
Brought to you by:
zolty
From: Zolty <zo...@us...> - 2002-09-16 12:22:16
|
Update of /cvsroot/irc-dev/ipv6/ircd In directory usw-pr-cvs1:/tmp/cvs-serv10753/ircd Modified Files: IPcheck.c ircd.c s_bsd.c s_conf.c s_misc.c s_serv.c s_user.c support.c Log Message: INET6.6 Index: IPcheck.c =================================================================== RCS file: /cvsroot/irc-dev/ipv6/ircd/IPcheck.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- IPcheck.c 14 Sep 2002 22:44:51 -0000 1.4 +++ IPcheck.c 16 Sep 2002 12:22:13 -0000 1.5 @@ -37,6 +37,7 @@ #include "support.h" #endif +#ifndef INET6 RCSTAG_CC("$Id$"); extern aClient me; @@ -101,11 +102,11 @@ * 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) + do { register char *ip; \ + memcpy(&ip, (IN_ADDR).S_ADDR, sizeof(struct IN_ADDR)); \ + hash = &IPregistry_hashtable[ip]; } while(0) #else /* * CALCULATE_HASH for IPv4 address @@ -162,7 +163,11 @@ { struct IPregistry *i, *end = &iprv->vector[iprv->length]; for (i = &iprv->vector[0]; i < end; ++i) +#ifdef INET6 + if (!memcmp(IP(i).S_ADDR, ip.S_ADDR, sizeof(struct IN_ADDR))) +#else if (IP(i).S_ADDR == ip.S_ADDR) +#endif return i; } return NULL; @@ -177,7 +182,11 @@ for (curr = &iprv->vector[0]; curr < last;) { +#ifdef INET6 + if (!memcmp(IP(curr).S_ADDR, ip.S_ADDR, sizeof(struct IN_ADDR))) +#else if (IP(curr).S_ADDR == ip.S_ADDR) +#endif /* `curr' is element we looked for */ retval = curr; else if (curr->connected == 0) @@ -212,7 +221,11 @@ ++curr; } /* Now check the last element in the list (curr == last) */ +#ifdef INET6 + if (!memcmp(IP(curr).S_ADDR, ip.S_ADDR, sizeof(struct IN_ADDR))) +#else if (IP(curr).S_ADDR == ip.S_ADDR) +#endif /* `curr' is element we looked for */ retval = curr; else if (curr->connected == 0) @@ -657,3 +670,4 @@ } #endif +#endif /* !INET6 */ Index: ircd.c =================================================================== RCS file: /cvsroot/irc-dev/ipv6/ircd/ircd.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- ircd.c 12 Sep 2002 19:02:14 -0000 1.3 +++ ircd.c 16 Sep 2002 12:22:13 -0000 1.4 @@ -70,6 +70,7 @@ #include "numnicks.h" #include "IPcheck.h" #include "s_bdd.h" +#include "inet.h" RCSTAG_CC("$Id$"); Index: s_bsd.c =================================================================== RCS file: /cvsroot/irc-dev/ipv6/ircd/s_bsd.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- s_bsd.c 14 Sep 2002 22:44:51 -0000 1.5 +++ s_bsd.c 16 Sep 2002 12:22:13 -0000 1.6 @@ -726,8 +726,8 @@ #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]); + ((unsigned int *)hp->h_addr)[0], ((unsigned int *)hp->h_addr)[1], + ((unsigned int *)hp->h_addr)[2], ((unsigned int *)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)); @@ -737,8 +737,8 @@ 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]); + ((unsigned int *)hp->h_addr)[0], ((unsigned int *)hp->h_addr)[1], + ((unsigned int *)hp->h_addr)[2], ((unsigned int *)hp->h_addr)[3]); #else *((unsigned int *)hp->h_addr)); #endif @@ -752,7 +752,7 @@ ** Gestion Distribuida de Clones */ -#if defined(BDD) && defined(BDD_CLONES) +#if defined(BDD) && defined(BDD_CLONES) && !defined(INET6) if (hp) { @@ -949,8 +949,8 @@ #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]); + ((unsigned int *)hp->h_addr)[0], ((unsigned int *)hp->h_addr)[1], + ((unsigned int *)hp->h_addr)[2], ((unsigned int *)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)); @@ -1522,6 +1522,7 @@ * If it is a connection to a user port and if the site has been throttled, * reject the user. */ +#ifndef INET6 if (IPcheck_local_connect(acptr) == -1 && IsUserPort(acptr)) { ircstp->is_ref++; @@ -1529,7 +1530,7 @@ "Your host is trying to (re)connect too fast -- throttled"); return NULL; } - +#endif /* INET6 */ #ifdef PROXY_PROTECTION if (IsUserPort(acptr)) { Index: s_conf.c =================================================================== RCS file: /cvsroot/irc-dev/ipv6/ircd/s_conf.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- s_conf.c 14 Sep 2002 22:44:51 -0000 1.5 +++ s_conf.c 16 Sep 2002 12:22:13 -0000 1.6 @@ -283,8 +283,10 @@ { /* Refuse connections when there are already <digit> clients connected with the same IP number */ unsigned short nr = *aconf->passwd - '0'; +#ifndef INET6 if (IPcheck_nr(cptr) > nr) return ACR_TOO_MANY_FROM_IP; /* Already got nr with that ip# */ +#endif } #ifdef USEONE else if (!strcmp(aconf->passwd, "ONE")) Index: s_misc.c =================================================================== RCS file: /cvsroot/irc-dev/ipv6/ircd/s_misc.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- s_misc.c 12 Sep 2002 19:19:00 -0000 1.2 +++ s_misc.c 16 Sep 2002 12:22:13 -0000 1.3 @@ -618,8 +618,10 @@ Count_unknowndisconnects(nrof); /* Update IPregistry */ +#ifndef INET6 if (IsIPChecked(bcptr)) IPcheck_disconnect(bcptr); +#endif /* * Remove from serv->client_list Index: s_serv.c =================================================================== RCS file: /cvsroot/irc-dev/ipv6/ircd/s_serv.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- s_serv.c 14 Sep 2002 22:44:51 -0000 1.3 +++ s_serv.c 16 Sep 2002 12:22:13 -0000 1.4 @@ -861,7 +861,9 @@ tx_num_serie_dbs(cptr); #endif +#ifndef INET6 IPcheck_connect_fail(cptr); /* Don't charge this IP# for connecting */ +#endif } det_confs_butmask(cptr, Index: s_user.c =================================================================== RCS file: /cvsroot/irc-dev/ipv6/ircd/s_user.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- s_user.c 14 Sep 2002 22:44:51 -0000 1.4 +++ s_user.c 16 Sep 2002 12:22:13 -0000 1.5 @@ -423,7 +423,9 @@ sendto_op_mask(SNO_TOOMANY, "Too many connections in class for %s.", sptr->sockhost); } +#ifndef INET6 IPcheck_connect_fail(sptr); +#endif ircstp->is_ref++; { char *msg = @@ -452,7 +454,9 @@ case ACR_ALREADY_AUTHORIZED: /* Can this ever happen? */ case ACR_BAD_SOCKET: +#ifndef INET6 IPcheck_connect_fail(sptr); +#endif return exit_client(cptr, sptr, &me, "Unknown error -- Try again"); } if (IsUnixSocket(sptr)) @@ -482,7 +486,9 @@ { ircstp->is_ref++; sendto_one(sptr, err_str(ERR_PASSWDMISMATCH), me.name, parv[0]); +#ifndef INET6 IPcheck_connect_fail(sptr); +#endif return exit_client(cptr, sptr, &me, "Bad Password"); } @@ -647,7 +653,9 @@ sendbufto_op_mask(SNO_CONNEXIT); #endif /* SNO_CONNEXIT_IP */ #endif /* ALLOW_SNO_CONNEXIT */ +#ifndef INET6 IPcheck_connect_succeeded(sptr); +#endif } else /* if (IsServer(cptr)) */ @@ -680,10 +688,12 @@ for (acptr = user->server; acptr != &me; acptr = acptr->serv->up) if (IsBurst(acptr) || Protocol(acptr) < 10) break; +#ifndef INET6 if (IPcheck_remote_connect(sptr, user->host, (acptr != &me)) == -1) /* We ran out of bits to count this */ return exit_client(cptr, sptr, &me, "More then 255 connections from this IP number"); +#endif } #ifdef NO_PROTOCOL9 /* Use this when all servers are 2.10 (but test it first) --Run */ @@ -1189,7 +1199,9 @@ */ if (IsUnknown(acptr) && MyConnect(acptr)) { +#ifndef INET6 IPcheck_connect_fail(acptr); +#endif exit_client(cptr, acptr, &me, "Overridden by other sign on"); goto nickkilldone; } Index: support.c =================================================================== RCS file: /cvsroot/irc-dev/ipv6/ircd/support.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- support.c 14 Sep 2002 22:44:51 -0000 1.3 +++ support.c 16 Sep 2002 12:22:13 -0000 1.4 @@ -151,6 +151,12 @@ } return inet_pton(af, src, dst); } + + +const unsigned char minus_one[] = { 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 0 +}; + #endif #ifndef HAVE_INET_NETOF |