]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: capture: Move the capture configuration storage in the union
authorThierry FOURNIER <tfournier@arpalert.org>
Tue, 4 Aug 2015 06:21:12 +0000 (08:21 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 20 Aug 2015 15:13:47 +0000 (17:13 +0200)
This patch moves the capture configuration struct (capture_prm) in the main
"arg" union. This reduce the size of the struct.

include/types/action.h
src/cfgparse.c
src/proto_tcp.c

index 570710b1be38e9f17147878da95e657d8882c7b1..84454e41e3feb3a62f76f9672426950d15407938 100644 (file)
 
 #include <types/stick_table.h>
 
-struct capture_prm {
-       struct sample_expr *expr;               /* expression used as the key */
-       struct cap_hdr *hdr;                    /* the capture storage */
-};
-
 struct act_rule {
        struct list list;
        struct acl_cond *cond;                 /* acl condition to meet */
@@ -62,8 +57,8 @@ struct act_rule {
                        int action;
                } http;
                struct {
-                       struct sample_expr *expr;
-                       struct cap_hdr *hdr;
+                       struct sample_expr *expr; /* expression used as the key */
+                       struct cap_hdr *hdr;      /* the capture storage */
                } cap;
                struct {
                        struct sample_expr *expr;
@@ -80,10 +75,6 @@ struct act_rule {
                        void *p[4];
                } act;                         /* generic pointers to be used by custom actions */
        } arg;                                 /* arguments used by some actions */
-
-       union {
-               struct capture_prm cap;
-       } act_prm;
 };
 
 #endif /* _TYPES_ACTION_H */
index 8e7830ef12654ac8fed22e540b0eea51c0a44859..cacbccb28f4a4143287cb73594eef45e5a58012b 100644 (file)
@@ -8226,7 +8226,7 @@ out_uri_auth_compat:
                if ((curproxy->cap & PR_CAP_FE) && !curproxy->tcp_req.inspect_delay) {
                        list_for_each_entry(trule, &curproxy->tcp_req.inspect_rules, list) {
                                if (trule->action == TCP_ACT_CAPTURE &&
-                                   !(trule->act_prm.cap.expr->fetch->val & SMP_VAL_FE_SES_ACC))
+                                   !(trule->arg.cap.expr->fetch->val & SMP_VAL_FE_SES_ACC))
                                        break;
                                if  ((trule->action >= TCP_ACT_TRK_SC0 && trule->action <= TCP_ACT_TRK_SCMAX) &&
                                     !(trule->arg.trk_ctr.expr->fetch->val & SMP_VAL_FE_SES_ACC))
index e95ca8cd5b14ae37a3d6b01d9a3365eedbcd1d49..42f5619978875c2315359249e5e41befdb7196a2 100644 (file)
@@ -1205,11 +1205,11 @@ resume_execution:
                        }
                        else if (rule->action == TCP_ACT_CAPTURE) {
                                struct sample *key;
-                               struct cap_hdr *h = rule->act_prm.cap.hdr;
+                               struct cap_hdr *h = rule->arg.cap.hdr;
                                char **cap = s->req_cap;
                                int len;
 
-                               key = sample_fetch_as_type(s->be, sess, s, SMP_OPT_DIR_REQ | partial, rule->act_prm.cap.expr, SMP_T_STR);
+                               key = sample_fetch_as_type(s->be, sess, s, SMP_OPT_DIR_REQ | partial, rule->arg.cap.expr, SMP_T_STR);
                                if (!key)
                                        continue;
 
@@ -1615,8 +1615,8 @@ static int tcp_parse_request_rule(char **args, int arg, int section_type,
                /* check if we need to allocate an hdr_idx struct for HTTP parsing */
                curpx->http_needed |= !!(expr->fetch->use & SMP_USE_HTTP_ANY);
 
-               rule->act_prm.cap.expr = expr;
-               rule->act_prm.cap.hdr = hdr;
+               rule->arg.cap.expr = expr;
+               rule->arg.cap.hdr = hdr;
                rule->action = TCP_ACT_CAPTURE;
        }
        else if (strncmp(args[arg], "track-sc", 8) == 0 &&