From: wessels <> Date: Sat, 14 Nov 1998 03:50:51 +0000 (+0000) Subject: 2.1 merge X-Git-Tag: SQUID_3_0_PRE1~2527 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=674ac814b07cae9c8ed27f6653ddad4a4c1261ca;p=thirdparty%2Fsquid.git 2.1 merge --- diff --git a/src/icmp.cc b/src/icmp.cc index b5fd2e7655..5fe1a695f1 100644 --- a/src/icmp.cc +++ b/src/icmp.cc @@ -1,6 +1,6 @@ /* - * $Id: icmp.cc,v 1.66 1998/09/23 17:09:43 wessels Exp $ + * $Id: icmp.cc,v 1.67 1998/11/13 20:50:51 wessels Exp $ * * DEBUG: section 37 ICMP Routines * AUTHOR: Duane Wessels @@ -39,12 +39,16 @@ #if USE_ICMP #define S_ICMP_ECHO 1 +#if ALLOW_SOURCE_PING #define S_ICMP_ICP 2 +#endif #define S_ICMP_DOM 3 static PF icmpRecv; static void icmpSend(pingerEchoData * pkt, int len); +#if ALLOW_SOURCE_PING static void icmpHandleSourcePing(const struct sockaddr_in *from, const char *buf); +#endif static void icmpSendEcho(struct in_addr to, int opcode, const char *payload, int len) @@ -88,9 +92,11 @@ icmpRecv(int unused1, void *unused2) switch (preply.opcode) { case S_ICMP_ECHO: break; +#if ALLOW_SOURCE_PING case S_ICMP_ICP: icmpHandleSourcePing(&F, preply.payload); break; +#endif case S_ICMP_DOM: netdbHandlePingReply(&F, preply.hops, preply.rtt); break; @@ -118,6 +124,7 @@ icmpSend(pingerEchoData * pkt, int len) } } +#if ALLOW_SOURCE_PING static void icmpHandleSourcePing(const struct sockaddr_in *from, const char *buf) { @@ -132,6 +139,7 @@ icmpHandleSourcePing(const struct sockaddr_in *from, const char *buf) /* call neighborsUdpAck even if ping_status != PING_WAITING */ neighborsUdpAck(key, &header, from); } +#endif #endif /* USE_ICMP */ @@ -143,6 +151,7 @@ icmpPing(struct in_addr to) #endif } +#if ALLOW_SOURCE_PING void icmpSourcePing(struct in_addr to, const icp_common_t * header, const char *url) { @@ -162,6 +171,7 @@ icmpSourcePing(struct in_addr to, const icp_common_t * header, const char *url) memFree(MEM_8K_BUF, payload); #endif } +#endif void icmpDomainPing(struct in_addr to, const char *domain) diff --git a/src/neighbors.cc b/src/neighbors.cc index 4e2ac7be41..cf43c538fb 100644 --- a/src/neighbors.cc +++ b/src/neighbors.cc @@ -1,6 +1,6 @@ /* - * $Id: neighbors.cc,v 1.259 1998/11/12 06:28:16 wessels Exp $ + * $Id: neighbors.cc,v 1.260 1998/11/13 20:50:52 wessels Exp $ * * DEBUG: section 15 Neighbor Routines * AUTHOR: Harvest Derived @@ -762,7 +762,7 @@ neighborsUdpAck(const cache_key * key, icp_common_t * header, const struct socka return; } if (entry->ping_status != PING_WAITING) { - debug(15, 2) ("neighborsUdpAck: Unexpected %s for %s\n", + debug(15, 2) ("neighborsUdpAck: Late %s for %s\n", opcode_d, storeKeyText(key)); neighborCountIgnored(p); return; diff --git a/src/net_db.cc b/src/net_db.cc index 8d12180b62..fcbaeded1d 100644 --- a/src/net_db.cc +++ b/src/net_db.cc @@ -1,6 +1,6 @@ /* - * $Id: net_db.cc,v 1.132 1998/11/12 06:28:17 wessels Exp $ + * $Id: net_db.cc,v 1.133 1998/11/13 20:50:53 wessels Exp $ * * DEBUG: section 38 Network Measurement Database * AUTHOR: Duane Wessels @@ -266,11 +266,13 @@ netdbSendPing(const ipcache_addrs * ia, void *data) na->link_count++; n = na; } - debug(38, 3) ("netdbSendPing: pinging %s\n", hostname); - icmpDomainPing(addr, hostname); - n->pings_sent++; - n->next_ping_time = squid_curtime + Config.Netdb.period; - n->last_use_time = squid_curtime; + if (n->next_ping_time <= squid_curtime) { + debug(38, 3) ("netdbSendPing: pinging %s\n", hostname); + icmpDomainPing(addr, hostname); + n->pings_sent++; + n->next_ping_time = squid_curtime + Config.Netdb.period; + n->last_use_time = squid_curtime; + } cbdataFree(hostname); } diff --git a/src/pinger.cc b/src/pinger.cc index 60db7db16f..30a15c29ec 100644 --- a/src/pinger.cc +++ b/src/pinger.cc @@ -1,6 +1,6 @@ /* - * $Id: pinger.cc,v 1.37 1998/08/18 19:14:06 wessels Exp $ + * $Id: pinger.cc,v 1.38 1998/11/13 20:50:54 wessels Exp $ * * DEBUG: section 42 ICMP Pinger program * AUTHOR: Duane Wessels @@ -72,8 +72,13 @@ #define ip_dst daddr #endif +#if ALLOW_SOURCE_PING #define MAX_PKT_SZ 8192 #define MAX_PAYLOAD (MAX_PKT_SZ - sizeof(struct icmphdr) - sizeof (char) - sizeof(struct timeval) - 1) +#else +#define MAX_PAYLOAD (sizeof(struct icmphdr) + sizeof (char) + sizeof(struct timeval) + 1) +#define MAX_PKT_SZ MAX_PAYLOAD +#endif typedef struct { struct timeval tv; @@ -166,6 +171,7 @@ pingerSendEcho(struct in_addr to, int opcode, char *payload, int len) S.sin_family = AF_INET; S.sin_addr = to; S.sin_port = 0; + assert(icmp_pktsize <= MAX_PKT_SZ); sendto(icmp_sock, pkt, icmp_pktsize, diff --git a/src/protos.h b/src/protos.h index 51b8244388..f17c297a49 100644 --- a/src/protos.h +++ b/src/protos.h @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.287 1998/11/13 06:00:31 wessels Exp $ + * $Id: protos.h,v 1.288 1998/11/13 20:50:55 wessels Exp $ * * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -827,7 +827,6 @@ extern void storeKeyFree(const cache_key *); extern const cache_key *storeKeyScan(const char *); extern const char *storeKeyText(const cache_key *); extern const cache_key *storeKeyPublic(const char *, const method_t); -extern const cache_key *storeKeyPublicOld(const char *, method_t); extern const cache_key *storeKeyPrivate(const char *, method_t, int); extern int storeKeyHashBuckets(int); extern int storeKeyNull(const cache_key *); diff --git a/src/refresh.cc b/src/refresh.cc index a10ea4d288..1422ece991 100644 --- a/src/refresh.cc +++ b/src/refresh.cc @@ -1,7 +1,7 @@ /* - * $Id: refresh.cc,v 1.44 1998/11/12 06:28:23 wessels Exp $ + * $Id: refresh.cc,v 1.45 1998/11/13 20:50:56 wessels Exp $ * * DEBUG: section 22 Refresh Calculation * AUTHOR: Harvest Derived @@ -51,6 +51,7 @@ static struct RefreshCounts { int request_max_age_stale; int request_reload2ims_stale; int request_reload_stale; + int negative_age_stale; int min_age_override_exp_fresh; int min_age_override_lmt_fresh; int response_expires_stale; @@ -181,6 +182,11 @@ refreshCheck(const StoreEntry * entry, request_t * request, time_t delta, struct } } #endif + if (age < 0) { + debug(22, 3) ("refreshCheck: YES: age < 0\n"); + rc->negative_age_stale++; + return 1; + } if (request->max_age > -1) { if (age > request->max_age) { debug(22, 3) ("refreshCheck: YES: age > client-max-age\n"); diff --git a/src/store.cc b/src/store.cc index f55d7cf446..b755c78e7c 100644 --- a/src/store.cc +++ b/src/store.cc @@ -1,6 +1,6 @@ /* - * $Id: store.cc,v 1.470 1998/11/12 06:28:27 wessels Exp $ + * $Id: store.cc,v 1.471 1998/11/13 20:50:57 wessels Exp $ * * DEBUG: section 20 Storage Manager * AUTHOR: Harvest Derived @@ -281,15 +281,7 @@ storeGet(const cache_key * key) StoreEntry * storeGetPublic(const char *uri, const method_t method) { - const cache_key *key; - StoreEntry *e; - key = storeKeyPublic(uri, method); - e = storeGet(key); - if (e == NULL && squid_curtime < 909000000) { - key = storeKeyPublicOld(uri, method); - e = storeGet(key); - } - return e; + return storeGet(storeKeyPublic(uri, method)); } static int diff --git a/src/store_key_md5.cc b/src/store_key_md5.cc index 6e94797c63..39b6300ef5 100644 --- a/src/store_key_md5.cc +++ b/src/store_key_md5.cc @@ -1,6 +1,6 @@ /* - * $Id: store_key_md5.cc,v 1.17 1998/09/21 06:52:23 wessels Exp $ + * $Id: store_key_md5.cc,v 1.18 1998/11/13 20:50:58 wessels Exp $ * * DEBUG: section 20 Storage Manager MD5 Cache Keys * AUTHOR: Duane Wessels @@ -119,25 +119,6 @@ storeKeyPublic(const char *url, const method_t method) return digest; } -/* - * Compatibility transition period. Remove this after Oct 21, 1998 - */ -const cache_key * -storeKeyPublicOld(const char *url, method_t method) -{ - static cache_key digest[MD5_DIGEST_CHARS]; - MD5_CTX M; - int n; - char key_buf[MAX_URL + 100]; - n = snprintf(key_buf, sizeof(key_buf), "%s %s", - RequestMethodStr[method], - url); - MD5Init(&M); - MD5Update(&M, (unsigned char *) key_buf, n); - MD5Final(digest, &M); - return digest; -} - const cache_key * storeKeyDup(const cache_key * key) {