Commit 58d36cb3 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp Committed by Tollef Fog Heen

Fix a compiler fault if two IP comparisons were on the same line

of source code.

This is substantially DocWilcos fix, but instead of adding yet another
unique numbering variable, I have collapsed the once we have into
a single one.

Fixes #948
parent 35dc3964
varnishtest "anon acl numbering"
server s1 {
rxreq
expect req.http.foo1 == "Match"
expect req.http.foo2 == "Match"
txresp -bodylen 40
} -start
varnish v1 -vcl+backend {
sub vcl_recv {
if (client.ip == "${s1_addr}" || client.ip == "${bad_ip}") {
set req.http.foo1 = "Match";
}
if (client.ip == "${bad_ip}" || client.ip == "${s1_addr}") {
set req.http.foo2 = "Match";
}
}
} -start
client c1 {
txreq
rxresp
expect resp.bodylen == 40
} -run
...@@ -454,7 +454,7 @@ vcc_Acl_Hack(struct vcc *tl, char *b) ...@@ -454,7 +454,7 @@ vcc_Acl_Hack(struct vcc *tl, char *b)
VTAILQ_INIT(&tl->acl); VTAILQ_INIT(&tl->acl);
tcond = tl->t->tok; tcond = tl->t->tok;
vcc_NextToken(tl); vcc_NextToken(tl);
bprintf(acln, "%u", tl->cnt); bprintf(acln, "%u", tl->unique++);
vcc_acl_entry(tl); vcc_acl_entry(tl);
vcc_acl_emit(tl, acln, 1); vcc_acl_emit(tl, acln, 1);
sprintf(b, "%smatch_acl_anon_%s(sp, \v1)", sprintf(b, "%smatch_acl_anon_%s(sp, \v1)",
......
...@@ -83,7 +83,7 @@ emit_sockaddr(struct vcc *tl, void *sa, unsigned sal) ...@@ -83,7 +83,7 @@ emit_sockaddr(struct vcc *tl, void *sa, unsigned sal)
AN(sal); AN(sal);
assert(sal < 256); assert(sal < 256);
Fh(tl, 0, "\nstatic const unsigned char sockaddr%u[%d] = {\n", Fh(tl, 0, "\nstatic const unsigned char sockaddr%u[%d] = {\n",
tl->nsockaddr, sal + 1); tl->unique, sal + 1);
Fh(tl, 0, " %3u, /* Length */\n", sal); Fh(tl, 0, " %3u, /* Length */\n", sal);
u = sa; u = sa;
for (len = 0; len <sal; len++) { for (len = 0; len <sal; len++) {
...@@ -96,7 +96,7 @@ emit_sockaddr(struct vcc *tl, void *sa, unsigned sal) ...@@ -96,7 +96,7 @@ emit_sockaddr(struct vcc *tl, void *sa, unsigned sal)
Fh(tl, 0, "\n"); Fh(tl, 0, "\n");
} }
Fh(tl, 0, "\n};\n"); Fh(tl, 0, "\n};\n");
return (tl->nsockaddr++); return (tl->unique++);
} }
/*-------------------------------------------------------------------- /*--------------------------------------------------------------------
......
...@@ -162,8 +162,7 @@ struct vcc { ...@@ -162,8 +162,7 @@ struct vcc {
struct token *t_dir; struct token *t_dir;
struct token *t_policy; struct token *t_policy;
unsigned recnt; unsigned unique;
unsigned nsockaddr;
unsigned nvmodpriv; unsigned nvmodpriv;
unsigned err_unref; unsigned err_unref;
......
...@@ -63,7 +63,7 @@ vcc_regexp(struct vcc *tl) ...@@ -63,7 +63,7 @@ vcc_regexp(struct vcc *tl)
return (NULL); return (NULL);
} }
VRE_free(&t); VRE_free(&t);
sprintf(buf, "VGC_re_%u", tl->recnt++); sprintf(buf, "VGC_re_%u", tl->unique++);
p = TlAlloc(tl, strlen(buf) + 1); p = TlAlloc(tl, strlen(buf) + 1);
strcpy(p, buf); strcpy(p, buf);
......
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