Commit 65fb93ed authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Be more paranoid about srcaddr


git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@525 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 3d12a962
......@@ -63,6 +63,7 @@ SES_RefSrcAddr(struct sess *sp)
struct srcaddrhead *ch;
time_t now;
assert(sp->srcaddr == NULL);
for (u = 0, p = sp->addr; *p; p++)
u += u + *p;
v = u % CLIENT_HASH;
......@@ -105,6 +106,7 @@ SES_RefSrcAddr(struct sess *sp)
VSL_stats->n_srcaddr++;
} else
TAILQ_REMOVE(ch, c3, list);
assert (c3 != NULL);
if (c3 != NULL) {
memset(c3, 0, sizeof *c3);
strcpy(c3->addr, sp->addr);
......@@ -115,8 +117,8 @@ SES_RefSrcAddr(struct sess *sp)
c3->sah = ch;
VSL_stats->n_srcaddr_act++;
TAILQ_INSERT_TAIL(ch, c3, list);
sp->srcaddr = c3;
}
sp->srcaddr = c3;
AZ(pthread_mutex_unlock(&ses_mtx));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment