/*
- * $Id: acl.cc,v 1.196 1999/01/24 04:03:48 wessels Exp $
+ * $Id: acl.cc,v 1.197 1999/01/29 21:28:06 wessels Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
return ACL_SRC_IP;
if (!strcmp(s, "dst"))
return ACL_DST_IP;
+ if (!strcmp(s, "myip"))
+ return ACL_MY_IP;
if (!strcmp(s, "domain"))
return ACL_DST_DOMAIN;
if (!strcmp(s, "dstdomain"))
return "src";
if (type == ACL_DST_IP)
return "dst";
+ if (type == ACL_MY_IP)
+ return "myip";
if (type == ACL_DST_DOMAIN)
return "dstdomain";
if (type == ACL_SRC_DOMAIN)
switch (A->type) {
case ACL_SRC_IP:
case ACL_DST_IP:
+ case ACL_MY_IP:
aclParseIpList(&A->data);
break;
case ACL_SRC_DOMAIN:
case ACL_SRC_IP:
return aclMatchIp(&ae->data, checklist->src_addr);
/* NOTREACHED */
+ case ACL_MY_IP:
+ return aclMatchIp(&ae->data, checklist->my_addr);
+ /* NOTREACHED */
case ACL_DST_IP:
ia = ipcache_gethostbyname(r->host, IP_LOOKUP_IF_MISS);
if (ia) {
aclChecklistCreate(const acl_access * A,
request_t * request,
struct in_addr src_addr,
+ struct in_addr my_addr,
const char *user_agent,
const char *ident)
{
if (request != NULL)
checklist->request = requestLink(request);
checklist->src_addr = src_addr;
+ checklist->my_addr = my_addr;
for (i = 0; i < ACL_ENUM_MAX; i++)
checklist->state[i] = ACL_LOOKUP_NONE;
if (user_agent)
switch (a->type) {
case ACL_SRC_IP:
case ACL_DST_IP:
+ case ACL_MY_IP:
splay_destroy(a->data, aclFreeIpData);
break;
case ACL_SRC_ARP:
switch (a->type) {
case ACL_SRC_IP:
case ACL_DST_IP:
+ case ACL_MY_IP:
return aclDumpIpList(a->data);
break;
case ACL_SRC_DOMAIN:
/*
- * $Id: asn.cc,v 1.55 1999/01/19 16:35:13 wessels Exp $
+ * $Id: asn.cc,v 1.56 1999/01/29 21:28:07 wessels Exp $
*
* DEBUG: section 53 AS Number handling
* AUTHOR: Duane Wessels, Kostas Anagnostakis
if ((e = storeGetPublic(asres, METHOD_GET)) == NULL) {
e = storeCreateEntry(asres, asres, null_request_flags, METHOD_GET);
storeClientListAdd(e, asState);
- fwdStart(-1, e, asState->request, no_addr);
+ fwdStart(-1, e, asState->request, no_addr, no_addr);
} else {
storeLockObject(e);
storeClientListAdd(e, asState);
#
-# $Id: cf.data.pre,v 1.141 1999/01/29 21:05:21 wessels Exp $
+# $Id: cf.data.pre,v 1.142 1999/01/29 21:28:08 wessels Exp $
#
#
# SQUID Internet Object Cache http://squid.nlanr.net/Squid/
acl aclname src ip-address/netmask ... (clients IP address)
acl aclname src addr1-addr2/netmask ... (range of addresses)
acl aclname dst ip-address/netmask ... (URL host's IP address)
+ acl aclname myip ip-address/netmask ... (local socket IP address)
acl aclname srcdomain foo.com ... # reverse lookup, client IP
acl aclname dstdomain foo.com ... # Destination server from URL
/*
- * $Id: client_side.cc,v 1.437 1999/01/24 04:03:50 wessels Exp $
+ * $Id: client_side.cc,v 1.438 1999/01/29 21:28:10 wessels Exp $
*
* DEBUG: section 33 Client-side Routines
* AUTHOR: Duane Wessels
http->acl_checklist = aclChecklistCreate(Config.accessList.http,
http->request,
conn->peer.sin_addr,
+ conn->me.sin_addr,
browser,
conn->ident);
#if USE_IDENT
http->entry = entry;
http->out.offset = 0;
fwdStart(http->conn->fd, http->entry, http->request,
- http->conn->peer.sin_addr);
+ http->conn->peer.sin_addr, http->conn->me.sin_addr);
/* Register with storage manager to receive updates when data comes in. */
if (EBIT_TEST(entry->flags, ENTRY_ABORTED))
debug(33, 0) ("clientProcessExpired: found ENTRY_ABORTED object\n");
* This may not work yet for 'dst' and 'dst_domain' ACLs.
*/
ch.src_addr = http->conn->peer.sin_addr;
+ ch.my_addr = http->conn->me.sin_addr;
ch.request = http->request;
/*
* aclCheckFast returns 1 for ALLOW and 0 for DENY. The default
}
if (http->flags.internal)
r->protocol = PROTO_INTERNAL;
- fwdStart(http->conn->fd, http->entry, r, http->conn->peer.sin_addr);
+ fwdStart(http->conn->fd, http->entry, r,
+ http->conn->peer.sin_addr, http->conn->me.sin_addr);
}
static clientHttpRequest *
/*
- * $Id: enums.h,v 1.144 1999/01/24 04:03:51 wessels Exp $
+ * $Id: enums.h,v 1.145 1999/01/29 21:28:11 wessels Exp $
*
*
* SQUID Internet Object Cache http://squid.nlanr.net/Squid/
ACL_NONE,
ACL_SRC_IP,
ACL_DST_IP,
+ ACL_MY_IP,
ACL_SRC_DOMAIN,
ACL_DST_DOMAIN,
ACL_SRC_DOM_REGEX,
/*
- * $Id: forward.cc,v 1.52 1999/01/19 19:23:27 wessels Exp $
+ * $Id: forward.cc,v 1.53 1999/01/29 21:28:12 wessels Exp $
*
* DEBUG: section 17 Request Forwarding
* AUTHOR: Duane Wessels
/* PUBLIC FUNCTIONS */
void
-fwdStart(int fd, StoreEntry * e, request_t * r, struct in_addr client_addr)
+fwdStart(int fd, StoreEntry * e, request_t * r, struct in_addr client_addr,
+ struct in_addr my_addr)
{
FwdState *fwdState;
aclCheck_t ch;
*/
memset(&ch, '\0', sizeof(aclCheck_t));
ch.src_addr = client_addr;
+ ch.my_addr = my_addr;
ch.request = r;
answer = aclCheckFast(Config.accessList.miss, &ch);
if (answer == 0) {
/*
- * $Id: icp_v2.cc,v 1.57 1999/01/11 23:29:42 wessels Exp $
+ * $Id: icp_v2.cc,v 1.58 1999/01/29 21:28:13 wessels Exp $
*
* DEBUG: section 12 Internet Cache Protocol
* AUTHOR: Duane Wessels
break;
}
checklist.src_addr = from.sin_addr;
+ checklist.my_addr = no_addr;
checklist.request = icp_request;
allow = aclCheckFast(Config.accessList.icp, &checklist);
if (!allow) {
/*
- * $Id: icp_v3.cc,v 1.27 1998/12/05 00:54:30 wessels Exp $
+ * $Id: icp_v3.cc,v 1.28 1999/01/29 21:28:14 wessels Exp $
*
* DEBUG: section 12 Internet Cache Protocol
* AUTHOR: Duane Wessels
break;
}
checklist.src_addr = from.sin_addr;
+ checklist.my_addr = no_addr;
checklist.request = icp_request;
allow = aclCheckFast(Config.accessList.icp, &checklist);
if (!allow) {
/*
- * $Id: neighbors.cc,v 1.267 1999/01/11 16:50:33 wessels Exp $
+ * $Id: neighbors.cc,v 1.268 1999/01/29 21:28:15 wessels Exp $
*
* DEBUG: section 15 Neighbor Routines
* AUTHOR: Harvest Derived
if (p->access == NULL)
return do_ping;
checklist.src_addr = request->client_addr;
+ checklist.my_addr = no_addr; /* XXX wrong */
checklist.request = request;
return aclCheckFast(p->access, &checklist);
}
/*
- * $Id: net_db.cc,v 1.135 1999/01/11 16:50:35 wessels Exp $
+ * $Id: net_db.cc,v 1.136 1999/01/29 21:28:16 wessels Exp $
*
* DEBUG: section 38 Network Measurement Database
* AUTHOR: Duane Wessels
storeClientCopy(ex->e, ex->seen, ex->used, ex->buf_sz,
ex->buf, netdbExchangeHandleReply, ex);
ex->r->flags.loopdetect = 1; /* cheat! -- force direct */
- fwdStart(-1, ex->e, ex->r, no_addr);
+ fwdStart(-1, ex->e, ex->r, no_addr, no_addr);
#endif
}
/*
- * $Id: peer_digest.cc,v 1.69 1999/01/11 16:50:36 wessels Exp $
+ * $Id: peer_digest.cc,v 1.70 1999/01/29 21:28:17 wessels Exp $
*
* DEBUG: section 72 Peer Digest Routines
* AUTHOR: Alex Rousskov
/* push towards peer cache */
debug(72, 3) ("peerDigestRequest: forwarding to fwdStart...\n");
- fwdStart(-1, e, req, no_addr);
+ fwdStart(-1, e, req, no_addr, no_addr);
cbdataLock(fetch);
cbdataLock(fetch->pd);
storeClientCopy(e, 0, 0, 4096, memAllocate(MEM_4K_BUF),
/*
- * $Id: peer_select.cc,v 1.96 1999/01/29 17:20:56 wessels Exp $
+ * $Id: peer_select.cc,v 1.97 1999/01/29 21:28:18 wessels Exp $
*
* DEBUG: section 44 Peer Selection Algorithm
* AUTHOR: Duane Wessels
Config.accessList.AlwaysDirect,
request,
request->client_addr,
+ no_addr, /* XXX wrong */
NULL, /* user agent */
NULL); /* ident */
aclNBCheck(ps->acl_checklist,
Config.accessList.NeverDirect,
request,
request->client_addr,
+ no_addr, /* XXX wrong */
NULL, /* user agent */
NULL); /* ident */
aclNBCheck(ps->acl_checklist,
/*
- * $Id: protos.h,v 1.312 1999/01/24 04:03:53 wessels Exp $
+ * $Id: protos.h,v 1.313 1999/01/29 21:28:19 wessels Exp $
*
*
* SQUID Internet Object Cache http://squid.nlanr.net/Squid/
extern aclCheck_t *aclChecklistCreate(const struct _acl_access *,
request_t *,
struct in_addr src,
+ struct in_addr me,
const char *user_agent,
const char *ident);
extern void aclNBCheck(aclCheck_t *, PF *, void *);
extern void peerDigestStatsReport(const PeerDigest * pd, StoreEntry * e);
/* forward.c */
-extern void fwdStart(int, StoreEntry *, request_t *, struct in_addr);
+extern void fwdStart(int, StoreEntry *, request_t *, struct in_addr, struct in_addr);
extern DEFER fwdCheckDeferRead;
extern void fwdFail(FwdState *, ErrorState *);
extern void fwdUnregister(int fd, FwdState *);
/*
- * $Id: structs.h,v 1.273 1999/01/24 04:03:54 wessels Exp $
+ * $Id: structs.h,v 1.274 1999/01/29 21:28:21 wessels Exp $
*
*
* SQUID Internet Object Cache http://squid.nlanr.net/Squid/
const acl_access *access_list;
struct in_addr src_addr;
struct in_addr dst_addr;
+ struct in_addr my_addr;
request_t *request;
#if USE_IDENT
ConnStateData *conn; /* hack for ident */
/*
*
- * $Id: urn.cc,v 1.50 1999/01/11 16:50:43 wessels Exp $
+ * $Id: urn.cc,v 1.51 1999/01/29 21:28:22 wessels Exp $
*
* DEBUG: section 52 URN Parsing
* AUTHOR: Kostas Anagnostakis
if ((urlres_e = storeGetPublic(urlres, METHOD_GET)) == NULL) {
urlres_e = storeCreateEntry(urlres, urlres, null_request_flags, METHOD_GET);
storeClientListAdd(urlres_e, urnState);
- fwdStart(-1, urlres_e, urlres_r, no_addr);
+ fwdStart(-1, urlres_e, urlres_r, no_addr, no_addr);
} else {
storeLockObject(urlres_e);
storeClientListAdd(urlres_e, urnState);