MINOR: action: Use trk_idx instead of tcp/http_trk_idx

So tcp_trk_idx and http_trk_idx have been removed.
This commit is contained in:
Christopher Faulet 2017-09-18 11:57:31 +02:00 committed by Willy Tarreau
parent 7421b14c22
commit 4fce0d8447
5 changed files with 27 additions and 42 deletions

View File

@ -226,14 +226,6 @@ static inline int http_body_bytes(const struct http_msg *msg)
return len;
}
/* for an http-request/response action ACT_ACTION_TRK_SC*, return a tracking index
* starting at zero for SC0. Unknown actions also return zero.
*/
static inline int http_trk_idx(int trk_action)
{
return trk_action - ACT_ACTION_TRK_SC0;
}
#endif /* _PROTO_PROTO_HTTP_H */
/*

View File

@ -37,14 +37,6 @@ void tcp_req_sess_keywords_register(struct action_kw_list *kw_list);
void tcp_req_cont_keywords_register(struct action_kw_list *kw_list);
void tcp_res_cont_keywords_register(struct action_kw_list *kw_list);
/* for a tcp-request action ACT_TCP_TRK_*, return a tracking index starting at
* zero for SC0. Unknown actions also return zero.
*/
static inline int tcp_trk_idx(int trk_action)
{
return trk_action - ACT_ACTION_TRK_SC0;
}
#endif /* _PROTO_TCP_RULES_H */
/*

View File

@ -54,6 +54,7 @@
#include <types/stats.h>
#include <proto/acl.h>
#include <proto/action.h>
#include <proto/auth.h>
#include <proto/backend.h>
#include <proto/channel.h>
@ -7879,7 +7880,7 @@ int check_config_validity()
if (!target) {
Alert("Proxy '%s': unable to find table '%s' referenced by track-sc%d.\n",
curproxy->id, trule->arg.trk_ctr.table.n,
tcp_trk_idx(trule->action));
trk_idx(trule->action));
cfgerr++;
}
else if (target->table.size == 0) {
@ -7890,7 +7891,7 @@ int check_config_validity()
else if (!stktable_compatible_sample(trule->arg.trk_ctr.expr, target->table.type)) {
Alert("Proxy '%s': stick-table '%s' uses a type incompatible with the 'track-sc%d' rule.\n",
curproxy->id, trule->arg.trk_ctr.table.n ? trule->arg.trk_ctr.table.n : curproxy->id,
tcp_trk_idx(trule->action));
trk_idx(trule->action));
cfgerr++;
}
else {
@ -7918,7 +7919,7 @@ int check_config_validity()
if (!target) {
Alert("Proxy '%s': unable to find table '%s' referenced by track-sc%d.\n",
curproxy->id, trule->arg.trk_ctr.table.n,
tcp_trk_idx(trule->action));
trk_idx(trule->action));
cfgerr++;
}
else if (target->table.size == 0) {
@ -7929,7 +7930,7 @@ int check_config_validity()
else if (!stktable_compatible_sample(trule->arg.trk_ctr.expr, target->table.type)) {
Alert("Proxy '%s': stick-table '%s' uses a type incompatible with the 'track-sc%d' rule.\n",
curproxy->id, trule->arg.trk_ctr.table.n ? trule->arg.trk_ctr.table.n : curproxy->id,
tcp_trk_idx(trule->action));
trk_idx(trule->action));
cfgerr++;
}
else {
@ -7957,7 +7958,7 @@ int check_config_validity()
if (!target) {
Alert("Proxy '%s': unable to find table '%s' referenced by track-sc%d.\n",
curproxy->id, trule->arg.trk_ctr.table.n,
tcp_trk_idx(trule->action));
trk_idx(trule->action));
cfgerr++;
}
else if (target->table.size == 0) {
@ -7968,7 +7969,7 @@ int check_config_validity()
else if (!stktable_compatible_sample(trule->arg.trk_ctr.expr, target->table.type)) {
Alert("Proxy '%s': stick-table '%s' uses a type incompatible with the 'track-sc%d' rule.\n",
curproxy->id, trule->arg.trk_ctr.table.n ? trule->arg.trk_ctr.table.n : curproxy->id,
tcp_trk_idx(trule->action));
trk_idx(trule->action));
cfgerr++;
}
else {
@ -8022,7 +8023,7 @@ int check_config_validity()
if (!target) {
Alert("Proxy '%s': unable to find table '%s' referenced by track-sc%d.\n",
curproxy->id, hrqrule->arg.trk_ctr.table.n,
http_trk_idx(hrqrule->action));
trk_idx(hrqrule->action));
cfgerr++;
}
else if (target->table.size == 0) {
@ -8033,7 +8034,7 @@ int check_config_validity()
else if (!stktable_compatible_sample(hrqrule->arg.trk_ctr.expr, target->table.type)) {
Alert("Proxy '%s': stick-table '%s' uses a type incompatible with the 'track-sc%d' rule.\n",
curproxy->id, hrqrule->arg.trk_ctr.table.n ? hrqrule->arg.trk_ctr.table.n : curproxy->id,
http_trk_idx(hrqrule->action));
trk_idx(hrqrule->action));
cfgerr++;
}
else {
@ -8061,7 +8062,7 @@ int check_config_validity()
if (!target) {
Alert("Proxy '%s': unable to find table '%s' referenced by track-sc%d.\n",
curproxy->id, hrqrule->arg.trk_ctr.table.n,
http_trk_idx(hrqrule->action));
trk_idx(hrqrule->action));
cfgerr++;
}
else if (target->table.size == 0) {
@ -8072,7 +8073,7 @@ int check_config_validity()
else if (!stktable_compatible_sample(hrqrule->arg.trk_ctr.expr, target->table.type)) {
Alert("Proxy '%s': stick-table '%s' uses a type incompatible with the 'track-sc%d' rule.\n",
curproxy->id, hrqrule->arg.trk_ctr.table.n ? hrqrule->arg.trk_ctr.table.n : curproxy->id,
http_trk_idx(hrqrule->action));
trk_idx(hrqrule->action));
cfgerr++;
}
else {

View File

@ -2717,7 +2717,7 @@ resume_execution:
* applies.
*/
if (stkctr_entry(&s->stkctr[http_trk_idx(rule->action)]) == NULL) {
if (stkctr_entry(&s->stkctr[trk_idx(rule->action)]) == NULL) {
struct stktable *t;
struct stksess *ts;
struct stktable_key *key;
@ -2727,7 +2727,7 @@ resume_execution:
key = stktable_fetch_key(t, s->be, sess, s, SMP_OPT_DIR_REQ | SMP_OPT_FINAL, rule->arg.trk_ctr.expr, NULL);
if (key && (ts = stktable_get_entry(t, key))) {
stream_track_stkctr(&s->stkctr[http_trk_idx(rule->action)], t, ts);
stream_track_stkctr(&s->stkctr[trk_idx(rule->action)], t, ts);
/* let's count a new HTTP request as it's the first time we do it */
ptr = stktable_data_ptr(t, ts, STKTABLE_DT_HTTP_REQ_CNT);
@ -2739,9 +2739,9 @@ resume_execution:
update_freq_ctr_period(&stktable_data_cast(ptr, http_req_rate),
t->data_arg[STKTABLE_DT_HTTP_REQ_RATE].u, 1);
stkctr_set_flags(&s->stkctr[http_trk_idx(rule->action)], STKCTR_TRACK_CONTENT);
stkctr_set_flags(&s->stkctr[trk_idx(rule->action)], STKCTR_TRACK_CONTENT);
if (sess->fe != s->be)
stkctr_set_flags(&s->stkctr[http_trk_idx(rule->action)], STKCTR_TRACK_BACKEND);
stkctr_set_flags(&s->stkctr[trk_idx(rule->action)], STKCTR_TRACK_BACKEND);
}
}
break;
@ -2990,7 +2990,7 @@ resume_execution:
* applies.
*/
if (stkctr_entry(&s->stkctr[http_trk_idx(rule->action)]) == NULL) {
if (stkctr_entry(&s->stkctr[trk_idx(rule->action)]) == NULL) {
struct stktable *t;
struct stksess *ts;
struct stktable_key *key;
@ -3000,7 +3000,7 @@ resume_execution:
key = stktable_fetch_key(t, s->be, sess, s, SMP_OPT_DIR_RES | SMP_OPT_FINAL, rule->arg.trk_ctr.expr, NULL);
if (key && (ts = stktable_get_entry(t, key))) {
stream_track_stkctr(&s->stkctr[http_trk_idx(rule->action)], t, ts);
stream_track_stkctr(&s->stkctr[trk_idx(rule->action)], t, ts);
/* let's count a new HTTP request as it's the first time we do it */
ptr = stktable_data_ptr(t, ts, STKTABLE_DT_HTTP_REQ_CNT);
@ -3012,9 +3012,9 @@ resume_execution:
update_freq_ctr_period(&stktable_data_cast(ptr, http_req_rate),
t->data_arg[STKTABLE_DT_HTTP_REQ_RATE].u, 1);
stkctr_set_flags(&s->stkctr[http_trk_idx(rule->action)], STKCTR_TRACK_CONTENT);
stkctr_set_flags(&s->stkctr[trk_idx(rule->action)], STKCTR_TRACK_CONTENT);
if (sess->fe != s->be)
stkctr_set_flags(&s->stkctr[http_trk_idx(rule->action)], STKCTR_TRACK_BACKEND);
stkctr_set_flags(&s->stkctr[trk_idx(rule->action)], STKCTR_TRACK_BACKEND);
/* When the client triggers a 4xx from the server, it's most often due
* to a missing object or permission. These events should be tracked

View File

@ -184,7 +184,7 @@ resume_execution:
struct stktable_key *key;
struct sample smp;
if (stkctr_entry(&s->stkctr[tcp_trk_idx(rule->action)]))
if (stkctr_entry(&s->stkctr[trk_idx(rule->action)]))
continue;
t = rule->arg.trk_ctr.table.t;
@ -194,10 +194,10 @@ resume_execution:
goto missing_data; /* key might appear later */
if (key && (ts = stktable_get_entry(t, key))) {
stream_track_stkctr(&s->stkctr[tcp_trk_idx(rule->action)], t, ts);
stkctr_set_flags(&s->stkctr[tcp_trk_idx(rule->action)], STKCTR_TRACK_CONTENT);
stream_track_stkctr(&s->stkctr[trk_idx(rule->action)], t, ts);
stkctr_set_flags(&s->stkctr[trk_idx(rule->action)], STKCTR_TRACK_CONTENT);
if (sess->fe != s->be)
stkctr_set_flags(&s->stkctr[tcp_trk_idx(rule->action)], STKCTR_TRACK_BACKEND);
stkctr_set_flags(&s->stkctr[trk_idx(rule->action)], STKCTR_TRACK_BACKEND);
}
}
else if (rule->action == ACT_TCP_CAPTURE) {
@ -440,14 +440,14 @@ int tcp_exec_l4_rules(struct session *sess)
*/
struct stktable_key *key;
if (stkctr_entry(&sess->stkctr[tcp_trk_idx(rule->action)]))
if (stkctr_entry(&sess->stkctr[trk_idx(rule->action)]))
continue;
t = rule->arg.trk_ctr.table.t;
key = stktable_fetch_key(t, sess->fe, sess, NULL, SMP_OPT_DIR_REQ|SMP_OPT_FINAL, rule->arg.trk_ctr.expr, NULL);
if (key && (ts = stktable_get_entry(t, key)))
stream_track_stkctr(&sess->stkctr[tcp_trk_idx(rule->action)], t, ts);
stream_track_stkctr(&sess->stkctr[trk_idx(rule->action)], t, ts);
}
else if (rule->action == ACT_TCP_EXPECT_PX) {
conn->flags |= CO_FL_ACCEPT_PROXY;
@ -527,14 +527,14 @@ int tcp_exec_l5_rules(struct session *sess)
*/
struct stktable_key *key;
if (stkctr_entry(&sess->stkctr[tcp_trk_idx(rule->action)]))
if (stkctr_entry(&sess->stkctr[trk_idx(rule->action)]))
continue;
t = rule->arg.trk_ctr.table.t;
key = stktable_fetch_key(t, sess->fe, sess, NULL, SMP_OPT_DIR_REQ|SMP_OPT_FINAL, rule->arg.trk_ctr.expr, NULL);
if (key && (ts = stktable_get_entry(t, key)))
stream_track_stkctr(&sess->stkctr[tcp_trk_idx(rule->action)], t, ts);
stream_track_stkctr(&sess->stkctr[trk_idx(rule->action)], t, ts);
}
else {
/* Custom keywords. */