]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
2.1 merge
authorwessels <>
Sat, 14 Nov 1998 03:50:51 +0000 (03:50 +0000)
committerwessels <>
Sat, 14 Nov 1998 03:50:51 +0000 (03:50 +0000)
src/icmp.cc
src/neighbors.cc
src/net_db.cc
src/pinger.cc
src/protos.h
src/refresh.cc
src/store.cc
src/store_key_md5.cc

index b5fd2e76557a4cca09e36527b2c0dcf891c26ac8..5fe1a695f1aa932cda1ad5dc7e18627b9a49f5af 100644 (file)
@@ -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
 #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)
index 4e2ac7be414691b0339aa5e95d755958927f5529..cf43c538fb7ce6fdea2fb46969db420fe2574c35 100644 (file)
@@ -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;
index 8d12180b6209bff2ae21a480558cb9ad02f78004..fcbaeded1d60298d485b1170e47e5bff6a96cdc6 100644 (file)
@@ -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);
 }
 
index 60db7db16f5686d7d78d056c9a9a2b505436ead0..30a15c29ec57039d28b97b37e67c73d3e81c803d 100644 (file)
@@ -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
 #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,
index 51b8244388c498d783a2b7c46a21fdd627930f28..f17c297a49e591e7777a6c684c5340304498d4a7 100644 (file)
@@ -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 *);
index a10ea4d288e226a3bd1ed7952962ed7e25a929e8..1422ece991b56e1f6873f2323facc9870f5f8677 100644 (file)
@@ -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");
index f55d7cf4464006e6b9a8f73c55a0b389d91705fa..b755c78e7c413cdfeeebe469e54e74b93eb62038 100644 (file)
@@ -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
index 6e94797c6319492c9443a44380c9119b1582524b..39b6300ef5a5449405560ae5480f85d707e6b92d 100644 (file)
@@ -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)
 {