diff --git a/include/proto/proxy.h b/include/proto/proxy.h index c75c0da21..558718ba2 100644 --- a/include/proto/proxy.h +++ b/include/proto/proxy.h @@ -184,6 +184,21 @@ static inline int l7_status_match(struct proxy *p, int status) } return 0; } + +/* Return 1 if
proxy is in list of proxies which are also stick-tables,
+ * 0 if not.
+ */
+static inline int in_proxies_list(struct proxy *list, struct proxy *proxy)
+{
+ struct proxy *p;
+
+ for (p = list; p; p = p->next_stkt_ref)
+ if (proxy == p)
+ return 1;
+
+ return 0;
+}
+
#endif /* _PROTO_PROXY_H */
/*
diff --git a/src/action.c b/src/action.c
index 54542420c..76842022c 100644
--- a/src/action.c
+++ b/src/action.c
@@ -56,7 +56,7 @@ int check_trk_action(struct act_rule *rule, struct proxy *px, char **err)
return 0;
}
else {
- if (target->proxies_list != px) {
+ if (!in_proxies_list(target->proxies_list, px)) {
px->next_stkt_ref = target->proxies_list;
target->proxies_list = px;
}
diff --git a/src/sample.c b/src/sample.c
index 94c605f92..6327b6b08 100644
--- a/src/sample.c
+++ b/src/sample.c
@@ -1274,7 +1274,7 @@ int smp_resolve_args(struct proxy *p)
break;
}
- if (t->proxies_list != p) {
+ if (!in_proxies_list(t->proxies_list, p)) {
p->next_stkt_ref = t->proxies_list;
t->proxies_list = p;
}