/*
- * $Id: cache_cf.cc,v 1.284 1998/06/02 04:18:16 wessels Exp $
+ * $Id: cache_cf.cc,v 1.285 1998/06/03 20:34:41 wessels Exp $
*
* DEBUG: section 3 Configuration File Parsing
* AUTHOR: Harvest Derived
storeAppendPrintf(entry, "%s %s %s %s%s\n",
name, cp->name,
head->allow ? "Allow" : "Deny",
- l->op ? "" : "!",
+ l->op ? null_string : "!",
l->acl->name);
}
head = head->next;
{
acl_list *l;
while (head != NULL) {
- for (l = head->acl_list; l != NULL; l = l->next) {
- storeAppendPrintf(entry, "%s %s %s%s\n",
+ storeAppendPrintf(entry, "%s %s",
name,
- head->allow ? "Allow" : "Deny",
- l->op ? "" : "!",
+ head->allow ? "Allow" : "Deny");
+ for (l = head->acl_list; l != NULL; l = l->next) {
+ storeAppendPrintf(entry, " %s%s",
+ l->op ? null_string : "!",
l->acl->name);
}
+ storeAppendPrintf(entry, "\n");
head = head->next;
}
}
swap->n_configured = 0;
}
+const char *
+peer_type_str(const peer_t type)
+{
+ switch(type) {
+ case PEER_PARENT:
+ return "parent";
+ break;
+ case PEER_SIBLING:
+ return "sibling";
+ break;
+ case PEER_MULTICAST:
+ return "multicast";
+ break;
+ default:
+ return "unknown";
+ break;
+ }
+}
+
static void
dump_peer(StoreEntry * entry, const char *name, peer * p)
{
+ domain_ping *d;
+ acl_access *a;
+ domain_type *t;
+ LOCAL_ARRAY(char, xname, 128);
while (p != NULL) {
storeAppendPrintf(entry, "%s %s %s %d %d",
name,
p->http_port,
p->icp_port);
dump_peer_options(entry, p);
+ for (d = p->pinglist; d; d = d->next) {
+ storeAppendPrintf(entry, "cache_peer_domain %s %s%s\n",
+ p->host,
+ d->do_ping ? null_string : "!",
+ d->domain);
+ }
+ if ((a = p->access)) {
+ snprintf(xname, 128, "cache_peer_access %s", p->host);
+ dump_acl_access(entry, xname, p->access);
+ }
+ for (t = p->typelist; t; t = t->next) {
+ storeAppendPrintf(entry, "neighbor_type_domain %s %s %s\n",
+ p->host,
+ peer_type_str(t->type),
+ t->domain);
+ }
p = p->next;
}
}
}
static void
-parse_peeracl(void)
+parse_peer_access(void)
{
char *host = NULL;
- char *aclname = NULL;
-
+ peer *p;
if (!(host = strtok(NULL, w_space)))
self_destruct();
- while ((aclname = strtok(NULL, list_sep))) {
- peer *p;
- acl_list *L = NULL;
- acl_list **Tail = NULL;
- acl *a = NULL;
if ((p = peerFindByName(host)) == NULL) {
debug(15, 0) ("%s, line %d: No cache_peer '%s'\n",
cfg_filename, config_lineno, host);
return;
}
- L = xcalloc(1, sizeof(acl_list));
- L->op = 1;
- if (*aclname == '!') {
- L->op = 0;
- aclname++;
- }
- debug(15, 3) ("neighborAddAcl: looking for ACL name '%s'\n", aclname);
- a = aclFindByName(aclname);
- if (a == NULL) {
- debug(15, 0) ("%s line %d: %s\n",
- cfg_filename, config_lineno, config_input_line);
- debug(15, 0) ("neighborAddAcl: ACL name '%s' not found.\n", aclname);
- xfree(L);
- return;
- }
- L->acl = a;
- for (Tail = &p->acls; *Tail; Tail = &(*Tail)->next);
- *Tail = L;
- }
+ aclParseAccessLine(&p->access);
}
static void
DOC_END
-NAME: cache_peer_acl cache_host_acl
-TYPE: peeracl
+NAME: cache_peer_access
+TYPE: peer_access
DEFAULT: none
LOC: none
DOC_START
- Just like 'cache_peer_domain' but provides more flexibility by
- using ACL's.
+ Similar to 'cache_peer_domain' but provides more flexibility by
+ using ACL elements.
- cache_peer_acl cache-host [!]aclname ...
+ cache_peer_access cache-host allow|deny [!]aclname ...
- NOTE: * Any number of ACL's may be given for a cache-host,
- either on the same or separate lines.
- * When multiple ACL's are given for a particular
- cache-host, the first matched ACL is applied.
- * Cache hosts with no domain or ACL restrictions are
- queried for all requests.
- * There are no defaults.
+ The syntax is identical to 'http_access' and the other lists of
+ ACL elements. See the comments for 'http_access' below, or
+ the Squid FAQ (http://squid.nlanr.net/Squid/FAQ/FAQ-10.html).
DOC_END
COMMENT_START
/*
- * $Id: neighbors.cc,v 1.219 1998/05/28 23:43:45 wessels Exp $
+ * $Id: neighbors.cc,v 1.220 1998/06/03 20:34:44 wessels Exp $
*
* DEBUG: section 15 Neighbor Routines
* AUTHOR: Harvest Derived
if (EBIT_TEST(request->flags, REQ_REFRESH))
if (neighborType(p, request) == PEER_SIBLING)
return 0;
- if (p->pinglist == NULL && p->acls == NULL)
+ if (p->pinglist == NULL && p->access == NULL)
return do_ping;
do_ping = 0;
for (d = p->pinglist; d; d = d->next) {
}
if (p->pinglist && 0 == do_ping)
return do_ping;
+ if (p->access == NULL)
+ return do_ping;
checklist.src_addr = request->client_addr;
checklist.request = request;
- return aclMatchAclList(p->acls, &checklist);
+ return aclCheckFast(p->access, &checklist);
}
/* Return TRUE if it is okay to send an ICP request to this peer. */