Commit 33f38803 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Start percolating struct suckaddr out of the VGC code to VRT.

parent c6fdc398
......@@ -174,7 +174,7 @@ VBE_AddBackend(struct cli *cli, const struct vrt_backend *vb)
char buf[128];
AN(vb->vcl_name);
assert(vb->ipv4_sockaddr != NULL || vb->ipv6_sockaddr != NULL);
assert(vb->ipv4_suckaddr != NULL || vb->ipv6_suckaddr != NULL);
(void)cli;
ASSERT_CLI();
......@@ -183,11 +183,11 @@ VBE_AddBackend(struct cli *cli, const struct vrt_backend *vb)
CHECK_OBJ_NOTNULL(b, BACKEND_MAGIC);
if (strcmp(b->vcl_name, vb->vcl_name))
continue;
if (vb->ipv4_sockaddr != NULL &&
VSA_Compare(b->ipv4, vb->ipv4_sockaddr))
if (vb->ipv4_suckaddr != NULL &&
VSA_Compare(b->ipv4, vb->ipv4_suckaddr))
continue;
if (vb->ipv6_sockaddr != NULL &&
VSA_Compare(b->ipv6, vb->ipv6_sockaddr))
if (vb->ipv6_suckaddr != NULL &&
VSA_Compare(b->ipv6, vb->ipv6_suckaddr))
continue;
b->refcount++;
b->vsc->vcls++;
......@@ -223,10 +223,10 @@ VBE_AddBackend(struct cli *cli, const struct vrt_backend *vb)
/*
* Copy over the sockaddrs
*/
if (vb->ipv4_sockaddr != NULL)
copy_sockaddr(&b->ipv4, vb->ipv4_sockaddr);
if (vb->ipv6_sockaddr != NULL)
copy_sockaddr(&b->ipv6, vb->ipv6_sockaddr);
if (vb->ipv4_suckaddr != NULL)
copy_sockaddr(&b->ipv4, vb->ipv4_suckaddr);
if (vb->ipv6_suckaddr != NULL)
copy_sockaddr(&b->ipv6, vb->ipv6_suckaddr);
assert(b->ipv4 != NULL || b->ipv6 != NULL);
......
......@@ -125,8 +125,8 @@ struct vrt_backend {
const char *ipv6_addr;
const char *port;
const void *ipv4_sockaddr;
const void *ipv6_sockaddr;
const struct suckaddr *ipv4_suckaddr;
const struct suckaddr *ipv6_suckaddr;
const char *hosthdr;
......
......@@ -65,11 +65,13 @@ Emit_Sockaddr(struct vcc *tl, const struct token *t_host, const char *port)
&ipv4, &ipv4a, &ipv6, &ipv6a, &pa, 2, t_host, "Backend host");
ERRCHK(tl);
if (ipv4 != NULL) {
Fb(tl, 0, "\t.ipv4_sockaddr = %s,\n", ipv4);
Fb(tl, 0, "\t.ipv4_suckaddr = (const struct suckaddr *)%s,\n",
ipv4);
Fb(tl, 0, "\t.ipv4_addr = \"%s\",\n", ipv4a);
}
if (ipv6 != NULL) {
Fb(tl, 0, "\t.ipv6_sockaddr = %s,\n", ipv6);
Fb(tl, 0, "\t.ipv6_suckaddr = (const struct suckaddr *)%s,\n",
ipv6);
Fb(tl, 0, "\t.ipv6_addr = \"%s\",\n", ipv6a);
}
Fb(tl, 0, "\t.port = \"%s\",\n", pa);
......
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