Index: squid.nlanr.net/squid-1.1/src/icp.c diff -c squid.nlanr.net/squid-1.1/src/icp.c:1.1.1.1 squid.nlanr.net/squid-1.1/src/icp.c:1.2 *** squid.nlanr.net/squid-1.1/src/icp.c:1.1.1.1 Tue Dec 16 01:07:50 1997 --- squid.nlanr.net/squid-1.1/src/icp.c Wed Dec 17 01:57:31 1997 *************** *** 738,743 **** --- 738,744 ---- void icpProcessRequest(int fd, icpStateData * icpState) { + extern volatile int is_ip_reachable; char *url = icpState->url; const char *pubkey = NULL; StoreEntry *entry = NULL; *************** *** 814,819 **** --- 815,822 ---- icpState->log_type = LOG_TCP_MISS; storeRelease(entry); entry = NULL; + } else if( !is_ip_reachable ) { + icpState->log_type = LOG_TCP_HIT; } else if (BIT_TEST(request->flags, REQ_NOCACHE)) { /* NOCACHE should always eject a negative cached object */ if (BIT_TEST(entry->flag, ENTRY_NEGCACHED)) Index: squid.nlanr.net/squid-1.1/src/main.c diff -c squid.nlanr.net/squid-1.1/src/main.c:1.1.1.1 squid.nlanr.net/squid-1.1/src/main.c:1.2 *** squid.nlanr.net/squid-1.1/src/main.c:1.1.1.1 Tue Dec 16 01:07:50 1997 --- squid.nlanr.net/squid-1.1/src/main.c Wed Dec 17 01:59:06 1997 *************** *** 132,137 **** --- 132,138 ---- volatile int unbuffered_logs = 1; /* debug and hierarchy unbuffered by default */ volatile int shutdown_pending = 0; /* set by SIGTERM handler (shut_down()) */ volatile int reread_pending = 0; /* set by SIGHUP handler */ + volatile int is_ip_reachable = 0; /* set by SIGWINCH */ const char *const version_string = SQUID_VERSION; const char *const appname = "squid"; const char *const localhost = "127.0.0.1"; *************** *** 256,261 **** --- 257,266 ---- opt_send_signal = SIGKILL; else if (!strncmp(optarg, "check", strlen(optarg))) opt_send_signal = 0; /* SIGNULL */ + else if (!strncmp(optarg, "ip-up", strlen(optarg))) + opt_send_signal = SIGWINCH; + else if (!strncmp(optarg, "ip-down", strlen(optarg))) + opt_send_signal = SIGPROF; else usage(); break; *************** *** 598,603 **** --- 603,610 ---- squid_signal(SIGUSR1, rotate_logs, SA_RESTART); squid_signal(SIGUSR2, sigusr2_handle, SA_RESTART); + squid_signal(SIGWINCH, set_ipreachable, SA_RESTART); + squid_signal(SIGPROF, reset_ipreachable, SA_RESTART); squid_signal(SIGHUP, reconfigure, SA_RESTART); squid_signal(SIGTERM, shut_down, SA_NODEFER | SA_RESETHAND | SA_RESTART); squid_signal(SIGINT, shut_down, SA_NODEFER | SA_RESETHAND | SA_RESTART); Index: squid.nlanr.net/squid-1.1/src/refresh.c diff -c squid.nlanr.net/squid-1.1/src/refresh.c:1.1.1.1 squid.nlanr.net/squid-1.1/src/refresh.c:1.2 *** squid.nlanr.net/squid-1.1/src/refresh.c:1.1.1.1 Tue Dec 16 01:07:51 1997 --- squid.nlanr.net/squid-1.1/src/refresh.c Wed Dec 17 01:59:07 1997 *************** *** 118,123 **** --- 118,124 ---- int refreshCheck(const StoreEntry * entry, const request_t * request, time_t delta) { + extern volatile int is_ip_reachable; refresh_t *R; time_t min = REFRESH_DEFAULT_MIN; int pct = REFRESH_DEFAULT_PCT; *************** *** 140,146 **** pattern, (int) min, pct, (int) max); age = check_time - entry->timestamp; debug(22, 3, "refreshCheck: age = %d\n", (int) age); ! if (request->max_age > -1) { if (age > request->max_age) { debug(22, 3, "refreshCheck: YES: age > client-max-age\n"); return 1; --- 141,152 ---- pattern, (int) min, pct, (int) max); age = check_time - entry->timestamp; debug(22, 3, "refreshCheck: age = %d\n", (int) age); ! if( !is_ip_reachable ) ! { ! return 0; ! } ! ! if (is_ip_reachable && (request->max_age > -1)) { if (age > request->max_age) { debug(22, 3, "refreshCheck: YES: age > client-max-age\n"); return 1; Index: squid.nlanr.net/squid-1.1/src/stat.c diff -c squid.nlanr.net/squid-1.1/src/stat.c:1.1.1.1 squid.nlanr.net/squid-1.1/src/stat.c:1.2 *** squid.nlanr.net/squid-1.1/src/stat.c:1.1.1.1 Tue Dec 16 01:07:52 1997 --- squid.nlanr.net/squid-1.1/src/stat.c Wed Dec 17 01:59:08 1997 *************** *** 710,715 **** --- 710,716 ---- static void info_get(const cacheinfo * obj, StoreEntry * sentry) { + extern volatile int is_ip_reachable; const char *tod = NULL; float f; #if defined(HAVE_GETRUSAGE) && defined(RUSAGE_SELF) *************** *** 725,730 **** --- 726,734 ---- storeAppendPrintf(sentry, open_bracket); storeAppendPrintf(sentry, "{Squid Object Cache: Version %s}\n", version_string); + storeAppendPrintf(sentry, "{IP-reachable: %s}\n", + is_ip_reachable ? "yes":"no" ); + tod = mkrfc1123(squid_starttime); storeAppendPrintf(sentry, "{Start Time:\t%s}\n", tod); tod = mkrfc1123(squid_curtime); Index: squid.nlanr.net/squid-1.1/src/tools.c diff -c squid.nlanr.net/squid-1.1/src/tools.c:1.1.1.1 squid.nlanr.net/squid-1.1/src/tools.c:1.2 *** squid.nlanr.net/squid-1.1/src/tools.c:1.1.1.1 Tue Dec 16 01:07:52 1997 --- squid.nlanr.net/squid-1.1/src/tools.c Wed Dec 17 01:59:08 1997 *************** *** 314,319 **** --- 314,341 ---- _db_init(Config.Log.log, Config.debugOptions); state = 0; } + #if !HAVE_SIGACTION + signal(sig, sigusr2_handle); /* reinstall */ + #endif + } + + void + set_ipreachable(int sig) + { + extern volatile int is_ip_reachable; + debug(21, 1, "set_ipreachable: SIGWINCH received.\n"); + is_ip_reachable = 1; + #if !HAVE_SIGACTION + signal(sig, sigusr2_handle); /* reinstall */ + #endif + } + + void + reset_ipreachable(int sig) + { + extern volatile int is_ip_reachable; + debug(21, 1, "reset_ipreachable: SIGPROF received.\n"); + is_ip_reachable = 0; #if !HAVE_SIGACTION signal(sig, sigusr2_handle); /* reinstall */ #endif Index: squid.nlanr.net/squid-1.1/src/tools.h diff -c squid.nlanr.net/squid-1.1/src/tools.h:1.1.1.1 squid.nlanr.net/squid-1.1/src/tools.h:1.2 *** squid.nlanr.net/squid-1.1/src/tools.h:1.1.1.1 Tue Dec 16 01:07:52 1997 --- squid.nlanr.net/squid-1.1/src/tools.h Wed Dec 17 01:59:09 1997 *************** *** 112,117 **** --- 112,119 ---- extern void fatal _PARAMS((const char *message)); extern void fatal_dump _PARAMS((const char *message)); extern void sigusr2_handle _PARAMS((int sig)); + extern void set_ipreachable _PARAMS((int sig)); + extern void reset_ipreachable _PARAMS((int sig)); extern void sig_child _PARAMS((int sig)); extern void leave_suid _PARAMS((void)); extern void enter_suid _PARAMS((void));