mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-10 00:57:02 +02:00
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:
parent
7421b14c22
commit
4fce0d8447
@ -226,14 +226,6 @@ static inline int http_body_bytes(const struct http_msg *msg)
|
|||||||
return len;
|
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 */
|
#endif /* _PROTO_PROTO_HTTP_H */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -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_req_cont_keywords_register(struct action_kw_list *kw_list);
|
||||||
void tcp_res_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 */
|
#endif /* _PROTO_TCP_RULES_H */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -54,6 +54,7 @@
|
|||||||
#include <types/stats.h>
|
#include <types/stats.h>
|
||||||
|
|
||||||
#include <proto/acl.h>
|
#include <proto/acl.h>
|
||||||
|
#include <proto/action.h>
|
||||||
#include <proto/auth.h>
|
#include <proto/auth.h>
|
||||||
#include <proto/backend.h>
|
#include <proto/backend.h>
|
||||||
#include <proto/channel.h>
|
#include <proto/channel.h>
|
||||||
@ -7879,7 +7880,7 @@ int check_config_validity()
|
|||||||
if (!target) {
|
if (!target) {
|
||||||
Alert("Proxy '%s': unable to find table '%s' referenced by track-sc%d.\n",
|
Alert("Proxy '%s': unable to find table '%s' referenced by track-sc%d.\n",
|
||||||
curproxy->id, trule->arg.trk_ctr.table.n,
|
curproxy->id, trule->arg.trk_ctr.table.n,
|
||||||
tcp_trk_idx(trule->action));
|
trk_idx(trule->action));
|
||||||
cfgerr++;
|
cfgerr++;
|
||||||
}
|
}
|
||||||
else if (target->table.size == 0) {
|
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)) {
|
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",
|
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,
|
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++;
|
cfgerr++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -7918,7 +7919,7 @@ int check_config_validity()
|
|||||||
if (!target) {
|
if (!target) {
|
||||||
Alert("Proxy '%s': unable to find table '%s' referenced by track-sc%d.\n",
|
Alert("Proxy '%s': unable to find table '%s' referenced by track-sc%d.\n",
|
||||||
curproxy->id, trule->arg.trk_ctr.table.n,
|
curproxy->id, trule->arg.trk_ctr.table.n,
|
||||||
tcp_trk_idx(trule->action));
|
trk_idx(trule->action));
|
||||||
cfgerr++;
|
cfgerr++;
|
||||||
}
|
}
|
||||||
else if (target->table.size == 0) {
|
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)) {
|
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",
|
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,
|
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++;
|
cfgerr++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -7957,7 +7958,7 @@ int check_config_validity()
|
|||||||
if (!target) {
|
if (!target) {
|
||||||
Alert("Proxy '%s': unable to find table '%s' referenced by track-sc%d.\n",
|
Alert("Proxy '%s': unable to find table '%s' referenced by track-sc%d.\n",
|
||||||
curproxy->id, trule->arg.trk_ctr.table.n,
|
curproxy->id, trule->arg.trk_ctr.table.n,
|
||||||
tcp_trk_idx(trule->action));
|
trk_idx(trule->action));
|
||||||
cfgerr++;
|
cfgerr++;
|
||||||
}
|
}
|
||||||
else if (target->table.size == 0) {
|
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)) {
|
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",
|
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,
|
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++;
|
cfgerr++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -8022,7 +8023,7 @@ int check_config_validity()
|
|||||||
if (!target) {
|
if (!target) {
|
||||||
Alert("Proxy '%s': unable to find table '%s' referenced by track-sc%d.\n",
|
Alert("Proxy '%s': unable to find table '%s' referenced by track-sc%d.\n",
|
||||||
curproxy->id, hrqrule->arg.trk_ctr.table.n,
|
curproxy->id, hrqrule->arg.trk_ctr.table.n,
|
||||||
http_trk_idx(hrqrule->action));
|
trk_idx(hrqrule->action));
|
||||||
cfgerr++;
|
cfgerr++;
|
||||||
}
|
}
|
||||||
else if (target->table.size == 0) {
|
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)) {
|
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",
|
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,
|
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++;
|
cfgerr++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -8061,7 +8062,7 @@ int check_config_validity()
|
|||||||
if (!target) {
|
if (!target) {
|
||||||
Alert("Proxy '%s': unable to find table '%s' referenced by track-sc%d.\n",
|
Alert("Proxy '%s': unable to find table '%s' referenced by track-sc%d.\n",
|
||||||
curproxy->id, hrqrule->arg.trk_ctr.table.n,
|
curproxy->id, hrqrule->arg.trk_ctr.table.n,
|
||||||
http_trk_idx(hrqrule->action));
|
trk_idx(hrqrule->action));
|
||||||
cfgerr++;
|
cfgerr++;
|
||||||
}
|
}
|
||||||
else if (target->table.size == 0) {
|
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)) {
|
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",
|
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,
|
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++;
|
cfgerr++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -2717,7 +2717,7 @@ http_req_get_intercept_rule(struct proxy *px, struct list *rules, struct stream
|
|||||||
* applies.
|
* 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 stktable *t;
|
||||||
struct stksess *ts;
|
struct stksess *ts;
|
||||||
struct stktable_key *key;
|
struct stktable_key *key;
|
||||||
@ -2727,7 +2727,7 @@ http_req_get_intercept_rule(struct proxy *px, struct list *rules, struct stream
|
|||||||
key = stktable_fetch_key(t, s->be, sess, s, SMP_OPT_DIR_REQ | SMP_OPT_FINAL, rule->arg.trk_ctr.expr, NULL);
|
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))) {
|
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 */
|
/* 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);
|
ptr = stktable_data_ptr(t, ts, STKTABLE_DT_HTTP_REQ_CNT);
|
||||||
@ -2739,9 +2739,9 @@ http_req_get_intercept_rule(struct proxy *px, struct list *rules, struct stream
|
|||||||
update_freq_ctr_period(&stktable_data_cast(ptr, http_req_rate),
|
update_freq_ctr_period(&stktable_data_cast(ptr, http_req_rate),
|
||||||
t->data_arg[STKTABLE_DT_HTTP_REQ_RATE].u, 1);
|
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)
|
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;
|
break;
|
||||||
@ -2990,7 +2990,7 @@ http_res_get_intercept_rule(struct proxy *px, struct list *rules, struct stream
|
|||||||
* applies.
|
* 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 stktable *t;
|
||||||
struct stksess *ts;
|
struct stksess *ts;
|
||||||
struct stktable_key *key;
|
struct stktable_key *key;
|
||||||
@ -3000,7 +3000,7 @@ http_res_get_intercept_rule(struct proxy *px, struct list *rules, struct stream
|
|||||||
key = stktable_fetch_key(t, s->be, sess, s, SMP_OPT_DIR_RES | SMP_OPT_FINAL, rule->arg.trk_ctr.expr, NULL);
|
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))) {
|
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 */
|
/* 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);
|
ptr = stktable_data_ptr(t, ts, STKTABLE_DT_HTTP_REQ_CNT);
|
||||||
@ -3012,9 +3012,9 @@ http_res_get_intercept_rule(struct proxy *px, struct list *rules, struct stream
|
|||||||
update_freq_ctr_period(&stktable_data_cast(ptr, http_req_rate),
|
update_freq_ctr_period(&stktable_data_cast(ptr, http_req_rate),
|
||||||
t->data_arg[STKTABLE_DT_HTTP_REQ_RATE].u, 1);
|
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)
|
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
|
/* 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
|
* to a missing object or permission. These events should be tracked
|
||||||
|
@ -184,7 +184,7 @@ int tcp_inspect_request(struct stream *s, struct channel *req, int an_bit)
|
|||||||
struct stktable_key *key;
|
struct stktable_key *key;
|
||||||
struct sample smp;
|
struct sample smp;
|
||||||
|
|
||||||
if (stkctr_entry(&s->stkctr[tcp_trk_idx(rule->action)]))
|
if (stkctr_entry(&s->stkctr[trk_idx(rule->action)]))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
t = rule->arg.trk_ctr.table.t;
|
t = rule->arg.trk_ctr.table.t;
|
||||||
@ -194,10 +194,10 @@ int tcp_inspect_request(struct stream *s, struct channel *req, int an_bit)
|
|||||||
goto missing_data; /* key might appear later */
|
goto missing_data; /* key might appear later */
|
||||||
|
|
||||||
if (key && (ts = stktable_get_entry(t, key))) {
|
if (key && (ts = stktable_get_entry(t, key))) {
|
||||||
stream_track_stkctr(&s->stkctr[tcp_trk_idx(rule->action)], t, ts);
|
stream_track_stkctr(&s->stkctr[trk_idx(rule->action)], t, ts);
|
||||||
stkctr_set_flags(&s->stkctr[tcp_trk_idx(rule->action)], STKCTR_TRACK_CONTENT);
|
stkctr_set_flags(&s->stkctr[trk_idx(rule->action)], STKCTR_TRACK_CONTENT);
|
||||||
if (sess->fe != s->be)
|
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) {
|
else if (rule->action == ACT_TCP_CAPTURE) {
|
||||||
@ -440,14 +440,14 @@ int tcp_exec_l4_rules(struct session *sess)
|
|||||||
*/
|
*/
|
||||||
struct stktable_key *key;
|
struct stktable_key *key;
|
||||||
|
|
||||||
if (stkctr_entry(&sess->stkctr[tcp_trk_idx(rule->action)]))
|
if (stkctr_entry(&sess->stkctr[trk_idx(rule->action)]))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
t = rule->arg.trk_ctr.table.t;
|
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);
|
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)))
|
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) {
|
else if (rule->action == ACT_TCP_EXPECT_PX) {
|
||||||
conn->flags |= CO_FL_ACCEPT_PROXY;
|
conn->flags |= CO_FL_ACCEPT_PROXY;
|
||||||
@ -527,14 +527,14 @@ int tcp_exec_l5_rules(struct session *sess)
|
|||||||
*/
|
*/
|
||||||
struct stktable_key *key;
|
struct stktable_key *key;
|
||||||
|
|
||||||
if (stkctr_entry(&sess->stkctr[tcp_trk_idx(rule->action)]))
|
if (stkctr_entry(&sess->stkctr[trk_idx(rule->action)]))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
t = rule->arg.trk_ctr.table.t;
|
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);
|
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)))
|
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 {
|
else {
|
||||||
/* Custom keywords. */
|
/* Custom keywords. */
|
||||||
|
Loading…
Reference in New Issue
Block a user