]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fixed cache_peer_acl selection algorithm. We were checking the ACL
authorwessels <>
Fri, 29 May 1998 02:47:52 +0000 (02:47 +0000)
committerwessels <>
Fri, 29 May 1998 02:47:52 +0000 (02:47 +0000)
list ourselves in neighbors.c, but we need to use aclMatchAclList
instead.

Also fixed peerAllowedToUse() bug when domainlist == NULL, but acl
list exists.

src/acl.cc
src/neighbors.cc
src/peer_select.cc
src/protos.h

index 4444e13d867296b9f323d81851f14976469eb3af..d80cd6ccb6e6e45405eb62a74c1e62e0af62ec8e 100644 (file)
@@ -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) {
index 349d971d4e58636e9521d8adad4e0f5a0061bedd..0df4ed2a32055dab3fcceb2e2ea9ccb35094be97 100644 (file)
@@ -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;
 }
 
index 8ee08e6662d0332bd4cc192de89a5a58672cd8d2..f6528008585ab9fb1366ee55d31186fed897be3d 100644 (file)
@@ -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;
index e138a9f12dfd0ec49c5f02e381719a2b56aa49c9..204c4d7cf7db3aed8f2efacd13c98a5cf8d0bd15 100644 (file)
@@ -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 **);