From: wessels <> Date: Fri, 29 May 1998 02:47:52 +0000 (+0000) Subject: Fixed cache_peer_acl selection algorithm. We were checking the ACL X-Git-Tag: SQUID_3_0_PRE1~3219 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=669fefd42eaabf7c58f53fe9ebe3f76d006b1888;p=thirdparty%2Fsquid.git Fixed cache_peer_acl selection algorithm. We were checking the ACL list ourselves in neighbors.c, but we need to use aclMatchAclList instead. Also fixed peerAllowedToUse() bug when domainlist == NULL, but acl list exists. --- diff --git a/src/acl.cc b/src/acl.cc index 4444e13d86..d80cd6ccb6 100644 --- a/src/acl.cc +++ b/src/acl.cc @@ -1,6 +1,6 @@ /* - * $Id: acl.cc,v 1.164 1998/05/11 18:44:31 rousskov Exp $ + * $Id: acl.cc,v 1.165 1998/05/28 20:47:52 wessels Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -42,7 +42,7 @@ static void aclDestroyAclList(acl_list * list); static void aclDestroyTimeList(acl_time_data * data); static void aclDestroyProxyAuth(acl_proxy_auth * p); static FREE aclFreeProxyAuthUser; -static int aclMatchAclList(const acl_list *, aclCheck_t *); +static int aclMatchAcl(struct _acl *, aclCheck_t *); static int aclMatchInteger(intlist * data, int i); static int aclMatchTime(acl_time_data * data, time_t when); static int aclMatchIdent(wordlist * data, const char *ident); @@ -1226,7 +1226,7 @@ aclMatchTime(acl_time_data * data, time_t when) return data->weekbits & (1 << tm.tm_wday) ? 1 : 0; } -int +static int aclMatchAcl(acl * acl, aclCheck_t * checklist) { request_t *r = checklist->request; @@ -1387,7 +1387,7 @@ aclMatchAcl(acl * acl, aclCheck_t * checklist) /* NOTREACHED */ } -static int +int aclMatchAclList(const acl_list * list, aclCheck_t * checklist) { while (list) { diff --git a/src/neighbors.cc b/src/neighbors.cc index 349d971d4e..0df4ed2a32 100644 --- a/src/neighbors.cc +++ b/src/neighbors.cc @@ -1,6 +1,6 @@ /* - * $Id: neighbors.cc,v 1.217 1998/05/26 19:08:56 wessels Exp $ + * $Id: neighbors.cc,v 1.218 1998/05/28 20:47:53 wessels Exp $ * * DEBUG: section 15 Neighbor Routines * AUTHOR: Harvest Derived @@ -208,18 +208,11 @@ peerAllowedToUse(const peer * p, request_t * request) } do_ping = !d->do_ping; } - if (0 == do_ping) + if (p->pinglist && 0 == do_ping) return do_ping; checklist.src_addr = request->client_addr; checklist.request = request; - for (a = p->acls; a; a = a->next) { - if (aclMatchAcl(a->acl, &checklist)) { - do_ping = a->op; - break; - } - do_ping = !a->op; - } - return do_ping; + return aclMatchAclList(p->acls, &checklist); } /* Return TRUE if it is okay to send an ICP request to this peer. */ @@ -341,6 +334,7 @@ getDefaultParent(request_t * request) debug(15, 3) ("getDefaultParent: returning %s\n", p->host); return p; } + debug(15, 3) ("getDefaultParent: returning NULL\n"); return NULL; } diff --git a/src/peer_select.cc b/src/peer_select.cc index 8ee08e6662..f652800858 100644 --- a/src/peer_select.cc +++ b/src/peer_select.cc @@ -1,6 +1,6 @@ /* - * $Id: peer_select.cc,v 1.63 1998/05/27 18:36:33 wessels Exp $ + * $Id: peer_select.cc,v 1.64 1998/05/28 20:47:54 wessels Exp $ * * DEBUG: section 44 Peer Selection Algorithm * AUTHOR: Duane Wessels @@ -111,7 +111,9 @@ peer * peerGetSomeParent(request_t * request, hier_code * code) { peer *p; - debug(44, 3) ("peerGetSomeParent: called.\n"); + debug(44, 3) ("peerGetSomeParent: %s %s\n", + RequestMethodStr[request->method], + request->host); if ((p = getDefaultParent(request))) { *code = DEFAULT_PARENT; return p; diff --git a/src/protos.h b/src/protos.h index e138a9f12d..204c4d7cf7 100644 --- a/src/protos.h +++ b/src/protos.h @@ -19,7 +19,7 @@ extern aclCheck_t *aclChecklistCreate(const struct _acl_access *, extern void aclNBCheck(aclCheck_t *, PF *, void *); extern int aclCheckFast(const struct _acl_access *A, aclCheck_t *); extern void aclChecklistFree(aclCheck_t *); -extern int aclMatchAcl(struct _acl *, aclCheck_t *); +extern int aclMatchAclList(const acl_list * list, aclCheck_t * checklist); extern void aclDestroyAccessList(struct _acl_access **list); extern void aclDestroyAcls(acl **); extern void aclParseAccessLine(struct _acl_access **);