]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: proto_tcp: add session in the action prototype
authorThierry FOURNIER <tfournier@arpalert.org>
Mon, 10 Aug 2015 16:30:18 +0000 (18:30 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 11 Aug 2015 12:08:29 +0000 (14:08 +0200)
Some actions require the "struct session" while the "struct stream" is not
avalaible. This patch adds a pointer to the session.

include/types/proto_tcp.h
src/hlua.c
src/proto_tcp.c
src/vars.c

index 20b8a9f2c6122742702755223c0b849358a0d4d5..88f6999f6df568d43d7355247f152f0d352a100b 100644 (file)
@@ -53,7 +53,7 @@ struct tcp_rule {
        struct acl_cond *cond;
        int action;
        int (*action_ptr)(struct tcp_rule *rule, struct proxy *px,
-                         struct stream *s);
+                         struct session *sess, struct stream *s);
        union {
                struct track_ctr_prm trk_ctr;
                struct capture_prm cap;
index 3a325b75bdb6716bcf5969a0d14f244fb20205ff..83e3058cdfed85ad14560400f8058d6a9286b395 100644 (file)
@@ -4380,7 +4380,7 @@ static int hlua_request_act_wrapper(struct hlua_rule *rule, struct proxy *px,
  * "hlua_request_act_wrapper" for executing the LUA code.
  */
 int hlua_tcp_req_act_wrapper(struct tcp_rule *tcp_rule, struct proxy *px,
-                             struct stream *s)
+                             struct session *sess, struct stream *s)
 {
        return hlua_request_act_wrapper((struct hlua_rule *)tcp_rule->act_prm.data[0],
                                        px, s, AN_REQ_INSPECT_FE);
@@ -4390,7 +4390,7 @@ int hlua_tcp_req_act_wrapper(struct tcp_rule *tcp_rule, struct proxy *px,
  * "hlua_request_act_wrapper" for executing the LUA code.
  */
 int hlua_tcp_res_act_wrapper(struct tcp_rule *tcp_rule, struct proxy *px,
-                             struct stream *s)
+                             struct session *sess, struct stream *s)
 {
        return hlua_request_act_wrapper((struct hlua_rule *)tcp_rule->act_prm.data[0],
                                        px, s, AN_RES_INSPECT);
index e4998682e83b9be2899d2effa26ae2b6f653ebf6..00c308a8bd1a031c073e5b9b2a995c37a4dde30e 100644 (file)
@@ -1231,7 +1231,7 @@ resume_execution:
                        }
                        else {
                                /* Custom keywords. */
-                               if (rule->action_ptr && !rule->action_ptr(rule, s->be, s)) {
+                               if (rule->action_ptr && !rule->action_ptr(rule, s->be, s->sess, s)) {
                                        s->current_rule = rule;
                                        goto missing_data;
                                }
@@ -1356,7 +1356,7 @@ resume_execution:
                        }
                        else {
                                /* Custom keywords. */
-                               if (rule->action_ptr && !rule->action_ptr(rule, s->be, s)) {
+                               if (rule->action_ptr && !rule->action_ptr(rule, s->be, s->sess, s)) {
                                        channel_dont_close(rep);
                                        s->current_rule = rule;
                                        return 0;
@@ -1441,7 +1441,7 @@ int tcp_exec_req_rules(struct session *sess)
                        else {
                                /* Custom keywords. */
                                if (rule->action_ptr) {
-                                       rule->action_ptr(rule, sess->fe, NULL);
+                                       rule->action_ptr(rule, sess->fe, sess, NULL);
                                        if (rule->action == TCP_ACT_CUSTOM_CONT)
                                                continue;
                                }
index d233c8885aa69f945f97a42f83a2cc14f8bdd4e6..02d472acf27216694a2a5bdff9394ce6e4711c78 100644 (file)
@@ -502,7 +502,8 @@ static inline int action_store(struct sample_expr *expr, const char *name,
 }
 
 /* Returns 0 if miss data, else returns 1. */
-static int action_tcp_req_store(struct tcp_rule *rule, struct proxy *px, struct stream *s)
+static int action_tcp_req_store(struct tcp_rule *rule, struct proxy *px,
+                                struct session *sess, struct stream *s)
 {
        struct sample_expr *expr = rule->act_prm.data[0];
        const char *name = rule->act_prm.data[1];
@@ -512,7 +513,8 @@ static int action_tcp_req_store(struct tcp_rule *rule, struct proxy *px, struct
 }
 
 /* Returns 0 if miss data, else returns 1. */
-static int action_tcp_res_store(struct tcp_rule *rule, struct proxy *px, struct stream *s)
+static int action_tcp_res_store(struct tcp_rule *rule, struct proxy *px,
+                                struct session *sess, struct stream *s)
 {
        struct sample_expr *expr = rule->act_prm.data[0];
        const char *name = rule->act_prm.data[1];