From 3be4d5d1d3433295bba7a058752d1531b8a463e4 Mon Sep 17 00:00:00 2001 From: amosjeffries <> Date: Sat, 19 Jan 2008 14:11:34 +0000 Subject: [PATCH] Miscenllaneous fixes for CNAME, include, and comm. - Add more wrapping of CNAME code no longer needed. - Fixes typo in include directive ported code. - Fixes incorrect socket family setting on some accepted connections. --- lib/rfc1035.c | 4 +++- src/cache_cf.cc | 4 ++-- src/comm.cc | 16 +++++++++++----- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/lib/rfc1035.c b/lib/rfc1035.c index 70d8c2b61c..1929e43df2 100644 --- a/lib/rfc1035.c +++ b/lib/rfc1035.c @@ -1,6 +1,6 @@ /* - * $Id: rfc1035.c,v 1.53 2008/01/11 03:49:21 amosjeffries Exp $ + * $Id: rfc1035.c,v 1.54 2008/01/19 07:11:34 amosjeffries Exp $ * * Low level DNS protocol routines * AUTHOR: Duane Wessels @@ -402,7 +402,9 @@ rfc1035RRUnpack(const char *buf, size_t sz, unsigned int *off, rfc1035_rr * RR) } RR->rdlength = rdlength; switch (RR->type) { +#if DNS_CNAME case RFC1035_TYPE_CNAME: +#endif case RFC1035_TYPE_PTR: RR->rdata = (char*)xmalloc(RFC1035_MAXHOSTNAMESZ); rdata_off = *off; diff --git a/src/cache_cf.cc b/src/cache_cf.cc index 12198db1ee..300005bb47 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.cc,v 1.536 2008/01/18 12:37:08 amosjeffries Exp $ + * $Id: cache_cf.cc,v 1.537 2008/01/19 07:11:34 amosjeffries Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -213,7 +213,7 @@ parseManyConfigFiles(char* files, int depth) char* file = strtok_r(files, w_space, &saveptr); while (file != NULL) { error_count += parseOneConfigFile(file, depth); - file = strtok_r(files, w_space, &saveptr); + file = strtok_r(NULL, w_space, &saveptr); } return error_count; } diff --git a/src/comm.cc b/src/comm.cc index 03f0bbb03d..97382e2a4f 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -1,6 +1,6 @@ /* - * $Id: comm.cc,v 1.441 2008/01/07 17:12:28 hno Exp $ + * $Id: comm.cc,v 1.442 2008/01/19 07:11:35 amosjeffries Exp $ * * DEBUG: section 5 Socket Functions * AUTHOR: Harvest Derived @@ -1469,6 +1469,8 @@ comm_old_accept(int fd, ConnectionDetail &details) details.peer = *gai; + details.me.InitAddrInfo(gai); + details.me.SetEmpty(); getsockname(sock, gai->ai_addr, &gai->ai_addrlen); details.me = *gai; @@ -1484,12 +1486,15 @@ comm_old_accept(int fd, ConnectionDetail &details) details.peer.NtoA(F->ipaddr,MAX_IPSTRLEN); F->remote_port = details.peer.GetPort(); F->local_addr.SetPort(details.me.GetPort()); - F->sock_family = gai->ai_family; +#if USE_IPV6 + F->sock_family = AF_INET; +#else + F->sock_family = details.me.IsIPv4()?AF_INET:AF_INET6; +#endif + details.me.FreeAddrInfo(gai); commSetNonBlocking(sock); - details.me.FreeAddrInfo(gai); - PROF_stop(comm_accept); return sock; } @@ -2284,9 +2289,10 @@ fdc_t::acceptOne(int fd) { return; } - debugs(5, 5, "fdc_t::acceptOne accepted: FD " << fd << " handler: " << (void*)accept.accept.callback.handler << " newfd: " << newfd); + debugs(5, 5, HERE << "accepted: FD " << fd << " handler: " << (void*)accept.accept.callback.handler << " newfd: " << newfd << " from: " << accept.connDetails.peer); assert(accept.accept.callback.handler); + accept.accept.doCallback(fd, newfd, COMM_OK, 0, &accept.connDetails); /* If we weren't re-registed, don't bother trying again! */ -- 2.47.2