- Write Perl script to convert squid-1.0 store to squid-1.1
structure.
+Changes to squid-1.1.beta6 ():
+
+ - Fixed lots of function prototypes, etc (Ed Knowles).
+ - Added multicast patch (Martin Hamilton).
+
Changes to squid-1.1.beta5 (October 7, 1996):
- Fixed coredump in storeFreeMemory().
/*
- * $Id: cache_cf.cc,v 1.104 1996/10/09 15:34:19 wessels Exp $
+ * $Id: cache_cf.cc,v 1.105 1996/10/09 15:43:49 wessels Exp $
*
* DEBUG: section 3 Configuration File Parsing
* AUTHOR: Harvest Derived
static void parseIcpPortLine _PARAMS((void));
static void parseLocalDomainFile _PARAMS((char *fname));
static void parseLocalDomainLine _PARAMS((void));
+static void parseMcastGroupLine _PARAMS((void));
static void parseLogLine _PARAMS((void));
static void parseMemLine _PARAMS((void));
static void parseMgrLine _PARAMS((void));
u_short icp_port = CACHE_ICP_PORT;
int options = 0;
int weight = 1;
+ int mcast_ttl = 0;
int i;
if (!(hostname = strtok(NULL, w_space)))
options |= NEIGHBOR_NO_QUERY;
} else if (!strncasecmp(token, "weight=", 7)) {
weight = atoi(token + 7);
+ } else if (!strncasecmp(token, "ttl=", 4)) {
+ mcast_ttl = atoi(token + 4);
} else {
debug(3, 0, "parseCacheHostLine: token='%s'\n", token);
self_destruct();
}
if (weight < 1)
weight = 1;
- neighbors_cf_add(hostname, type, http_port, icp_port, options, weight);
+ neighbors_cf_add(hostname, type, http_port, icp_port, options,
+ weight, mcast_ttl);
}
static neighbor_t
}
}
+static void
+parseMcastGroupLine(void)
+{
+ char *token = NULL;
+ while ((token = strtok(NULL, w_space)))
+ wordlistAdd(&Config.mcast_group_list, token);
+}
+
static void
parseHttpPortLine(void)
{
else if (!strcmp(token, "local_domain"))
parseLocalDomainLine();
+ else if (!strcmp(token, "mcast_groups"))
+ parseMcastGroupLine();
+
else if (!strcmp(token, "tcp_incoming_address"))
parseAddressLine(&Config.Addrs.tcp_incoming);
wordlistDestroy(&Config.cache_dirs);
wordlistDestroy(&Config.hierarchy_stoplist);
wordlistDestroy(&Config.local_domain_list);
+ wordlistDestroy(&Config.mcast_group_list);
wordlistDestroy(&Config.inside_firewall_list);
wordlistDestroy(&Config.dns_testname_list);
ip_acl_destroy(&Config.local_ip_list);
/*
- * $Id: comm.cc,v 1.85 1996/10/09 15:34:22 wessels Exp $
+ * $Id: comm.cc,v 1.86 1996/10/09 15:43:51 wessels Exp $
*
* DEBUG: section 5 Socket Functions
* AUTHOR: Harvest Derived
safe_free(p);
}
+int
+comm_set_mcast_ttl(int fd, int mcast_ttl)
+{
+#ifdef IP_MULTICAST_TTL
+ debug(5, 10, "comm_set_mcast_ttl: setting multicast TTL %d on FD %d\n",
+ mcast_ttl, fd);
+ if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_TTL,
+ (char *) &mcast_ttl, sizeof(char)) < 0)
+ debug(5, 1, "comm_set_mcast_ttl: FD %d, TTL: %d: %s\n",
+ fd, mcast_ttl, xstrerror());
+#endif
+ return 0;
+}
+
+int
+comm_join_mcast_groups(int fd)
+{
+#ifdef IP_MULTICAST_TTL
+ struct ip_mreq mr;
+ wordlist *s = NULL;
+
+ for (s = Config.mcast_group_list; s; s = s->next) {
+ debug(5, 10,
+ "comm_join_mcast_groups: joining group %s on FD %d\n", s->key, fd);
+
+ mr.imr_multiaddr.s_addr = inet_addr(s->key);
+ mr.imr_interface.s_addr = INADDR_ANY;
+ if (setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP,
+ (char *) &mr, sizeof(struct ip_mreq)) < 0)
+ debug(5, 1, "comm_join_mcast_groups: FD %d, addr: %s\n",
+ fd, s->key);
+ }
+#endif
+ return 0;
+}
+
static void
commSetNoLinger(int fd)
{
debug(5, 1, "commSetReuseAddr: FD %d: %s\n", fd, xstrerror());
}
-#ifdef TCP_NODELAY
-static void
-commSetTcpNoDelay(int fd)
-{
- int on = 1;
- if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (char *) &on, sizeof(on)) < 0)
- debug(5, 1, "commSetTcpNoDelay: FD %d: %s\n", fd, xstrerror());
-}
-#endif
-
static void
commSetTcpRcvbuf(int fd, int size)
{
#endif
}
+#ifdef TCP_NODELAY
+static void
+commSetTcpNoDelay(int fd)
+{
+ int on = 1;
+ if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (char *) &on, sizeof(on)) < 0)
+ debug(5, 1, "commSetTcpNoDelay: FD %d: %s\n", fd, xstrerror());
+}
+#endif
+
char **
getAddressList(char *name)
{
/*
- * $Id: main.cc,v 1.88 1996/10/09 15:34:32 wessels Exp $
+ * $Id: main.cc,v 1.89 1996/10/09 15:43:52 wessels Exp $
*
* DEBUG: section 1 Startup and Main Loop
* AUTHOR: Harvest Derived
COMM_SELECT_READ,
icpHandleUdp,
0);
+ comm_join_mcast_groups(theInIcpConnection);
debug(1, 1, "Accepting ICP connections on FD %d.\n",
theInIcpConnection);
/*
- * $Id: neighbors.cc,v 1.61 1996/10/09 15:34:33 wessels Exp $
+ * $Id: neighbors.cc,v 1.62 1996/10/09 15:43:53 wessels Exp $
*
* DEBUG: section 15 Neighbor Routines
* AUTHOR: Harvest Derived
PROTO_NONE);
}
- e->stats.ack_deficit++;
+ if (e->mcast_ttl > 0) {
+ /* XXX kill us off, so Squid won't expect a reply */
+ e->stats.ack_deficit = HIER_MAX_DEFICIT;
+ } else {
+ e->stats.ack_deficit++;
+ }
e->stats.pings_sent++;
debug(15, 3, "neighborsUdpPing: %s: ack_deficit = %d\n",
}
void
-neighbors_cf_add(char *host, char *type, int http_port, int icp_port, int options, int weight)
+neighbors_cf_add(char *host, char *type, int http_port, int icp_port, int options, int weight, int mcast_ttl)
{
struct neighbor_cf *t, *u;
t->icp_port = icp_port;
t->options = options;
t->weight = weight;
+ t->mcast_ttl = mcast_ttl;
t->next = (struct neighbor_cf *) NULL;
if (Neighbor_cf == (struct neighbor_cf *) NULL) {
e = xcalloc(1, sizeof(edge));
e->http_port = t->http_port;
e->icp_port = t->icp_port;
+ e->mcast_ttl = t->mcast_ttl;
e->options = t->options;
e->weight = t->weight;
e->host = t->host;