diff --git a/include/types/proxy.h b/include/types/proxy.h index f6d2634f6..45ef2c824 100644 --- a/include/types/proxy.h +++ b/include/types/proxy.h @@ -395,6 +395,7 @@ struct proxy { struct conn_src conn_src; /* connection source settings */ enum obj_type *default_target; /* default target to use for accepted streams or NULL */ struct proxy *next; + struct proxy *next_stkt_ref; /* Link to the list of proxies which refer to the same stick-table. */ struct list logsrvs; struct list logformat; /* log_format linked list */ diff --git a/include/types/stick_table.h b/include/types/stick_table.h index ff9546cd5..a4baeb37e 100644 --- a/include/types/stick_table.h +++ b/include/types/stick_table.h @@ -185,6 +185,7 @@ struct stktable { void *p; } data_arg[STKTABLE_DATA_TYPES]; /* optional argument of each data type */ struct proxy *proxy; /* The proxy this stick-table is attached to, if any.*/ + struct proxy *proxies_list; /* The list of proxies which reference this stick-table. */ }; extern struct stktable_data_type stktable_data_types[STKTABLE_DATA_TYPES]; diff --git a/src/action.c b/src/action.c index 4cce7a418..54542420c 100644 --- a/src/action.c +++ b/src/action.c @@ -56,6 +56,10 @@ int check_trk_action(struct act_rule *rule, struct proxy *px, char **err) return 0; } else { + if (target->proxies_list != px) { + px->next_stkt_ref = target->proxies_list; + target->proxies_list = px; + } free(rule->arg.trk_ctr.table.n); rule->arg.trk_ctr.table.t = target; /* Note: if we decide to enhance the track-sc syntax, we may be diff --git a/src/cfgparse-listen.c b/src/cfgparse-listen.c index 2b2785a55..7537bc2ec 100644 --- a/src/cfgparse-listen.c +++ b/src/cfgparse-listen.c @@ -1749,6 +1749,12 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) stktable_store_name(curproxy->table); curproxy->table->next = stktables_list; stktables_list = curproxy->table; + + /* Add this proxy to the list of proxies which refer to its stick-table. */ + if (curproxy->table->proxies_list != curproxy) { + curproxy->next_stkt_ref = curproxy->table->proxies_list; + curproxy->table->proxies_list = curproxy; + } } else if (!strcmp(args[0], "stick")) { struct sticking_rule *rule; diff --git a/src/cfgparse.c b/src/cfgparse.c index 3e326330f..c7db11068 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -3861,6 +3861,19 @@ int check_config_validity() if (curproxy->table && curproxy->table->peers.p) curproxy->table->peers.p->peers_fe->bind_proc |= curproxy->bind_proc; + /* compute the required process bindings for the peers from + * for all the stick-tables, the ones coming with "peers" sections included. + */ + for (t = stktables_list; t; t = t->next) { + struct proxy *p; + + for (p = t->proxies_list; p; p = p->next_stkt_ref) { + if (t->peers.p && t->peers.p->peers_fe) { + t->peers.p->peers_fe->bind_proc |= p->bind_proc; + } + } + } + if (cfg_peers) { struct peers *curpeers = cfg_peers, **last; struct peer *p, *pb; diff --git a/src/sample.c b/src/sample.c index aa20d35d1..2a1ce8d5e 100644 --- a/src/sample.c +++ b/src/sample.c @@ -1278,6 +1278,11 @@ int smp_resolve_args(struct proxy *p) break; } + if (t->proxies_list != p) { + p->next_stkt_ref = t->proxies_list; + t->proxies_list = p; + } + free(arg->data.str.area); arg->data.str.area = NULL; arg->unresolved = 0;