Re: potential patches

From: Brian Degenhardt <bmd@dont-contact.us>
Date: Thu, 14 Sep 2000 18:12:45 -0700

On Thu, Sep 14, 2000 at 11:00:16AM +0200, Henrik Nordstrom wrote:
> Brian Degenhardt wrote:
>
> > 1) Patch to do stack backtraces upon crash in linux using pstack:
> > http://www.whatsis.com/pstack/
>
> A similar thing but using the built-in stacktrace primitives of glibc is
> already in Squid.

Ah yes... I've been working with the 2.3, perhaps I should look at 2.4
before I set to patching stuff.

> > 2) Patch for a host to remove itself from it's cache peer list.
>
> Good thing.

Here it is against 2.4 head:

--- cache_cf.c.old Mon Jul 17 23:16:40 2000
+++ cache_cf.c Thu Sep 14 17:13:05 2000
@@ -1029,7 +1029,7 @@
     peer *p;
     int i;
     sockaddr_in_list *s;
- const char *me = null_string; /* XXX */
+ const char *me = getMyHostname();
     p = memAllocate(MEM_PEER);
     p->http_port = CACHE_HTTP_PORT;
     p->icp.port = CACHE_ICP_PORT;
@@ -1049,9 +1049,11 @@
        for (s = Config.Sockaddr.http; s; s = s->next) {
            if (p->http_port != ntohs(s->s.sin_port))
                continue;
- debug(15, 0) ("parse_peer: Peer looks like myself: %s %s/%d/%d\n",
- p->type, p->host, p->http_port, p->icp.port);
- self_destruct();
+ debug(15, 1) ("parse_peer: Peer looks like myself: Ignoring %s %s/%d/%d\n",
+ neighborTypeStr(p), p->host, p->http_port, p->icp.port);
+ xfree( p->host );
+ memFree( p, MEM_PEER );
+ return;
        }
     }
     while ((token = strtok(NULL, w_space))) {

> > 3) Patch for a squid to error out if it is using append_domain in conjuction
> > with a situation where getMyHostname() returning a non fqdn (we
> > discussed this on the squid-dev mailing list a ways back).
>
> If should error out if it cannot find a FQDN name for itself. This is
> regardless of append_domain or not, but if using append_domain it is a
> must.

--- tools.c.old Wed Jul 12 23:06:16 2000
+++ tools.c Thu Sep 14 18:07:39 2000
@@ -442,9 +442,10 @@
                inet_ntoa(Config.Sockaddr.http->s.sin_addr),
                host);
            present = 1;
- return host;
+ if( strchr( host, '.' ) )
+ return host;
        }
- debug(50, 1) ("WARNING: failed to resolve %s to a hostname\n",
+ debug(50, 1) ("WARNING: failed to resolve %s to a fully qualified hostname\n",
            inet_ntoa(Config.Sockaddr.http->s.sin_addr));
     }
     /*
@@ -461,7 +462,8 @@
        /* use the official name from DNS lookup */
        xstrncpy(host, h->h_name, SQUIDHOSTNAMELEN);
        present = 1;
- return host;
+ if( strchr( host, '.' ) )
+ return host;
     }
     fatal("Could not determine fully qualified hostname. Please set 'visible_hostname'\n");
     return NULL; /* keep compiler happy */

> > Also, if I have time I'd really be interested in offering the include
> > directive for squid.conf files. I'm just a beginner squid hacker so I'm
> > sure somebody else could do it faster than I, but if you think that that
> > feature may go unclaimed for a while, I'd be happy to pick it up.
>
> AFAIK it is assigned a quite low priority. You are more than welcome to
> take a stab at it.

Perhaps I will.

> > If this is a query best made to all the squid hackers feel free to forward
> > this to squid-dev. Thanks for the help.
>
> These discussions should always be seen but the other squid hackers.
> That is why we have squid-dev.

Will do. If you wouldn't mind subscribing me I'd be much abliged.

cheers

-bmd
Received on Fri Sep 15 2000 - 04:36:46 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:12:37 MST