Author: adrian.chadd Date: Tue Oct 7 00:12:23 2008 New Revision: 13404 Modified: branches/CACHEBOY_PRE/src/acl.c branches/CACHEBOY_PRE/src/errorpage.c branches/CACHEBOY_PRE/src/forward.c branches/CACHEBOY_PRE/src/http.c branches/CACHEBOY_PRE/src/pconn.c branches/CACHEBOY_PRE/src/protos.h
Log: Merge r13383 from playpen/ipv6_request Migrate pconn* code to use sqaddr_t's Modified: branches/CACHEBOY_PRE/src/acl.c ============================================================================== --- branches/CACHEBOY_PRE/src/acl.c (original) +++ branches/CACHEBOY_PRE/src/acl.c Tue Oct 7 00:12:23 2008 @@ -2653,11 +2653,11 @@ #if FOLLOW_X_FORWARDED_FOR if (Config.onoff.acl_uses_indirect_client) { - sqinet_set_v4_inaddr(&(checklist->src_addr), &request->indirect_client_addr); + sqinet_copy(&checklist->src_addr, &request->indirect_client_addr); } else #endif /* FOLLOW_X_FORWARDED_FOR */ - sqinet_set_v4_inaddr(&(checklist->src_addr), &request->client_addr); - checklist->my_addr = request->my_addr; + sqinet_copy(&checklist->src_addr, &request->client_addr); + sqinet_copy(&checklist->my_addr, &request->my_addr); checklist->my_port = request->my_port; #if 0 && USE_IDENT /* Modified: branches/CACHEBOY_PRE/src/errorpage.c ============================================================================== --- branches/CACHEBOY_PRE/src/errorpage.c (original) +++ branches/CACHEBOY_PRE/src/errorpage.c Tue Oct 7 00:12:23 2008 @@ -273,7 +273,7 @@ sqinet_init(&err->src_addr); if (request != NULL) { err->request = requestLink(request); - sqinet_set_v4_inaddr(&err->src_addr, &request->client_addr); + sqinet_copy(&err->src_addr, &request->client_addr); } return err; } Modified: branches/CACHEBOY_PRE/src/forward.c ============================================================================== --- branches/CACHEBOY_PRE/src/forward.c (original) +++ branches/CACHEBOY_PRE/src/forward.c Tue Oct 7 00:12:23 2008 @@ -936,7 +936,7 @@ * from peer_digest.c, asn.c, netdb.c, etc and should always * be allowed. yuck, I know. */ - if (! IsNoAddr(&r->client_addr) && r->protocol != PROTO_INTERNAL && r->protocol != PROTO_CACHEOBJ) { + if (! sqinet_is_noaddr(&r->client_addr) && r->protocol != PROTO_INTERNAL && r->protocol != PROTO_CACHEOBJ) { /* * Check if this host is allowed to fetch MISSES from us (miss_access) */ Modified: branches/CACHEBOY_PRE/src/http.c ============================================================================== --- branches/CACHEBOY_PRE/src/http.c (original) +++ branches/CACHEBOY_PRE/src/http.c Tue Oct 7 00:12:23 2008 @@ -640,7 +640,7 @@ StoreEntry *entry = httpState->entry; const request_t *request = httpState->request; const request_t *orig_request = httpState->orig_request; - struct in_addr client_addr; + sqaddr_t client_addr; u_short client_port = 0; int fd = httpState->fd; int complete = httpState->eof; @@ -651,7 +651,8 @@ comm_close(fd); return; } - SetAnyAddr(&client_addr); + /* XXX this needs to be double-checked to make sure the sqinet_done() is called! */ + sqinet_init(&client_addr); while (len > 0) { if (httpState->chunk_size > 0) { size_t size = len; @@ -806,7 +807,7 @@ if (keep_alive) { int pinned = 0; if (orig_request->flags.tproxy) { - client_addr = sqinet_get_v4_inaddr(&httpState->request->client_addr, SQADDR_ASSERT_IS_V4); + sqinet_copy(&client_addr, &httpState->request->client_addr); } /* yes we have to clear all these! */ commSetDefer(fd, NULL, NULL); Modified: branches/CACHEBOY_PRE/src/pconn.c ============================================================================== --- branches/CACHEBOY_PRE/src/pconn.c (original) +++ branches/CACHEBOY_PRE/src/pconn.c Tue Oct 7 00:12:23 2008 @@ -46,8 +46,8 @@ static PF pconnRead; static PF pconnTimeout; -static hash_link *pconnLookup(const char *peer, u_short port, const char *domain, struct in_addr *client_address, u_short client_port); -static int pconnKey(char *buf, const char *host, u_short port, const char *domain, struct in_addr *client_address, u_short client_port); +static hash_link *pconnLookup(const char *peer, u_short port, const char *domain, sqaddr_t *client_address, u_short client_port); +static int pconnKey(char *buf, const char *host, u_short port, const char *domain, sqaddr_t *client_address, u_short client_port); static hash_table *table = NULL; static struct _pconn *pconnNew(const char *key); static void pconnDelete(struct _pconn *p); @@ -60,16 +60,20 @@ static int pconnKey(char *buf, const char *host, u_short port, const char *domain, - struct in_addr *client_address, u_short client_port) + sqaddr_t *client_address, u_short client_port) { + LOCAL_ARRAY(char, hbuf, MAX_IPSTRLEN); + if (client_address) + (void) sqinet_ntoa(client_address, hbuf, sizeof(hbuf), SQADDR_NONE); + if (domain && client_address) return snprintf(buf, PCONN_KEYLEN, "%s.%d:%s.%d/%s", host, (int) port, - inet_ntoa(*client_address), (int) client_port, domain); + hbuf, (int) client_port, domain); else if (domain && (!client_address)) return snprintf(buf, PCONN_KEYLEN, "%s.%d/%s", host, (int) port, domain); else if ((!domain) && client_address) return snprintf(buf, PCONN_KEYLEN, "%s.%d:%s.%d", host, (int) port, - inet_ntoa(*client_address), (int) client_port); + hbuf, (int) client_port); else return snprintf(buf, PCONN_KEYLEN, "%s:%d", host, (int) port); } @@ -192,7 +196,7 @@ } void -pconnPush(int fd, const char *host, u_short port, const char *domain, struct in_addr *client_address, u_short client_port) +pconnPush(int fd, const char *host, u_short port, const char *domain, sqaddr_t *client_address, u_short client_port) { struct _pconn *p; int *old; @@ -231,7 +235,7 @@ } int -pconnPop(const char *host, u_short port, const char *domain, struct in_addr *client_address, u_short client_port, int *idle) +pconnPop(const char *host, u_short port, const char *domain, sqaddr_t *client_address, u_short client_port, int *idle) { struct _pconn *p; hash_link *hptr; @@ -252,7 +256,7 @@ } static hash_link * -pconnLookup(const char *peer, u_short port, const char *domain, struct in_addr *client_address, u_short client_port) +pconnLookup(const char *peer, u_short port, const char *domain, sqaddr_t *client_address, u_short client_port) { LOCAL_ARRAY(char, key, PCONN_KEYLEN); assert(table != NULL); Modified: branches/CACHEBOY_PRE/src/protos.h ============================================================================== --- branches/CACHEBOY_PRE/src/protos.h (original) +++ branches/CACHEBOY_PRE/src/protos.h Tue Oct 7 00:12:23 2008 @@ -959,8 +959,8 @@ extern ErrorState *errorCon(err_type type, http_status, request_t * request); extern int errorPageId(const char *page_name); -extern void pconnPush(int, const char *host, u_short port, const char *domain, struct in_addr *client_address, u_short client_port); -extern int pconnPop(const char *host, u_short port, const char *domain, struct in_addr *client_address, u_short client_port, int *idle); +extern void pconnPush(int, const char *host, u_short port, const char *domain, sqaddr_t *client_address, u_short client_port); +extern int pconnPop(const char *host, u_short port, const char *domain, sqaddr_t *client_address, u_short client_port, int *idle); extern void pconnInit(void); extern int asnMatchIp(void *, struct in_addr); --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "cacheboy-commit" group. To post to this group, send email to cacheboy-commit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cacheboy-commit?hl=en -~----------~----~----~----~------~----~------~--~---