[IPv6 IRC-DEV] Modulo Hispano-IPv6 ipv6/ircd IPcheck.c,1.2,1.3 channel.c,1.1.1.1,1.2 ircd.c,1.2,1.3
Brought to you by:
zolty
From: Zolty <zo...@us...> - 2002-09-12 19:02:18
|
Update of /cvsroot/irc-dev/ipv6/ircd In directory usw-pr-cvs1:/tmp/cvs-serv23000/ircd Modified Files: IPcheck.c channel.c ircd.c list.c match.c res.c s_auth.c s_bsd.c s_conf.c s_ping.c s_serv.c s_socks.c s_user.c support.c whocmds.c Log Message: INET6.2 Index: IPcheck.c =================================================================== RCS file: /cvsroot/irc-dev/ipv6/ircd/IPcheck.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- IPcheck.c 12 Sep 2002 16:38:57 -0000 1.2 +++ IPcheck.c 12 Sep 2002 19:02:14 -0000 1.3 @@ -48,7 +48,7 @@ * the channels he/she was on. */ struct ip_targets_st { - struct in_addr ip; + struct IN_ADDR ip; unsigned char free_targets; unsigned char targets[MAXTARGETS]; }; @@ -56,7 +56,7 @@ /* We keep one IPregistry for each IP number (for both, remote and local clients) */ struct IPregistry { union { - struct in_addr ip; /* The IP number of the registry entry. */ + struct IN_ADDR ip; /* The IP number of the registry entry. */ struct ip_targets_st *ptr; /* The IP number of the registry entry, and a list of targets */ } ip_targets; @@ -93,12 +93,15 @@ static struct IPregistry_vector IPregistry_hashtable[HASHTABSIZE]; /* - * Calculate a `hash' value between 0 and HASHTABSIZE, from the internet address `in_addr'. + * 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. */ -#define CALCULATE_HASH(in_addr) \ +/* + * CALCULATE_HASH for IPv4 address + */ +#define CALCULATE_HASH(IN_ADDR) \ struct IPregistry_vector *hash; \ - do { register unsigned int ip = (in_addr).s_addr; \ + do { register unsigned int ip = (IN_ADDR).S_ADDR; \ hash = &IPregistry_hashtable[((ip >> 14) + (ip >> 7) + ip) & (HASHTABSIZE - 1)]; } while(0) /* @@ -122,7 +125,7 @@ #error "That doesn't fit in 4 bits, does it?" #endif -/* IP(entry) returns the `struct in_addr' of the IPregistry. */ +/* IP(entry) returns the `struct IN_ADDR' of the IPregistry. */ #define IP(entry) (HAS_TARGETS(entry) ? (entry)->ip_targets.ptr->ip : (entry)->ip_targets.ip) #define FREE_TARGETS(entry) (HAS_TARGETS(entry) ? (entry)->ip_targets.ptr->free_targets : (entry)->free_targets) @@ -141,20 +144,20 @@ } static struct IPregistry *IPregistry_find(struct IPregistry_vector *iprv, - struct in_addr ip) + struct IN_ADDR ip) { if (iprv->length > 0) { struct IPregistry *i, *end = &iprv->vector[iprv->length]; for (i = &iprv->vector[0]; i < end; ++i) - if (IP(i).s_addr == ip.s_addr) + if (IP(i).S_ADDR == ip.S_ADDR) return i; } return NULL; } static struct IPregistry *IPregistry_find_with_expire(struct IPregistry_vector - *iprv, struct in_addr ip) + *iprv, struct IN_ADDR ip) { struct IPregistry *last = &iprv->vector[iprv->length - 1]; /* length always > 0 because searched element always exists */ struct IPregistry *curr; @@ -162,7 +165,7 @@ for (curr = &iprv->vector[0]; curr < last;) { - if (IP(curr).s_addr == ip.s_addr) + if (IP(curr).S_ADDR == ip.S_ADDR) /* `curr' is element we looked for */ retval = curr; else if (curr->connected == 0) @@ -187,7 +190,7 @@ else if (CONNECTED_SINCE(curr) > 120U && HAS_TARGETS(curr)) { /* Expire storage of targets */ - struct in_addr ip1 = curr->ip_targets.ptr->ip; + struct IN_ADDR ip1 = curr->ip_targets.ptr->ip; curr->free_targets = curr->ip_targets.ptr->free_targets; RunFree(curr->ip_targets.ptr); curr->ip_targets.ip = ip1; @@ -197,7 +200,7 @@ ++curr; } /* Now check the last element in the list (curr == last) */ - if (IP(curr).s_addr == ip.s_addr) + if (IP(curr).S_ADDR == ip.S_ADDR) /* `curr' is element we looked for */ retval = curr; else if (curr->connected == 0) @@ -219,7 +222,7 @@ else if (CONNECTED_SINCE(curr) > 120U && HAS_TARGETS(curr)) { /* Expire storage of targets */ - struct in_addr ip1 = curr->ip_targets.ptr->ip; + struct IN_ADDR ip1 = curr->ip_targets.ptr->ip; curr->free_targets = curr->ip_targets.ptr->free_targets; RunFree(curr->ip_targets.ptr); curr->ip_targets.ip = ip1; @@ -266,7 +269,7 @@ * IPcheck_local_connect * * Event: - * A new connection was accept()-ed with IP number `cptr->ip.s_addr'. + * A new connection was accept()-ed with IP number `cptr->ip.S_ADDR'. * * Action: * Update the IPcheck registry. @@ -370,7 +373,7 @@ * IPcheck_remote_connect * * Event: - * A remote client connected to Undernet, with IP number `cptr->ip.s_addr' + * A remote client connected to Undernet, with IP number `cptr->ip.S_ADDR' * and hostname `hostname'. * * Action: Index: channel.c =================================================================== RCS file: /cvsroot/irc-dev/ipv6/ircd/channel.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- channel.c 11 Sep 2002 10:09:08 -0000 1.1.1.1 +++ channel.c 12 Sep 2002 19:02:14 -0000 1.2 @@ -167,7 +167,7 @@ * Create a string of form "foo!bar@123.456.789.123" given foo, bar and the * IP-number as the parameters. If NULL, they become "*". */ -static char *make_nick_user_ip(char *nick, char *name, struct in_addr ip) +static char *make_nick_user_ip(char *nick, char *name, struct IN_ADDR ip) { static char ipbuf[NICKLEN + USERLEN + 16 + 3]; sprintf_irc(ipbuf, "%s!%s@%s", nick, name, inetntoa(ip)); Index: ircd.c =================================================================== RCS file: /cvsroot/irc-dev/ipv6/ircd/ircd.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ircd.c 12 Sep 2002 16:38:57 -0000 1.2 +++ ircd.c 12 Sep 2002 19:02:14 -0000 1.3 @@ -701,11 +701,11 @@ argv[0], p, h_errno); return -1; } - if (hep->h_addrtype == AF_INET && hep->h_addr_list[0] && + if (hep->h_addrtype == AFINET && hep->h_addr_list[0] && !hep->h_addr_list[1]) { - memcpy(&vserv.sin_addr, hep->h_addr_list[0], sizeof(struct in_addr)); - vserv.sin_family = AF_INET; + memcpy(&vserv.SIN_ADDR, hep->h_addr_list[0], sizeof(struct IN_ADDR)); + vserv.SIN_FAMILY = AFINET; } else { Index: list.c =================================================================== RCS file: /cvsroot/irc-dev/ipv6/ircd/list.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- list.c 11 Sep 2002 10:09:08 -0000 1.1.1.1 +++ list.c 12 Sep 2002 19:02:14 -0000 1.2 @@ -359,7 +359,7 @@ #ifdef DEBUGMODE aconfs.inuse++; #endif - memset(&aconf->ipnum, 0, sizeof(struct in_addr)); + memset(&aconf->ipnum, 0, sizeof(struct IN_ADDR)); aconf->next = NULL; aconf->host = aconf->passwd = aconf->name = NULL; aconf->status = CONF_ILLEGAL; Index: match.c =================================================================== RCS file: /cvsroot/irc-dev/ipv6/ircd/match.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- match.c 11 Sep 2002 10:09:08 -0000 1.1.1.1 +++ match.c 12 Sep 2002 19:02:14 -0000 1.2 @@ -1006,8 +1006,8 @@ } while (*m++); - imask->bits.s_addr = htonl(bits); - imask->mask.s_addr = htonl(filt); + imask->bits.S_ADDR = htonl(bits); + imask->mask.S_ADDR = htonl(filt); imask->fall = unco; return ((bits & ~filt) ? -1 : 0); Index: res.c =================================================================== RCS file: /cvsroot/irc-dev/ipv6/ircd/res.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- res.c 12 Sep 2002 16:38:57 -0000 1.2 +++ res.c 12 Sep 2002 19:02:14 -0000 1.3 @@ -39,8 +39,8 @@ #define RES_MAXALIASES 35 #define ALIASBLEN ((RES_MAXALIASES + 1) * sizeof(char *)) -#define ADDRSBLEN ((RES_MAXADDRS + 1) * sizeof(struct in_addr *)) -#define ADDRSDLEN (RES_MAXADDRS * sizeof(struct in_addr)) +#define ADDRSBLEN ((RES_MAXADDRS + 1) * sizeof(struct IN_ADDR *)) +#define ADDRSDLEN (RES_MAXADDRS * sizeof(struct IN_ADDR)) #define ALIASDLEN (MAXPACKET) #define MAXGETHOSTLEN (ALIASBLEN + ADDRSBLEN + ADDRSDLEN + ALIASDLEN) @@ -72,10 +72,10 @@ * | NULL | contains `char *'s * |-------------------------------| * | h_addr_list pointer array | Max size: ADDRSBLEN; - * | NULL | contains `struct in_addr *'s + * | NULL | contains `struct IN_ADDR *'s * |-------------------------------| * | h_addr_list addresses | Max size: ADDRSDLEN; - * | | contains `struct in_addr's + * | | contains `struct IN_ADDR's * |-------------------------------| * | storage for hostname strings | Max size: ALIASDLEN; * +-------------------------------+ contains `char's @@ -97,7 +97,7 @@ * strings area and is terminated with a NULL. The first alias * is stored directly after the h_name. * h_addr_list - contains a pointer to the start of h_addr_list pointer array. - * This array contains pointers to in_addr structures in the + * This array contains pointers to IN_ADDR structures in the * h_addr_list addresses area and is terminated with a NULL. * * Filling the buffer this way allows for proper alignment of the h_addr_list @@ -129,7 +129,7 @@ char resend; /* send flag. 0 == dont resend */ time_t sentat; time_t timeout; - struct in_addr addr; + struct IN_ADDR addr; char *name; struct reslist *next; Link cinfo; @@ -160,13 +160,13 @@ static void rem_cache(aCache *); static void rem_request(ResRQ *); static int do_query_name(Link *, char *, ResRQ *); -static int do_query_number(Link *, struct in_addr *, ResRQ *); +static int do_query_number(Link *, struct IN_ADDR *, ResRQ *); static void resend_query(ResRQ *); static int proc_answer(ResRQ *, HEADER *, unsigned char *, unsigned char *); static int query_name(char *, int, int, ResRQ *); static aCache *make_cache(ResRQ *); static aCache *find_cache_name(char *); -static aCache *find_cache_number(ResRQ *, struct in_addr *); +static aCache *find_cache_number(ResRQ *, struct IN_ADDR *); static int add_request(ResRQ *); static ResRQ *make_request(Link *); static int send_res_msg(char *, int, int); @@ -215,14 +215,14 @@ if (!_res.nscount) { _res.nscount = 1; - _res.nsaddr_list[0].sin_addr.s_addr = inet_addr("127.0.0.1"); + _res.nsaddr_list[0].SIN_ADDR.S_ADDR = inet_addr("127.0.0.1"); } #ifdef DEBUGMODE _res.options |= RES_DEBUG; #endif alarm(2); - fd = socket(AF_INET, SOCK_DGRAM, 0); + fd = socket(AFINET, SOCK_DGRAM, 0); alarm(0); if (fd < 0) { @@ -233,7 +233,7 @@ * socket at initialization time, it's pointless to continue. */ alarm(2); - if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) + if ((fd = socket(AFINET, SOCK_DGRAM, 0)) < 0) { alarm(0); Debug((DEBUG_ERROR, "init_resolver: socket: No more sockets")); @@ -318,10 +318,10 @@ else memset(&nreq->cinfo, 0, sizeof(Link)); nreq->timeout = 4; /* start at 4 and exponential inc. */ - nreq->addr.s_addr = INADDR_NONE; + nreq->addr.S_ADDR = INADDR_NONE; - nreq->he.h.h_addrtype = AF_INET; - nreq->he.h.h_length = sizeof(struct in_addr); + nreq->he.h.h_addrtype = AFINET; + nreq->he.h.h_length = sizeof(struct IN_ADDR); add_request(nreq); return nreq; } @@ -436,9 +436,9 @@ for (i = 0; i < max; ++i) { - _res.nsaddr_list[i].sin_family = AF_INET; - if (sendto(resfd, msg, len, 0, (struct sockaddr *)&(_res.nsaddr_list[i]), - sizeof(struct sockaddr)) == len) + _res.nsaddr_list[i].SIN_FAMILY = AFINET; + if (sendto(resfd, msg, len, 0, (struct SOCKADDR *)&(_res.nsaddr_list[i]), + sizeof(struct SOCKADDR)) == len) { reinfo.re_sent++; sent++; @@ -493,7 +493,7 @@ return NULL; } -struct hostent *gethost_byaddr(struct in_addr *addr, Link *lp) +struct hostent *gethost_byaddr(struct IN_ADDR *addr, Link *lp) { aCache *cp; @@ -540,10 +540,10 @@ /* * Use this to do reverse IP# lookups. */ -static int do_query_number(Link *lp, struct in_addr *numb, ResRQ *rptr) +static int do_query_number(Link *lp, struct IN_ADDR *numb, ResRQ *rptr) { char ipbuf[32]; - Reg2 unsigned char *cp = (unsigned char *)&numb->s_addr; + Reg2 unsigned char *cp = (unsigned char *)&numb->S_ADDR; sprintf_irc(ipbuf, "%u.%u.%u.%u.in-addr.arpa.", (unsigned int)(cp[3]), (unsigned int)(cp[2]), @@ -554,7 +554,7 @@ if ((rptr = make_request(lp)) == NULL) return -1; rptr->type = T_PTR; - rptr->addr.s_addr = numb->s_addr; + rptr->addr.S_ADDR = numb->S_ADDR; } return (query_name(ipbuf, C_IN, T_PTR, rptr)); } @@ -677,7 +677,7 @@ } /* make 'a' point to the first available empty address slot */ a = (char *)hp->h_addr_list + ADDRSBLEN + - (addr_count * sizeof(struct in_addr)); + (addr_count * sizeof(struct IN_ADDR)); /* find the end of the alias list */ alias = hp->h_aliases; @@ -766,15 +766,15 @@ { case T_A: /* check for invalid dlen or too many addresses */ - if (dlen != sizeof(struct in_addr) || ++addr_count >= RES_MAXADDRS) + if (dlen != sizeof(struct IN_ADDR) || ++addr_count >= RES_MAXADDRS) break; if (ans == 1) - hp->h_addrtype = (addr_class == C_IN) ? AF_INET : AF_UNSPEC; + hp->h_addrtype = (addr_class == C_IN) ? AFINET : AF_UNSPEC; - memcpy(a, cp, sizeof(struct in_addr)); + memcpy(a, cp, sizeof(struct IN_ADDR)); *addr++ = a; *addr = 0; - a += sizeof(struct in_addr); + a += sizeof(struct IN_ADDR); if (!hp->h_name) { @@ -784,7 +784,7 @@ } cp += dlen; Debug((DEBUG_DNS, "got ip # %s for %s", - inetntoa(*((struct in_addr *)hp->h_addr_list[addr_count - 1])), + inetntoa(*((struct IN_ADDR *)hp->h_addr_list[addr_count - 1])), hostbuf)); ans++; break; @@ -846,12 +846,12 @@ Reg1 HEADER *hptr; Reg2 ResRQ *rptr = NULL; aCache *cp = NULL; - struct sockaddr_in sin; + struct SOCKADDR_IN sin; int a, max; size_t rc, len = sizeof(sin); alarm(4); - rc = recvfrom(resfd, buf, sizeof(buf), 0, (struct sockaddr *)&sin, &len); + rc = recvfrom(resfd, buf, sizeof(buf), 0, (struct SOCKADDR *)&sin, &len); alarm(0); if (rc <= sizeof(HEADER)) @@ -888,9 +888,9 @@ for (a = 0; a < max; a++) { - 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))) + 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))) break; } if (a == max) @@ -1334,7 +1334,7 @@ { for (j = 0; (t = cp->he.h.h_addr_list[j]); j++) { - if (!memcmp(t, s, sizeof(struct in_addr))) + if (!memcmp(t, s, sizeof(struct IN_ADDR))) break; } if (!t) @@ -1398,7 +1398,7 @@ /* * Find a cache entry by ip# and update its expire time */ -static aCache *find_cache_number(ResRQ *rptr, struct in_addr *numb) +static aCache *find_cache_number(ResRQ *rptr, struct IN_ADDR *numb) { Reg1 aCache *cp; Reg2 int hashv, i; @@ -1407,14 +1407,14 @@ cp = hashtable[hashv].num_list; Debug((DEBUG_DNS, "find_cache_number:find %s[%08x]: hashv = %d", - inetntoa(*numb), ntohl(numb->s_addr), hashv)); + inetntoa(*numb), ntohl(numb->S_ADDR), hashv)); for (; cp; cp = cp->hnum_next) { for (i = 0; cp->he.h.h_addr_list[i]; ++i) { if (!memcmp(cp->he.h.h_addr_list[i], (char *)numb, - sizeof(struct in_addr))) + sizeof(struct IN_ADDR))) { cainfo.ca_nu_hits++; update_list(rptr, cp); @@ -1439,7 +1439,7 @@ for (i = 1; cp->he.h.h_addr_list[i]; ++i) { if (!memcmp(cp->he.h.h_addr_list[i], (char *)numb, - sizeof(struct in_addr))) + sizeof(struct IN_ADDR))) { cainfo.ca_nu_hits++; update_list(rptr, cp); @@ -1467,7 +1467,7 @@ */ for (i = 0; hp->h_addr_list[i]; ++i) { - if ((cp = find_cache_number(rptr, (struct in_addr *)hp->h_addr_list[i]))) + if ((cp = find_cache_number(rptr, (struct IN_ADDR *)hp->h_addr_list[i]))) return cp; } @@ -1548,7 +1548,7 @@ hashv = hash_number((unsigned char *)hp->h_addr_list[0]); Debug((DEBUG_DNS, "rem_cache: h_addr %s hashv %d next %p first %p", - inetntoa(*((struct in_addr *)hp->h_addr_list[0])), hashv, + inetntoa(*((struct IN_ADDR *)hp->h_addr_list[0])), hashv, ocp->hnum_next, hashtable[hashv].num_list)); for (cp = &hashtable[hashv].num_list; *cp; cp = &((*cp)->hnum_next)) { @@ -1620,13 +1620,13 @@ h = &cp->he.h; sendto_one(sptr, "NOTICE %s :Ex %d ttl %d host %s(%s)", parv[0], (int)(cp->expireat - now), (int)cp->ttl, - h->h_name, inetntoa(*((struct in_addr *)h->h_addr_list[0]))); + h->h_name, inetntoa(*((struct IN_ADDR *)h->h_addr_list[0]))); for (i = 0; h->h_aliases[i]; i++) sendto_one(sptr, "NOTICE %s : %s = %s (CN)", parv[0], h->h_name, h->h_aliases[i]); for (i = 1; h->h_addr_list[i]; i++) sendto_one(sptr, "NOTICE %s : %s = %s (IP)", parv[0], - h->h_name, inetntoa(*((struct in_addr *)h->h_addr_list[i]))); + h->h_name, inetntoa(*((struct IN_ADDR *)h->h_addr_list[i]))); } return 0; } @@ -1657,7 +1657,7 @@ for (i = 0; h->h_addr_list[i]; i++) { im += sizeof(char *); - im += sizeof(struct in_addr); + im += sizeof(struct IN_ADDR); } im += sizeof(char *); for (i = 0; h->h_aliases[i]; i++) Index: s_auth.c =================================================================== RCS file: /cvsroot/irc-dev/ipv6/ircd/s_auth.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- s_auth.c 12 Sep 2002 16:38:57 -0000 1.2 +++ s_auth.c 12 Sep 2002 19:02:14 -0000 1.3 @@ -70,7 +70,7 @@ */ void start_auth(aClient *cptr) { - struct sockaddr_in sock; + struct SOCKADDR_IN sock; int err; #ifndef HACER_IDENT @@ -100,7 +100,7 @@ } alarm(2); - cptr->authfd = socket(AF_INET, SOCK_STREAM, 0); + cptr->authfd = socket(AFINET, SOCK_STREAM, 0); err = errno; alarm(0); @@ -131,7 +131,7 @@ set_non_blocking(cptr->authfd, cptr); #ifdef VIRTUAL_HOST - if (bind(cptr->authfd, (struct sockaddr *)&vserv, sizeof(vserv)) == -1) + if (bind(cptr->authfd, (struct SOCKADDR *)&vserv, sizeof(vserv)) == -1) { report_error("binding auth stream socket %s: %s", cptr); close(cptr->authfd); @@ -139,13 +139,13 @@ return; } #endif - memcpy(&sock.sin_addr, &cptr->ip, sizeof(struct in_addr)); + memcpy(&sock.SIN_ADDR, &cptr->ip, sizeof(struct IN_ADDR)); - sock.sin_port = htons(113); - sock.sin_family = AF_INET; + sock.SIN_PORT = htons(113); + sock.SIN_FAMILY = AFINET; alarm((unsigned)4); - if (connect(cptr->authfd, (struct sockaddr *)&sock, + if (connect(cptr->authfd, (struct SOCKADDR *)&sock, sizeof(sock)) == -1 && errno != EINPROGRESS) { ircstp->is_abad++; @@ -187,15 +187,15 @@ */ void send_authports(aClient *cptr) { - struct sockaddr_in us, them; + struct SOCKADDR_IN us, them; char authbuf[32]; size_t ulen, tlen; Debug((DEBUG_NOTICE, "write_authports(%p) fd %d authfd %d stat %d", cptr, cptr->fd, cptr->authfd, cptr->status)); tlen = ulen = sizeof(us); - if (getsockname(cptr->fd, (struct sockaddr *)&us, &ulen) || - getpeername(cptr->fd, (struct sockaddr *)&them, &tlen)) + if (getsockname(cptr->fd, (struct SOCKADDR *)&us, &ulen) || + getpeername(cptr->fd, (struct SOCKADDR *)&them, &tlen)) { #ifdef USE_SYSLOG syslog(LOG_ERR, "auth get{sock,peer}name error for %s:%m", @@ -204,11 +204,11 @@ goto authsenderr; } - sprintf_irc(authbuf, "%u , %u\r\n", (unsigned int)ntohs(them.sin_port), - (unsigned int)ntohs(us.sin_port)); + sprintf_irc(authbuf, "%u , %u\r\n", (unsigned int)ntohs(them.SIN_PORT), + (unsigned int)ntohs(us.SIN_PORT)); Debug((DEBUG_SEND, "sending [%s] to auth port %s.113", - authbuf, inetntoa(them.sin_addr))); + authbuf, inetntoa(them.SIN_ADDR))); if (write(cptr->authfd, authbuf, strlen(authbuf)) != (int)strlen(authbuf)) { authsenderr: Index: s_bsd.c =================================================================== RCS file: /cvsroot/irc-dev/ipv6/ircd/s_bsd.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- s_bsd.c 12 Sep 2002 16:38:57 -0000 1.2 +++ s_bsd.c 12 Sep 2002 19:02:14 -0000 1.3 @@ -114,15 +114,15 @@ aClient *loc_clients[MAXCONNECTIONS]; int highest_fd = 0, udpfd = -1, resfd = -1; unsigned int readcalls = 0; -static struct sockaddr_in mysk; +static struct SOCKADDR_IN mysk; static void polludp(); -static struct sockaddr *connect_inet(aConfItem *, aClient *, int *); +static struct SOCKADDR *connect_inet(aConfItem *, aClient *, int *); static int completed_connection(aClient *); static int check_init(aClient *, char *); static void do_dns_async(), set_sock_opts(int, aClient *); #ifdef UNIXPORT -static struct sockaddr *connect_unix(aConfItem *, aClient *, int *); +static struct SOCKADDR *connect_unix(aConfItem *, aClient *, int *); static void add_unixconnection(aClient *, int); static char unixpath[256]; #endif @@ -132,7 +132,7 @@ static aClient *poll_cptr[MAXCONNECTIONS + 1]; #endif /* USE_POLL */ #ifdef VIRTUAL_HOST -struct sockaddr_in vserv; +struct SOCKADDR_IN vserv; #endif static int running_in_background; @@ -239,14 +239,14 @@ /* * inetport * - * Create a socket in the AF_INET domain, bind it to the port given in + * Create a socket in the AFINET domain, bind it to the port given in * 'port' and listen to it. Connections are accepted to this socket * depending on the IP# mask given by 'name'. Returns the fd of the * socket created or -1 on error. */ int inetport(aClient *cptr, char *name, unsigned short int port) { - static struct sockaddr_in server; + static struct SOCKADDR_IN server; int ad[4], opt; size_t len = sizeof(server); char ipname[20]; @@ -272,7 +272,7 @@ if (cptr->fd == -1) { alarm(2); - cptr->fd = socket(AF_INET, SOCK_STREAM, 0); + cptr->fd = socket(AFINET, SOCK_STREAM, 0); alarm(0); if (cptr->fd < 0 && errno == EAGAIN) { @@ -301,25 +301,25 @@ */ if (port) { - server.sin_family = AF_INET; + server.SIN_FAMILY = AFINET; #ifndef VIRTUAL_HOST - server.sin_addr.s_addr = INADDR_ANY; + server.SIN_ADDR.S_ADDR = INADDR_ANY; #else - server.sin_addr = vserv.sin_addr; + server.SIN_ADDR = vserv.SIN_ADDR; #endif #ifdef TESTNET - server.sin_port = htons(port + 10000); + server.SIN_PORT = htons(port + 10000); #else - server.sin_port = htons(port); + server.SIN_PORT = htons(port); #endif - if (bind(cptr->fd, (struct sockaddr *)&server, sizeof(server)) == -1) + if (bind(cptr->fd, (struct SOCKADDR *)&server, sizeof(server)) == -1) { report_error("binding stream socket %s: %s", cptr); close(cptr->fd); return -1; } } - if (getsockname(cptr->fd, (struct sockaddr *)&server, &len)) + if (getsockname(cptr->fd, (struct SOCKADDR *)&server, &len)) { report_error("getsockname failed for %s: %s", cptr); close(cptr->fd); @@ -332,20 +332,20 @@ #ifdef TESTNET sprintf_irc(buf, rpl_str(RPL_MYPORTIS), me.name, "*", - ntohs(server.sin_port) - 10000); + ntohs(server.SIN_PORT) - 10000); #else sprintf_irc(buf, rpl_str(RPL_MYPORTIS), me.name, "*", - ntohs(server.sin_port)); + ntohs(server.SIN_PORT)); #endif write(1, buf, strlen(buf)); } if (cptr->fd > highest_fd) highest_fd = cptr->fd; - cptr->ip.s_addr = inet_addr(ipname); + cptr->ip.S_ADDR = inet_addr(ipname); #ifdef TESTNET - cptr->port = ntohs(server.sin_port) - 10000; + cptr->port = ntohs(server.SIN_PORT) - 10000; #else - cptr->port = ntohs(server.sin_port); + cptr->port = ntohs(server.SIN_PORT); #endif listen(cptr->fd, 128); /* Use listen port backlog of 128 */ loc_clients[cptr->fd] = cptr; @@ -412,7 +412,7 @@ errno = 0; get_sockhost(cptr, unixpath); - if (bind(cptr->fd, (struct sockaddr *)&un, strlen(unixpath) + 2) == -1) + if (bind(cptr->fd, (struct SOCKADDR *)&un, strlen(unixpath) + 2) == -1) { report_error("error binding unix socket %s: %s", cptr); close(cptr->fd); @@ -629,8 +629,8 @@ */ static int check_init(aClient *cptr, char *sockn) { - struct sockaddr_in sk; - size_t len = sizeof(struct sockaddr_in); + struct SOCKADDR_IN sk; + size_t len = sizeof(struct SOCKADDR_IN); sockn[HOSTLEN] = 0; #ifdef UNIXPORT @@ -646,24 +646,24 @@ if (isatty(cptr->fd)) { strncpy(sockn, me.name, HOSTLEN); - memset(&sk, 0, sizeof(struct sockaddr_in)); + memset(&sk, 0, sizeof(struct SOCKADDR_IN)); } - else if (getpeername(cptr->fd, (struct sockaddr *)&sk, &len) == -1) + else if (getpeername(cptr->fd, (struct SOCKADDR *)&sk, &len) == -1) { report_error("connect failure: %s %s", cptr); return -1; } - strcpy(sockn, inetntoa(sk.sin_addr)); - if (inet_netof(sk.sin_addr) == IN_LOOPBACKNET) + strcpy(sockn, inetntoa(sk.SIN_ADDR)); + if (inet_netof(sk.SIN_ADDR) == IN_LOOPBACKNET) { cptr->hostp = NULL; strncpy(sockn, me.name, HOSTLEN); } - memcpy(&cptr->ip, &sk.sin_addr, sizeof(struct in_addr)); + memcpy(&cptr->ip, &sk.SIN_ADDR, sizeof(struct IN_ADDR)); #ifdef TESTNET - cptr->port = ntohs(sk.sin_port) - 10000; + cptr->port = ntohs(sk.SIN_PORT) - 10000; #else - cptr->port = ntohs(sk.sin_port); + cptr->port = ntohs(sk.SIN_PORT); #endif return 0; @@ -702,7 +702,7 @@ if (hp) { for (i = 0; hp->h_addr_list[i]; i++) - if (!memcmp(hp->h_addr_list[i], &cptr->ip, sizeof(struct in_addr))) + if (!memcmp(hp->h_addr_list[i], &cptr->ip, sizeof(struct IN_ADDR))) break; if (!hp->h_addr_list[i]) { @@ -794,7 +794,7 @@ Debug((DEBUG_DNS, "ch_cl: access ok: %s[%s]", cptr->name, sockname)); if (inet_netof(cptr->ip) == IN_LOOPBACKNET || IsUnixSocket(cptr) || - inet_netof(cptr->ip) == inet_netof(mysk.sin_addr)) + inet_netof(cptr->ip) == inet_netof(mysk.SIN_ADDR)) { ircstp->is_loc++; cptr->flags |= FLAGS_LOCAL; @@ -908,7 +908,7 @@ if (hp) { for (i = 0; hp->h_addr_list[i]; i++) - if (!memcmp(hp->h_addr_list[i], &cptr->ip, sizeof(struct in_addr))) + if (!memcmp(hp->h_addr_list[i], &cptr->ip, sizeof(struct IN_ADDR))) break; if (!hp->h_addr_list[i]) { @@ -1001,8 +1001,8 @@ attach_conf(cptr, c_conf); attach_confs(cptr, name, CONF_HUB | CONF_LEAF | CONF_UWORLD); - if ((c_conf->ipnum.s_addr == INADDR_NONE) && !IsUnixSocket(cptr)) - memcpy(&c_conf->ipnum, &cptr->ip, sizeof(struct in_addr)); + if ((c_conf->ipnum.S_ADDR == INADDR_NONE) && !IsUnixSocket(cptr)) + memcpy(&c_conf->ipnum, &cptr->ip, sizeof(struct IN_ADDR)); if (!IsUnixSocket(cptr)) get_sockhost(cptr, c_conf->host); @@ -1377,10 +1377,10 @@ else { Reg1 char *s, *t; - struct sockaddr_in addr; - size_t len = sizeof(struct sockaddr_in); + struct SOCKADDR_IN addr; + size_t len = sizeof(struct SOCKADDR_IN); - if (getpeername(fd, (struct sockaddr *)&addr, &len) == -1) + if (getpeername(fd, (struct SOCKADDR *)&addr, &len) == -1) { report_error("Failed in connecting to %s: %s", cptr); add_con_refuse: @@ -1397,12 +1397,12 @@ * Copy ascii address to 'sockhost' just in case. Then we * have something valid to put into error messages... */ - get_sockhost(acptr, inetntoa(addr.sin_addr)); - memcpy(&acptr->ip, &addr.sin_addr, sizeof(struct in_addr)); + get_sockhost(acptr, inetntoa(addr.SIN_ADDR)); + memcpy(&acptr->ip, &addr.SIN_ADDR, sizeof(struct IN_ADDR)); #ifdef TESTNET - acptr->port = ntohs(addr.sin_port) - 10000; + acptr->port = ntohs(addr.SIN_PORT) - 10000; #else - acptr->port = ntohs(addr.sin_port); + acptr->port = ntohs(addr.SIN_PORT); #endif /* @@ -1424,7 +1424,7 @@ lin.flags = ASYNC_CLIENT; lin.value.cptr = acptr; #ifdef NODNS - if (!strcmp("127.0.0.1", inetntoa(addr.sin_addr))) + if (!strcmp("127.0.0.1", inetntoa(addr.SIN_ADDR))) { static struct hostent lhe = { "localhost", NULL, 0, 0, NULL }; acptr->hostp = &lhe; @@ -1438,7 +1438,7 @@ else { #endif - Debug((DEBUG_DNS, "lookup %s", inetntoa(addr.sin_addr))); + Debug((DEBUG_DNS, "lookup %s", inetntoa(addr.SIN_ADDR))); acptr->hostp = gethost_byaddr(&acptr->ip, &lin); if (!acptr->hostp) { @@ -1531,7 +1531,7 @@ loc_clients[fd] = acptr; acptr->acpt = cptr; SetUnixSock(acptr); - memcpy(&acptr->ip, &me.ip, sizeof(struct in_addr)); + memcpy(&acptr->ip, &me.ip, sizeof(struct IN_ADDR)); Count_newunknown(nrof); add_client_to_list(acptr); @@ -2046,11 +2046,11 @@ } #if defined(USE_SYSLOG) && defined(SYSLOG_CONNECTS) { /* get an early log of all connections --dl */ - static struct sockaddr_in peer; + static struct SOCKADDR_IN peer; static int len; len = sizeof(peer); - getpeername(fd, (struct sockaddr *)&peer, &len); - syslog(LOG_DEBUG, "Conn: %s", inetntoa(peer.sin_addr)); + getpeername(fd, (struct SOCKADDR *)&peer, &len); + syslog(LOG_DEBUG, "Conn: %s", inetntoa(peer.SIN_ADDR)); } #endif ircstp->is_ac++; @@ -2192,7 +2192,7 @@ */ int connect_server(aConfItem *aconf, aClient *by, struct hostent *hp) { - Reg1 struct sockaddr *svp; + Reg1 struct SOCKADDR *svp; Reg2 aClient *cptr, *c2ptr; Reg3 char *s; int errtmp, len; @@ -2239,7 +2239,7 @@ * If we dont know the IP# for this host and itis a hostname and * not a ip# string, then try and find the appropriate host record. */ - if ((!aconf->ipnum.s_addr) + if ((!aconf->ipnum.S_ADDR) #ifdef UNIXPORT && ((aconf->host[2]) != '/') /* needed for Unix domain -- dl */ #endif @@ -2252,15 +2252,15 @@ nextdnscheck = 1; s = strchr(aconf->host, '@'); s++; /* should NEVER be NULL */ - if ((aconf->ipnum.s_addr = inet_addr(s)) == INADDR_NONE) + if ((aconf->ipnum.S_ADDR = inet_addr(s)) == INADDR_NONE) { - aconf->ipnum.s_addr = INADDR_ANY; + aconf->ipnum.S_ADDR = INADDR_ANY; hp = gethost_byname(s, &lin); Debug((DEBUG_NOTICE, "co_sv: hp %p ac %p na %s ho %s", hp, aconf, aconf->name, s)); if (!hp) return 0; - memcpy(&aconf->ipnum, hp->h_addr, sizeof(struct in_addr)); + memcpy(&aconf->ipnum, hp->h_addr, sizeof(struct IN_ADDR)); } } cptr = make_client(NULL, STAT_UNKNOWN); @@ -2403,9 +2403,9 @@ return 0; } -static struct sockaddr *connect_inet(aConfItem *aconf, aClient *cptr, int *lenp) +static struct SOCKADDR *connect_inet(aConfItem *aconf, aClient *cptr, int *lenp) { - static struct sockaddr_in server; + static struct SOCKADDR_IN server; Reg3 struct hostent *hp; /* @@ -2413,7 +2413,7 @@ * with it so if it fails its useless. */ alarm(2); - cptr->fd = socket(AF_INET, SOCK_STREAM, 0); + cptr->fd = socket(AFINET, SOCK_STREAM, 0); alarm(0); if (cptr->fd == -1 && errno == EAGAIN) { @@ -2431,14 +2431,14 @@ sendto_ops("No more connections allowed (%s)", cptr->name); return NULL; } - mysk.sin_port = 0; + mysk.SIN_PORT = 0; memset(&server, 0, sizeof(server)); - server.sin_family = AF_INET; + server.SIN_FAMILY = AFINET; get_sockhost(cptr, aconf->host); #ifdef VIRTUAL_HOST - mysk.sin_addr = vserv.sin_addr; + mysk.SIN_ADDR = vserv.SIN_ADDR; #endif /* @@ -2457,7 +2457,7 @@ * explicitly bind it, it will default to IN_ADDR_ANY and we lose * due to the other server not allowing our base IP --smg */ - if (bind(cptr->fd, (struct sockaddr *)&mysk, sizeof(mysk)) == -1) + if (bind(cptr->fd, (struct SOCKADDR *)&mysk, sizeof(mysk)) == -1) { report_error("error binding to local port for %s: %s", cptr); return NULL; @@ -2469,9 +2469,9 @@ * 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. */ - 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) + 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) { hp = cptr->hostp; if (!hp) @@ -2479,17 +2479,17 @@ Debug((DEBUG_FATAL, "%s: unknown host", aconf->host)); return NULL; } - memcpy(&aconf->ipnum, hp->h_addr, sizeof(struct in_addr)); + memcpy(&aconf->ipnum, hp->h_addr, sizeof(struct IN_ADDR)); } - memcpy(&server.sin_addr, &aconf->ipnum, sizeof(struct in_addr)); - memcpy(&cptr->ip, &aconf->ipnum, sizeof(struct in_addr)); + memcpy(&server.SIN_ADDR, &aconf->ipnum, sizeof(struct IN_ADDR)); + memcpy(&cptr->ip, &aconf->ipnum, sizeof(struct IN_ADDR)); #ifdef TESTNET - server.sin_port = htons(((aconf->port > 0) ? aconf->port : portnum) + 10000); + server.SIN_PORT = htons(((aconf->port > 0) ? aconf->port : portnum) + 10000); #else - server.sin_port = htons(((aconf->port > 0) ? aconf->port : portnum)); + server.SIN_PORT = htons(((aconf->port > 0) ? aconf->port : portnum)); #endif *lenp = sizeof(server); - return (struct sockaddr *)&server; + return (struct SOCKADDR *)&server; } #ifdef UNIXPORT @@ -2499,7 +2499,7 @@ * Build a socket structure for cptr so that it can connet to the unix * socket defined by the conf structure aconf. */ -static struct sockaddr *connect_unix(aConfItem *aconf, aClient *cptr, int *lenp) +static struct SOCKADDR *connect_unix(aConfItem *aconf, aClient *cptr, int *lenp) { static struct sockaddr_un sock; @@ -2531,7 +2531,7 @@ *lenp = strlen(sock.sun_path) + 2; SetUnixSock(cptr); - return (struct sockaddr *)&sock; + return (struct SOCKADDR *)&sock; } #endif @@ -2548,8 +2548,8 @@ * Setup local socket structure to use for binding to. */ memset(&mysk, 0, sizeof(mysk)); - mysk.sin_family = AF_INET; - mysk.sin_addr.s_addr = INADDR_ANY; + mysk.SIN_FAMILY = AFINET; + mysk.SIN_ADDR.S_ADDR = INADDR_ANY; if (!aconf || BadPtr(aconf->host)) return; @@ -2557,11 +2557,11 @@ if (!BadPtr(aconf->passwd) && 0 != strcmp(aconf->passwd, "*")) { - mysk.sin_addr.s_addr = inet_addr(aconf->passwd); - if (INADDR_NONE == mysk.sin_addr.s_addr) - mysk.sin_addr.s_addr = INADDR_ANY; + mysk.SIN_ADDR.S_ADDR = inet_addr(aconf->passwd); + if (INADDR_NONE == mysk.SIN_ADDR.S_ADDR) + mysk.SIN_ADDR.S_ADDR = INADDR_ANY; #ifdef VIRTUAL_HOST - memcpy(&vserv, &mysk, sizeof(struct sockaddr_in)); + memcpy(&vserv, &mysk, sizeof(struct SOCKADDR_IN)); #endif } Debug((DEBUG_DEBUG, "local name is %s", get_client_name(&me, TRUE))); @@ -2572,23 +2572,23 @@ */ int setup_ping(void) { - struct sockaddr_in from; + struct SOCKADDR_IN from; int on = 1; memset(&from, 0, sizeof(from)); #ifdef VIRTUAL_HOST - from.sin_addr = vserv.sin_addr; + from.SIN_ADDR = vserv.SIN_ADDR; #else - from.sin_addr.s_addr = htonl(INADDR_ANY); + from.SIN_ADDR.S_ADDR = htonl(INADDR_ANY); #endif #ifdef TESTNET - from.sin_port = htons(atoi(UDP_PORT) + 10000); + from.SIN_PORT = htons(atoi(UDP_PORT) + 10000); #else - from.sin_port = htons(atoi(UDP_PORT)); + from.SIN_PORT = htons(atoi(UDP_PORT)); #endif - from.sin_family = AF_INET; + from.SIN_FAMILY = AFINET; - if ((udpfd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) + if ((udpfd = socket(AFINET, SOCK_DGRAM, 0)) == -1) { Debug((DEBUG_ERROR, "socket udp : %s", strerror(errno))); return -1; @@ -2606,10 +2606,10 @@ } on = 0; setsockopt(udpfd, SOL_SOCKET, SO_BROADCAST, (char *)&on, sizeof(on)); - if (bind(udpfd, (struct sockaddr *)&from, sizeof(from)) == -1) + if (bind(udpfd, (struct SOCKADDR *)&from, sizeof(from)) == -1) { #ifdef USE_SYSLOG - syslog(LOG_ERR, "bind udp.%d fd %d : %m", from.sin_port, udpfd); + syslog(LOG_ERR, "bind udp.%d fd %d : %m", from.SIN_PORT, udpfd); #endif Debug((DEBUG_ERROR, "bind : %s", strerror(errno))); close(udpfd); @@ -2632,7 +2632,7 @@ static void polludp(void) { Reg1 char *s; - struct sockaddr_in from; + struct SOCKADDR_IN from; int n; size_t fromlen = sizeof(from); static time_t last = 0; @@ -2650,7 +2650,7 @@ } Debug((DEBUG_DEBUG, "udp poll")); - n = recvfrom(udpfd, readbuf, mlen, 0, (struct sockaddr *)&from, &fromlen); + n = recvfrom(udpfd, readbuf, mlen, 0, (struct SOCKADDR *)&from, &fromlen); if (now == last) if (++cnt > 14) return; @@ -2681,7 +2681,7 @@ strcpy(s, version); s += strlen(s); sendto(udpfd, readbuf, s - readbuf, 0, - (struct sockaddr *)&from, sizeof(from)); + (struct SOCKADDR *)&from, sizeof(from)); return; } @@ -2742,7 +2742,7 @@ aconf = ln.value.aconf; if (hp && aconf) { - memcpy(&aconf->ipnum, hp->h_addr, sizeof(struct in_addr)); + memcpy(&aconf->ipnum, hp->h_addr, sizeof(struct IN_ADDR)); connect_server(aconf, NULL, hp); } else @@ -2754,7 +2754,7 @@ del_queries((char *)cptr); if (hp) { - memcpy(&cptr->ip, hp->h_addr, sizeof(struct in_addr)); + memcpy(&cptr->ip, hp->h_addr, sizeof(struct IN_ADDR)); if (ping_server(cptr) == -1) end_ping(cptr); } @@ -2767,7 +2767,7 @@ case ASYNC_CONF: aconf = ln.value.aconf; if (hp && aconf) - memcpy(&aconf->ipnum, hp->h_addr, sizeof(struct in_addr)); + memcpy(&aconf->ipnum, hp->h_addr, sizeof(struct IN_ADDR)); break; default: break; Index: s_conf.c =================================================================== RCS file: /cvsroot/irc-dev/ipv6/ircd/s_conf.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- s_conf.c 12 Sep 2002 16:38:57 -0000 1.2 +++ s_conf.c 12 Sep 2002 19:02:15 -0000 1.3 @@ -290,7 +290,7 @@ { for (i = highest_fd; i >= 0; i--) if (loc_clients[i] && MyUser(loc_clients[i]) && - loc_clients[i]->ip.s_addr == cptr->ip.s_addr) + loc_clients[i]->ip.S_ADDR == cptr->ip.S_ADDR) return ACR_TOO_MANY_FROM_IP; /* Already got one with that ip# */ } #endif @@ -581,7 +581,7 @@ continue; } *s = '@'; - if (!memcmp(&tmp->ipnum, ip, sizeof(struct in_addr))) + if (!memcmp(&tmp->ipnum, ip, sizeof(struct IN_ADDR))) return tmp; } return NULL; @@ -1184,16 +1184,16 @@ ln.flags = ASYNC_CONF; if (isDigit(*s)) - aconf->ipnum.s_addr = inet_addr(s); + aconf->ipnum.S_ADDR = inet_addr(s); else if ((hp = gethost_byname(s, &ln))) - memcpy(&(aconf->ipnum), hp->h_addr, sizeof(struct in_addr)); + memcpy(&(aconf->ipnum), hp->h_addr, sizeof(struct IN_ADDR)); - if (aconf->ipnum.s_addr == INADDR_NONE) + if (aconf->ipnum.S_ADDR == INADDR_NONE) goto badlookup; return 0; badlookup: - if (aconf->ipnum.s_addr == INADDR_NONE) - memset(&aconf->ipnum, 0, sizeof(struct in_addr)); + if (aconf->ipnum.S_ADDR == INADDR_NONE) + memset(&aconf->ipnum, 0, sizeof(struct IN_ADDR)); Debug((DEBUG_ERROR, "Host/server name error: (%s) (%s)", aconf->host, aconf->name)); return -1; Index: s_ping.c =================================================================== RCS file: /cvsroot/irc-dev/ipv6/ircd/s_ping.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- s_ping.c 12 Sep 2002 16:38:57 -0000 1.2 +++ s_ping.c 12 Sep 2002 19:02:15 -0000 1.3 @@ -94,20 +94,20 @@ */ int start_ping(aClient *cptr) { - struct sockaddr_in remote_addr; + struct SOCKADDR_IN remote_addr; Debug((DEBUG_NOTICE, "start_ping(%p) status %d", cptr, cptr->status)); if (!(cptr->acpt)) return -1; - memcpy(&remote_addr.sin_addr, &cptr->ip, sizeof(struct in_addr)); + memcpy(&remote_addr.SIN_ADDR, &cptr->ip, sizeof(struct IN_ADDR)); #ifdef TESTNET - remote_addr.sin_port = htons(cptr->port + 10000); + remote_addr.SIN_PORT = htons(cptr->port + 10000); #else - remote_addr.sin_port = htons(cptr->port); + remote_addr.SIN_PORT = htons(cptr->port); #endif - remote_addr.sin_family = AF_INET; + remote_addr.SIN_FAMILY = AFINET; if (MyUser(cptr->acpt) || Protocol(cptr->acpt->from) < 10) { @@ -137,16 +137,16 @@ */ void send_ping(aClient *cptr) { - struct sockaddr_in remote_addr; + struct SOCKADDR_IN remote_addr; struct timeval tv; - memcpy(&remote_addr.sin_addr, &cptr->ip, sizeof(struct in_addr)); + memcpy(&remote_addr.SIN_ADDR, &cptr->ip, sizeof(struct IN_ADDR)); #ifdef TESTNET - remote_addr.sin_port = htons(cptr->port + 10000); + remote_addr.SIN_PORT = htons(cptr->port + 10000); #else - remote_addr.sin_port = htons(cptr->port); + remote_addr.SIN_PORT = htons(cptr->port); #endif - remote_addr.sin_family = AF_INET; + remote_addr.SIN_FAMILY = AFINET; gettimeofday(&tv, NULL); #if defined(__sun__) || (__GLIBC__ >= 2) || defined(__NetBSD__) @@ -157,10 +157,10 @@ Debug((DEBUG_SEND, "send_ping: sending [%s %s] to %s.%d on %d", (char *)cptr->confs, (char *)cptr->confs + 12, - inetntoa(remote_addr.sin_addr), ntohs(remote_addr.sin_port), cptr->fd)); + inetntoa(remote_addr.SIN_ADDR), ntohs(remote_addr.SIN_PORT), cptr->fd)); if (sendto(cptr->fd, (char *)cptr->confs, 1024, 0, - (struct sockaddr *)&remote_addr, sizeof(struct sockaddr_in)) != 1024) + (struct SOCKADDR *)&remote_addr, sizeof(struct SOCKADDR_IN)) != 1024) { #ifdef DEBUGMODE int err = errno; @@ -196,25 +196,25 @@ */ void read_ping(aClient *cptr) { - size_t addr_len = sizeof(struct sockaddr_in); - struct sockaddr_in remote_addr; + size_t addr_len = sizeof(struct SOCKADDR_IN); + struct SOCKADDR_IN remote_addr; struct timeval tv; int len; unsigned long int pingtime; char *s; - memcpy(&remote_addr.sin_addr, &cptr->ip, sizeof(struct in_addr)); + memcpy(&remote_addr.SIN_ADDR, &cptr->ip, sizeof(struct IN_ADDR)); #ifdef TESTNET - remote_addr.sin_port = htons(cptr->port + 10000); + remote_addr.SIN_PORT = htons(cptr->port + 10000); #else - remote_addr.sin_port = htons(cptr->port); + remote_addr.SIN_PORT = htons(cptr->port); #endif - remote_addr.sin_family = AF_INET; + remote_addr.SIN_FAMILY = AFINET; gettimeofday(&tv, NULL); if ((len = recvfrom(cptr->fd, (char *)cptr->confs, UPINGBUFSIZE, 0, - (struct sockaddr *)&remote_addr, &addr_len)) == -1) + (struct SOCKADDR *)&remote_addr, &addr_len)) == -1) { int err = errno; if (MyUser(cptr->acpt) @@ -265,7 +265,7 @@ int ping_server(aClient *cptr) { - if ((!cptr->ip.s_addr) + if ((!cptr->ip.S_ADDR) #ifdef UNIXPORT && ((cptr->sockhost[2]) != '/') #endif @@ -284,14 +284,14 @@ s = strchr(cptr->sockhost, '@'); s++; /* should never be NULL; cptr->sockhost is actually a conf->host */ - if ((cptr->ip.s_addr = inet_addr(s)) == INADDR_NONE) + if ((cptr->ip.S_ADDR = inet_addr(s)) == INADDR_NONE) { - cptr->ip.s_addr = INADDR_ANY; + cptr->ip.S_ADDR = INADDR_ANY; hp = gethost_byname(s, &lin); Debug((DEBUG_NOTICE, "ping_sv: hp %p ac %p ho %s", hp, cptr, s)); if (!hp) return 0; - memcpy(&cptr->ip, hp->h_addr, sizeof(struct in_addr)); + memcpy(&cptr->ip, hp->h_addr, sizeof(struct IN_ADDR)); } } @@ -412,7 +412,7 @@ port = atoi(UDP_PORT); alarm(2); - if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) + if ((fd = socket(AFINET, SOCK_DGRAM, 0)) == -1) { int err = errno; alarm(0); @@ -489,7 +489,7 @@ strcpy(cptr->sockhost, aconf->host); cptr->acpt = sptr; SetAskedPing(sptr); - memcpy(&cptr->ip, &aconf->ipnum, sizeof(struct in_addr)); + memcpy(&cptr->ip, &aconf->ipnum, sizeof(struct IN_ADDR)); strcpy(cptr->name, aconf->name); cptr->firsttime = 0; Index: s_serv.c =================================================================== RCS file: /cvsroot/irc-dev/ipv6/ircd/s_serv.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- s_serv.c 11 Sep 2002 10:09:09 -0000 1.1.1.1 +++ s_serv.c 12 Sep 2002 19:02:15 -0000 1.2 @@ -1045,7 +1045,7 @@ NumServ(acptr->user->server), acptr->name, acptr->hopcount + 1, acptr->lastnick, acptr->user->username, acptr->user->host, - s, inttobase64(xxx_buf, ntohl(acptr->ip.s_addr), 6), + s, inttobase64(xxx_buf, ntohl(acptr->ip.S_ADDR), 6), NumNick(acptr), acptr->info); } } Index: s_socks.c =================================================================== RCS file: /cvsroot/irc-dev/ipv6/ircd/s_socks.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- s_socks.c 12 Sep 2002 16:38:57 -0000 1.2 +++ s_socks.c 12 Sep 2002 19:02:15 -0000 1.3 @@ -108,7 +108,7 @@ */ void start_socks(aClient *cptr) { - struct sockaddr_in sock; + struct SOCKADDR_IN sock; int err; char text[1024]; int cache; @@ -141,7 +141,7 @@ cptr, cptr->fd, cptr->status)); alarm(2); - cptr->socksfd = socket(AF_INET, SOCK_STREAM, 0); + cptr->socksfd = socket(AFINET, SOCK_STREAM, 0); err = errno; alarm(0); if (cptr->socksfd < 0 && err == EAGAIN) @@ -172,21 +172,21 @@ set_non_blocking(cptr->socksfd, cptr); #ifdef VIRTUAL_HOST - if (bind(cptr->socksfd, (struct sockaddr *)&vserv, sizeof(vserv)) == -1) + if (bind(cptr->socksfd, (struct SOCKADDR *)&vserv, sizeof(vserv)) == -1) { report_error("binding socks stream socket %s: %s", cptr); close(cptr->fd); return; } #endif - memcpy(&sock.sin_addr, &cptr->ip, sizeof(struct in_addr)); + memcpy(&sock.SIN_ADDR, &cptr->ip, sizeof(struct IN_ADDR)); - sock.sin_port = htons(1080); - sock.sin_family = AF_INET; + sock.SIN_PORT = htons(1080); + sock.SIN_FAMILY = AFINET; sprintf_irc(text, PROXY_START, me.name); write(cptr->fd, text, strlen(text)); alarm((unsigned)4); - if (connect(cptr->socksfd, (struct sockaddr *)&sock, + if (connect(cptr->socksfd, (struct SOCKADDR *)&sock, sizeof(sock)) == -1 && errno != EINPROGRESS) { ircstp->is_abad++; @@ -219,7 +219,7 @@ */ void send_socksports(aClient *cptr) { - struct sockaddr_in us, them; + struct SOCKADDR_IN us, them; char socksbuf[255], *uname; size_t ulen, tlen; struct socks4 *sk; @@ -228,8 +228,8 @@ Debug((DEBUG_NOTICE, "write_socksports(%p) fd %d socksfd %d stat %d", cptr, cptr->fd, cptr->socksfd, cptr->status)); tlen = ulen = sizeof(us); - if (getsockname(cptr->fd, (struct sockaddr *)&us, &ulen) || - getpeername(cptr->fd, (struct sockaddr *)&them, &tlen)) + if (getsockname(cptr->fd, (struct SOCKADDR *)&us, &ulen) || + getpeername(cptr->fd, (struct SOCKADDR *)&them, &tlen)) { #ifdef USE_SYSLOG syslog(LOG_ERR, "socks get{sock,peer}name error for %s:%m", @@ -243,13 +243,13 @@ sk->vn = 4; sk->cd = 1; - sk->dstport = us.sin_port; - sk->dstip = us.sin_addr.s_addr; + sk->dstport = us.SIN_PORT; + sk->dstip = us.SIN_ADDR.S_ADDR; /* Ningun nombre de usuario */ *uname = '\0'; Debug((DEBUG_SEND, "sending connection request to socks port %s.1080", - inetntoa(them.sin_addr))); + inetntoa(them.SIN_ADDR))); if (write(cptr->socksfd, socksbuf, sizeof(struct socks4) + strlen(uname) + 1) != (int)(sizeof(struct socks4) + strlen(uname) + 1)) { Index: s_user.c =================================================================== RCS file: /cvsroot/irc-dev/ipv6/ircd/s_user.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- s_user.c 11 Sep 2002 10:09:09 -0000 1.1.1.1 +++ s_user.c 12 Sep 2002 19:02:15 -0000 1.2 @@ -693,7 +693,7 @@ "%s NICK %s %d %d %s %s %s%s %s%s :%s", NumServ(user->server), nick, sptr->hopcount + 1, sptr->lastnick, user->username, user->host, tmpstr, - inttobase64(ip_base64, ntohl(sptr->ip.s_addr), 6), + inttobase64(ip_base64, ntohl(sptr->ip.S_ADDR), 6), NumNick(sptr), sptr->info); #else /* Remove the following when all servers are 2.10 */ @@ -730,7 +730,7 @@ "%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, - inttobase64(ip_base64, ntohl(sptr->ip.s_addr), 6), + inttobase64(ip_base64, ntohl(sptr->ip.S_ADDR), 6), NumNick(sptr), sptr->info); for (lp = me.serv->down; lp; lp = lp->next) { @@ -1563,13 +1563,13 @@ if (Protocol(cptr) < 10) { SetRemoteNumNick(sptr, nnp9); - sptr->ip.s_addr = 0; + sptr->ip.S_ADDR = 0; } else { #endif SetRemoteNumNick(sptr, parv[parc - 2]); - sptr->ip.s_addr = htonl(base64toint(parv[parc - 3])); + sptr->ip.S_ADDR = htonl(base64toint(parv[parc - 3])); /* IP# of remote client */ #ifndef NO_PROTOCOL9 } @@ -4241,7 +4241,7 @@ k[1] = base64toint(clave + 6); v[0] = (k[0] & 0xffff0000) + ts; - v[1] = ntohl((unsigned long)acptr->ip.s_addr); + v[1] = ntohl((unsigned long)acptr->ip.S_ADDR); tea(v, k, x); Index: support.c =================================================================== RCS file: /cvsroot/irc-dev/ipv6/ircd/support.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- support.c 11 Sep 2002 10:09:09 -0000 1.1.1.1 +++ support.c 12 Sep 2002 19:02:15 -0000 1.2 @@ -111,10 +111,10 @@ * -argv 11/90. * inet_ntoa -- Its broken on some Ultrix/Dynix too. -avalon */ -char *inetntoa(struct in_addr in) +char *inetntoa(struct IN_ADDR in) { static char buf[16]; - Reg1 unsigned char *s = (unsigned char *)&in.s_addr; + Reg1 unsigned char *s = (unsigned char *)&in.S_ADDR; Reg2 unsigned char a, b, c, d; a = *s++; @@ -131,7 +131,7 @@ * inet_netof -- return the net portion of an internet number * argv 11/90 */ -int inet_netof(struct in_addr in) +int inet_netof(struct IN_ADDR in) { int addr = in.s_net; Index: whocmds.c =================================================================== RCS file: /cvsroot/irc-dev/ipv6/ircd/whocmds.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- whocmds.c 11 Sep 2002 10:09:09 -0000 1.1.1.1 +++ whocmds.c 12 Sep 2002 19:02:15 -0000 1.2 @@ -634,8 +634,8 @@ || 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 + || ((((acptr->ip.S_ADDR & imask.mask.S_ADDR) != + imask.bits.S_ADDR)) || (imask.fall && matchexec(inet_ntoa(acptr->ip), mymask, minlen))))) continue; #else @@ -651,8 +651,8 @@ && ((!(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 + || ((((acptr->ip.S_ADDR & imask.mask.S_ADDR) != + imask.bits.S_ADDR)) || (imask.fall && matchexec(inet_ntoa(acptr->ip), mymask, minlen))))) continue; #endif @@ -695,7 +695,7 @@ || 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)) + || ((((acptr->ip.S_ADDR & imask.mask.S_ADDR) != imask.bits.S_ADDR)) || (imask.fall && matchexec(inet_ntoa(acptr->ip), mymask, minlen))))) continue; @@ -712,7 +712,7 @@ && ((!(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)) + || ((((acptr->ip.S_ADDR & imask.mask.S_ADDR) != imask.bits.S_ADDR)) || (imask.fall && matchexec(inet_ntoa(acptr->ip), mymask, minlen))))) continue; |