Commit ba9a6117 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Collaps the backend TCP pools to only identify by {IPv4+IPv6}

parent 70e143c1
...@@ -116,7 +116,7 @@ void VBP_Remove(struct backend *b, struct vrt_backend_probe const *p); ...@@ -116,7 +116,7 @@ void VBP_Remove(struct backend *b, struct vrt_backend_probe const *p);
void VBP_Use(const struct backend *b, const struct vrt_backend_probe *p); void VBP_Use(const struct backend *b, const struct vrt_backend_probe *p);
void VBP_Summary(struct cli *cli, const struct vbp_target *vt); void VBP_Summary(struct cli *cli, const struct vbp_target *vt);
struct tcp_pool *VBT_Ref(const char *name, const struct suckaddr *ip4, struct tcp_pool *VBT_Ref(const struct suckaddr *ip4,
const struct suckaddr *ip6); const struct suckaddr *ip6);
void VBT_Rel(struct tcp_pool **tpp); void VBT_Rel(struct tcp_pool **tpp);
int VBT_Open(const struct tcp_pool *tp, double tmo, const struct suckaddr **sa); int VBT_Open(const struct tcp_pool *tp, double tmo, const struct suckaddr **sa);
......
...@@ -103,8 +103,7 @@ VBE_AddBackend(const char *vcl, const struct vrt_backend *vb) ...@@ -103,8 +103,7 @@ VBE_AddBackend(const char *vcl, const struct vrt_backend *vb)
b->ipv6_addr = vb->ipv6_addr; b->ipv6_addr = vb->ipv6_addr;
b->port = vb->port; b->port = vb->port;
b->tcp_pool = VBT_Ref(vb->vcl_name, b->tcp_pool = VBT_Ref(vb->ipv4_suckaddr, vb->ipv6_suckaddr);
vb->ipv4_suckaddr, vb->ipv6_suckaddr);
/* /*
* Copy over the sockaddrs * Copy over the sockaddrs
......
...@@ -131,21 +131,18 @@ tcp_handle(struct waited *w, enum wait_event ev, double now) ...@@ -131,21 +131,18 @@ tcp_handle(struct waited *w, enum wait_event ev, double now)
} }
/*-------------------------------------------------------------------- /*--------------------------------------------------------------------
* Reference a TCP pool given by {name, ip4, ip6} triplet. Create if * Reference a TCP pool given by {ip4, ip6} pair. Create if it
* it doesn't exist already. * doesn't exist already.
*/ */
struct tcp_pool * struct tcp_pool *
VBT_Ref(const char *name, const struct suckaddr *ip4, VBT_Ref(const struct suckaddr *ip4, const struct suckaddr *ip6)
const struct suckaddr *ip6)
{ {
struct tcp_pool *tp; struct tcp_pool *tp;
ASSERT_CLI(); ASSERT_CLI();
VTAILQ_FOREACH(tp, &pools, list) { VTAILQ_FOREACH(tp, &pools, list) {
assert(tp->refcnt > 0); assert(tp->refcnt > 0);
if (strcmp(tp->name, name))
continue;
if (ip4 == NULL) { if (ip4 == NULL) {
if (tp->ip4 != NULL) if (tp->ip4 != NULL)
continue; continue;
...@@ -170,7 +167,6 @@ VBT_Ref(const char *name, const struct suckaddr *ip4, ...@@ -170,7 +167,6 @@ VBT_Ref(const char *name, const struct suckaddr *ip4,
ALLOC_OBJ(tp, TCP_POOL_MAGIC); ALLOC_OBJ(tp, TCP_POOL_MAGIC);
AN(tp); AN(tp);
REPLACE(tp->name, name);
if (ip4 != NULL) if (ip4 != NULL)
tp->ip4 = VSA_Clone(ip4); tp->ip4 = VSA_Clone(ip4);
if (ip6 != NULL) if (ip6 != NULL)
......
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