]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: action: Use trk_idx instead of tcp/http_trk_idx
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 18 Sep 2017 09:57:31 +0000 (11:57 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 31 Oct 2017 10:36:12 +0000 (11:36 +0100)
So tcp_trk_idx and http_trk_idx have been removed.

include/proto/proto_http.h
include/proto/tcp_rules.h
src/cfgparse.c
src/proto_http.c
src/tcp_rules.c

index d046f536a1c8605a4718ec62758bd2f2bba63b9c..c4d16ae555d4e39c957c0ab555b7ba218f4375fc 100644 (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 */
 
 /*
index 3aa62ab043f8e2c8fd8023b20ceff7209da429aa..bf920a104c9fd5a54b3480b958dfc7e2161e8b25 100644 (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 */
 
 /*
index ed74960a3f45ebaa6c8f0477c6ee1a2291fb2344..77b9b08ab085ad9b4ac86a47469f2b320d049ae6 100644 (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 {
index e632ce5fe551e236b1bd64cf7444b5eef568f53f..23f683c60e6828662ae6329493e34202384f4a5b 100644 (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
index b87ab4b65b7cddb43a4699942dfba985ac044d81..d15b153a8d5e21d5a73ae2c6373d0b115b09feaa 100644 (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. */