From: wessels <> Date: Sat, 7 Mar 1998 05:53:05 +0000 (+0000) Subject: make source_ping feature not compiled by default X-Git-Tag: SQUID_3_0_PRE1~3897 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0ab965dacd679499bec7837b3108ac8d6818874a;p=thirdparty%2Fsquid.git make source_ping feature not compiled by default --- diff --git a/src/cf.data.pre b/src/cf.data.pre index ecd716f094..d15663f990 100644 --- a/src/cf.data.pre +++ b/src/cf.data.pre @@ -293,11 +293,11 @@ DOC_START single_parent_bypass off DOC_END - NAME: source_ping COMMENT: on|off TYPE: onoff DEFAULT: off +IFDEF: ALLOW_SOURCE_PING LOC: Config.onoff.source_ping DOC_START If source_ping is enabled, then Squid will include the source diff --git a/src/neighbors.cc b/src/neighbors.cc index 3c005deaef..0283fb1a89 100644 --- a/src/neighbors.cc +++ b/src/neighbors.cc @@ -1,6 +1,6 @@ /* - * $Id: neighbors.cc,v 1.178 1998/03/05 08:33:42 wessels Exp $ + * $Id: neighbors.cc,v 1.179 1998/03/06 22:53:07 wessels Exp $ * * DEBUG: section 15 Neighbor Routines * AUTHOR: Harvest Derived @@ -407,11 +407,8 @@ neighborsUdpPing(request_t * request, void *callback_data, int *exprep) { - char *host = request->host; const char *url = storeUrl(entry); MemObject *mem = entry->mem_obj; - const ipcache_addrs *ia = NULL; - struct sockaddr_in to_addr; peer *p = NULL; int i; int reqnum = 0; @@ -492,8 +489,12 @@ neighborsUdpPing(request_t * request, if ((first_ping = first_ping->next) == NULL) first_ping = Config.peers; +#if ALLOW_SOURCE_PING /* only do source_ping if we have neighbors */ if (Config.npeers) { + const ipcache_addrs *ia = NULL; + struct sockaddr_in to_addr; + char *host = request->host; if (!Config.onoff.source_ping) { debug(15, 6) ("neighborsUdpPing: Source Ping is disabled.\n"); } else if ((ia = ipcache_gethostbyname(host, 0))) { @@ -518,6 +519,7 @@ neighborsUdpPing(request_t * request, host); } } +#endif #if LOG_ICP_NUMBERS request->hierarchy.n_sent = peers_pinged; request->hierarchy.n_expect = *exprep; @@ -692,10 +694,12 @@ neighborsUdpAck(const char *url, icp_common_t * header, const struct sockaddr_in if (p) { debug(15, 1) ("Ignoring SECHO from neighbor %s\n", p->host); neighborCountIgnored(p, opcode); - } else if (!Config.onoff.source_ping) { - debug(15, 1) ("Unsolicited SECHO from %s\n", inet_ntoa(from->sin_addr)); - } else { +#if ALLOW_SOURCE_PING + } else if (Config.onoff.source_ping) { mem->icp_reply_callback(NULL, ntype, header, mem->ircb_data); +#endif + } else { + debug(15, 1) ("Unsolicited SECHO from %s\n", inet_ntoa(from->sin_addr)); } } else if (opcode == ICP_DENIED) { if (p == NULL) { diff --git a/src/peer_select.cc b/src/peer_select.cc index ce23cf03cc..a97f0ba8bb 100644 --- a/src/peer_select.cc +++ b/src/peer_select.cc @@ -1,6 +1,6 @@ /* - * $Id: peer_select.cc,v 1.39 1998/03/05 08:28:01 wessels Exp $ + * $Id: peer_select.cc,v 1.40 1998/03/06 22:53:06 wessels Exp $ * * DEBUG: section 44 Peer Selection Algorithm * AUTHOR: Duane Wessels @@ -95,9 +95,12 @@ peerSelectIcpPing(request_t * request, int direct, StoreEntry * entry) assert(direct != DIRECT_YES); if (!EBIT_TEST(entry->flag, HIERARCHICAL) && direct != DIRECT_NO) return 0; - if (Config.onoff.single_parent_bypass && !Config.onoff.source_ping) - if (getSingleParent(request)) - return 0; + if (Config.onoff.single_parent_bypass) +#if ALLOW_SOURCE_PING + if (!Config.onoff.source_ping) +#endif + if (getSingleParent(request)) + return 0; if (EBIT_TEST(entry->flag, KEY_PRIVATE) && !neighbors_do_private_keys) if (direct != DIRECT_NO) return 0; diff --git a/src/structs.h b/src/structs.h index 0061241c1d..1b7c8f4ffe 100644 --- a/src/structs.h +++ b/src/structs.h @@ -293,7 +293,9 @@ struct _SquidConfig { int query_icmp; int icp_hit_stale; int buffered_logs; +#if ALLOW_SOURCE_PING int source_ping; +#endif int common_log; int log_mime_hdrs; int ident_lookup;