diff --git a/include/proto/checks.h b/include/proto/checks.h index d9491753d..a0a8329b1 100644 --- a/include/proto/checks.h +++ b/include/proto/checks.h @@ -56,6 +56,12 @@ int init_email_alert(struct mailers *mailers, struct proxy *p, char **err); void send_email_alert(struct server *s, int priority, const char *format, ...) __attribute__ ((format(printf, 3, 4))); +extern struct action_kw_list tcp_check_keywords; +static inline void tcp_check_keywords_register(struct action_kw_list *kw_list) +{ + LIST_ADDQ(&tcp_check_keywords.list, &kw_list->list); +} + /* Declared here, but the definitions are in flt_spoe.c */ int spoe_prepare_healthcheck_request(char **req, int *len); int spoe_handle_healthcheck_response(char *frame, size_t size, char *err, int errlen); diff --git a/include/types/action.h b/include/types/action.h index 329877015..1a5a59405 100644 --- a/include/types/action.h +++ b/include/types/action.h @@ -34,6 +34,7 @@ enum act_from { ACT_F_TCP_RES_CNT, /* tcp-response content */ ACT_F_HTTP_REQ, /* http-request */ ACT_F_HTTP_RES, /* http-response */ + ACT_F_TCP_CHK, /* tcp-check. */ }; enum act_return { diff --git a/include/types/checks.h b/include/types/checks.h index b980faae0..d848e6c99 100644 --- a/include/types/checks.h +++ b/include/types/checks.h @@ -256,12 +256,17 @@ struct tcpcheck_expect { int min_recv; /* Minimum amount of data before an expect can be applied. (default: -1, ignored) */ }; +struct tcpcheck_action_kw { + struct act_rule *rule; +}; + /* possible actions for tcpcheck_rule->action */ enum tcpcheck_rule_type { TCPCHK_ACT_SEND = 0, /* send action, regular string format */ TCPCHK_ACT_EXPECT, /* expect action, either regular or binary string */ TCPCHK_ACT_CONNECT, /* connect action, to probe a new port */ TCPCHK_ACT_COMMENT, /* no action, simply a comment used for logs */ + TCPCHK_ACT_ACTION_KW, /* custom registered action_kw rule. */ }; struct tcpcheck_rule { @@ -273,6 +278,7 @@ struct tcpcheck_rule { struct tcpcheck_connect connect; /* Connect rule. */ struct tcpcheck_send send; /* Send rule. */ struct tcpcheck_expect expect; /* Expected pattern. */ + struct tcpcheck_action_kw action_kw; /* Custom action. */ }; }; diff --git a/include/types/sample.h b/include/types/sample.h index e5c2c29f5..2292b3694 100644 --- a/include/types/sample.h +++ b/include/types/sample.h @@ -99,6 +99,7 @@ enum { SMP_CKP_FE_HRS_HDR, /* FE HTTP response headers (rules, headers) */ SMP_CKP_FE_HRS_BDY, /* FE HTTP response body */ SMP_CKP_FE_LOG_END, /* FE log at the end of the txn/stream */ + SMP_CKP_BE_CHK_RUL, /* BE tcp-check rules */ SMP_CKP_ENTRIES /* nothing after this */ }; @@ -164,16 +165,18 @@ enum { SMP_VAL_FE_HRS_HDR = 1 << SMP_CKP_FE_HRS_HDR, /* FE HTTP response headers (rules, headers) */ SMP_VAL_FE_HRS_BDY = 1 << SMP_CKP_FE_HRS_BDY, /* FE HTTP response body */ SMP_VAL_FE_LOG_END = 1 << SMP_CKP_FE_LOG_END, /* FE log at the end of the txn/stream */ + SMP_VAL_BE_CHK_RUL = 1 << SMP_CKP_BE_CHK_RUL, /* BE tcp-check rule */ /* a few combinations to decide what direction to try to fetch (useful for logs) */ SMP_VAL_REQUEST = SMP_VAL_FE_CON_ACC | SMP_VAL_FE_SES_ACC | SMP_VAL_FE_REQ_CNT | SMP_VAL_FE_HRQ_HDR | SMP_VAL_FE_HRQ_BDY | SMP_VAL_FE_SET_BCK | SMP_VAL_BE_REQ_CNT | SMP_VAL_BE_HRQ_HDR | SMP_VAL_BE_HRQ_BDY | - SMP_VAL_BE_SET_SRV, + SMP_VAL_BE_SET_SRV | SMP_VAL_BE_CHK_RUL, SMP_VAL_RESPONSE = SMP_VAL_BE_SRV_CON | SMP_VAL_BE_RES_CNT | SMP_VAL_BE_HRS_HDR | SMP_VAL_BE_HRS_BDY | SMP_VAL_BE_STO_RUL | SMP_VAL_FE_RES_CNT | - SMP_VAL_FE_HRS_HDR | SMP_VAL_FE_HRS_BDY | SMP_VAL_FE_LOG_END, + SMP_VAL_FE_HRS_HDR | SMP_VAL_FE_HRS_BDY | SMP_VAL_FE_LOG_END | + SMP_VAL_BE_CHK_RUL, }; extern const unsigned int fetch_cap[SMP_SRC_ENTRIES]; diff --git a/src/checks.c b/src/checks.c index 9423e2d7d..5e147b81f 100644 --- a/src/checks.c +++ b/src/checks.c @@ -43,6 +43,7 @@ #include #include +#include #include #include #include @@ -1559,7 +1560,7 @@ static struct tcpcheck_rule *get_first_tcpcheck_rule(struct list *list) struct tcpcheck_rule *r; list_for_each_entry(r, list, list) { - if (r->action != TCPCHK_ACT_COMMENT) + if (r->action != TCPCHK_ACT_COMMENT && r->action != TCPCHK_ACT_ACTION_KW) return r; } return NULL; @@ -1578,7 +1579,7 @@ static struct tcpcheck_rule *get_next_tcpcheck_rule(struct list *list, struct tc r = LIST_NEXT(&start->list, typeof(r), list); list_for_each_entry_from(r, list, list) { - if (r->action != TCPCHK_ACT_COMMENT) + if (r->action != TCPCHK_ACT_COMMENT && r->action != TCPCHK_ACT_ACTION_KW) return r; } return NULL; @@ -3421,6 +3422,9 @@ static void free_tcpcheck(struct tcpcheck_rule *rule, int in_pool) case TCPCHK_ACT_CONNECT: case TCPCHK_ACT_COMMENT: break; + case TCPCHK_ACT_ACTION_KW: + free(rule->action_kw.rule); + break; } if (in_pool) @@ -3983,6 +3987,56 @@ REGISTER_PROXY_DEINIT(deinit_proxy_tcpcheck); REGISTER_SERVER_DEINIT(deinit_srv_check); REGISTER_SERVER_DEINIT(deinit_srv_agent_check); +struct action_kw_list tcp_check_keywords = { + .list = LIST_HEAD_INIT(tcp_check_keywords.list), +}; + +/* Return the struct action_kw associated to a keyword */ +static struct action_kw *action_kw_tcp_check_lookup(const char *kw) +{ + return action_lookup(&tcp_check_keywords.list, kw); +} + +static void action_kw_tcp_check_build_list(struct buffer *chk) +{ + action_build_list(&tcp_check_keywords.list, chk); +} + +/* Create a tcp-check rule resulting from parsing a custom keyword. */ +static struct tcpcheck_rule *parse_tcpcheck_action(char **args, int cur_arg, struct proxy *px, + struct list *rules, struct action_kw *kw, char **errmsg) +{ + struct tcpcheck_rule *chk = NULL; + struct act_rule *actrule = NULL; + + actrule = calloc(1, sizeof(*actrule)); + if (!actrule) { + memprintf(errmsg, "out of memory"); + goto error; + } + actrule->kw = kw; + actrule->from = ACT_F_TCP_CHK; + + cur_arg++; + if (kw->parse((const char **)args, &cur_arg, px, actrule, errmsg) == ACT_RET_PRS_ERR) { + memprintf(errmsg, "'%s' : %s", kw->kw, *errmsg); + goto error; + } + + chk = calloc(1, sizeof(*chk)); + if (!chk) { + memprintf(errmsg, "out of memory"); + goto error; + } + chk->action = TCPCHK_ACT_ACTION_KW; + chk->action_kw.rule = actrule; + return chk; + + error: + free(actrule); + return NULL; +} + static struct tcpcheck_rule *parse_tcpcheck_connect(char **args, int cur_arg, struct proxy *px, struct list *rules, char **errmsg) { @@ -3992,11 +4046,13 @@ static struct tcpcheck_rule *parse_tcpcheck_connect(char **args, int cur_arg, st long port = 0; list_for_each_entry(chk, rules, list) { - if (chk->action != TCPCHK_ACT_COMMENT) + if (chk->action != TCPCHK_ACT_COMMENT && chk->action != TCPCHK_ACT_ACTION_KW) break; } if (&chk->list != rules && chk->action != TCPCHK_ACT_CONNECT) { - memprintf(errmsg, "first step MUST also be a 'connect' when there is a 'connect' step in the tcp-check ruleset"); + memprintf(errmsg, "first step MUST also be a 'connect', " + "optionnaly preceded by a 'set-var', an 'unset-var' or a 'comment', " + "when there is a 'connect' step in the tcp-check ruleset"); goto error; } @@ -4367,9 +4423,16 @@ static int proxy_parse_tcpcheck(char **args, int section, struct proxy *curpx, else if (strcmp(args[cur_arg], "comment") == 0) chk = parse_tcpcheck_comment(args, cur_arg, rules, errmsg); else { - memprintf(errmsg, "'%s %s' only supports 'comment', 'connect', 'send', 'send-binary' or 'expect'.", - args[0], args[1]); - goto error; + struct action_kw *kw = action_kw_tcp_check_lookup(args[cur_arg]); + + if (!kw) { + action_kw_tcp_check_build_list(&trash); + memprintf(errmsg, "'%s' only supports 'comment', 'connect', 'send', 'send-binary', 'expect'" + "%s%s. but got '%s'", + args[0], (*trash.area ? ", " : ""), trash.area, args[1]); + goto error; + } + chk = parse_tcpcheck_action(args, cur_arg, curpx, rules, kw, errmsg); } if (!chk) { diff --git a/src/sample.c b/src/sample.c index d602887b8..6cf805aed 100644 --- a/src/sample.c +++ b/src/sample.c @@ -73,7 +73,7 @@ const unsigned int fetch_cap[SMP_SRC_ENTRIES] = { SMP_VAL_BE_SET_SRV | SMP_VAL_BE_SRV_CON | SMP_VAL_BE_RES_CNT | SMP_VAL_BE_HRS_HDR | SMP_VAL_BE_HRS_BDY | SMP_VAL_BE_STO_RUL | SMP_VAL_FE_RES_CNT | SMP_VAL_FE_HRS_HDR | SMP_VAL_FE_HRS_BDY | - SMP_VAL_FE_LOG_END), + SMP_VAL_FE_LOG_END | SMP_VAL_BE_CHK_RUL), [SMP_SRC_LISTN] = (SMP_VAL_FE_CON_ACC | SMP_VAL_FE_SES_ACC | SMP_VAL_FE_REQ_CNT | SMP_VAL_FE_HRQ_HDR | SMP_VAL_FE_HRQ_BDY | SMP_VAL_FE_SET_BCK | @@ -81,7 +81,7 @@ const unsigned int fetch_cap[SMP_SRC_ENTRIES] = { SMP_VAL_BE_SET_SRV | SMP_VAL_BE_SRV_CON | SMP_VAL_BE_RES_CNT | SMP_VAL_BE_HRS_HDR | SMP_VAL_BE_HRS_BDY | SMP_VAL_BE_STO_RUL | SMP_VAL_FE_RES_CNT | SMP_VAL_FE_HRS_HDR | SMP_VAL_FE_HRS_BDY | - SMP_VAL_FE_LOG_END), + SMP_VAL_FE_LOG_END | SMP_VAL___________), [SMP_SRC_FTEND] = (SMP_VAL_FE_CON_ACC | SMP_VAL_FE_SES_ACC | SMP_VAL_FE_REQ_CNT | SMP_VAL_FE_HRQ_HDR | SMP_VAL_FE_HRQ_BDY | SMP_VAL_FE_SET_BCK | @@ -89,7 +89,7 @@ const unsigned int fetch_cap[SMP_SRC_ENTRIES] = { SMP_VAL_BE_SET_SRV | SMP_VAL_BE_SRV_CON | SMP_VAL_BE_RES_CNT | SMP_VAL_BE_HRS_HDR | SMP_VAL_BE_HRS_BDY | SMP_VAL_BE_STO_RUL | SMP_VAL_FE_RES_CNT | SMP_VAL_FE_HRS_HDR | SMP_VAL_FE_HRS_BDY | - SMP_VAL_FE_LOG_END), + SMP_VAL_FE_LOG_END | SMP_VAL___________), [SMP_SRC_L4CLI] = (SMP_VAL_FE_CON_ACC | SMP_VAL_FE_SES_ACC | SMP_VAL_FE_REQ_CNT | SMP_VAL_FE_HRQ_HDR | SMP_VAL_FE_HRQ_BDY | SMP_VAL_FE_SET_BCK | @@ -97,7 +97,7 @@ const unsigned int fetch_cap[SMP_SRC_ENTRIES] = { SMP_VAL_BE_SET_SRV | SMP_VAL_BE_SRV_CON | SMP_VAL_BE_RES_CNT | SMP_VAL_BE_HRS_HDR | SMP_VAL_BE_HRS_BDY | SMP_VAL_BE_STO_RUL | SMP_VAL_FE_RES_CNT | SMP_VAL_FE_HRS_HDR | SMP_VAL_FE_HRS_BDY | - SMP_VAL_FE_LOG_END), + SMP_VAL_FE_LOG_END | SMP_VAL_BE_CHK_RUL), [SMP_SRC_L5CLI] = (SMP_VAL___________ | SMP_VAL_FE_SES_ACC | SMP_VAL_FE_REQ_CNT | SMP_VAL_FE_HRQ_HDR | SMP_VAL_FE_HRQ_BDY | SMP_VAL_FE_SET_BCK | @@ -105,7 +105,7 @@ const unsigned int fetch_cap[SMP_SRC_ENTRIES] = { SMP_VAL_BE_SET_SRV | SMP_VAL_BE_SRV_CON | SMP_VAL_BE_RES_CNT | SMP_VAL_BE_HRS_HDR | SMP_VAL_BE_HRS_BDY | SMP_VAL_BE_STO_RUL | SMP_VAL_FE_RES_CNT | SMP_VAL_FE_HRS_HDR | SMP_VAL_FE_HRS_BDY | - SMP_VAL_FE_LOG_END), + SMP_VAL_FE_LOG_END | SMP_VAL___________), [SMP_SRC_TRACK] = (SMP_VAL_FE_CON_ACC | SMP_VAL_FE_SES_ACC | SMP_VAL_FE_REQ_CNT | SMP_VAL_FE_HRQ_HDR | SMP_VAL_FE_HRQ_BDY | SMP_VAL_FE_SET_BCK | @@ -113,7 +113,7 @@ const unsigned int fetch_cap[SMP_SRC_ENTRIES] = { SMP_VAL_BE_SET_SRV | SMP_VAL_BE_SRV_CON | SMP_VAL_BE_RES_CNT | SMP_VAL_BE_HRS_HDR | SMP_VAL_BE_HRS_BDY | SMP_VAL_BE_STO_RUL | SMP_VAL_FE_RES_CNT | SMP_VAL_FE_HRS_HDR | SMP_VAL_FE_HRS_BDY | - SMP_VAL_FE_LOG_END), + SMP_VAL_FE_LOG_END | SMP_VAL___________), [SMP_SRC_L6REQ] = (SMP_VAL___________ | SMP_VAL___________ | SMP_VAL_FE_REQ_CNT | SMP_VAL_FE_HRQ_HDR | SMP_VAL_FE_HRQ_BDY | SMP_VAL_FE_SET_BCK | @@ -121,7 +121,7 @@ const unsigned int fetch_cap[SMP_SRC_ENTRIES] = { SMP_VAL_BE_SET_SRV | SMP_VAL_BE_SRV_CON | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | - SMP_VAL___________), + SMP_VAL___________ | SMP_VAL___________), [SMP_SRC_HRQHV] = (SMP_VAL___________ | SMP_VAL___________ | SMP_VAL_FE_REQ_CNT | SMP_VAL_FE_HRQ_HDR | SMP_VAL_FE_HRQ_BDY | SMP_VAL_FE_SET_BCK | @@ -129,7 +129,7 @@ const unsigned int fetch_cap[SMP_SRC_ENTRIES] = { SMP_VAL_BE_SET_SRV | SMP_VAL_BE_SRV_CON | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | - SMP_VAL___________), + SMP_VAL___________ | SMP_VAL___________), [SMP_SRC_HRQHP] = (SMP_VAL___________ | SMP_VAL___________ | SMP_VAL_FE_REQ_CNT | SMP_VAL_FE_HRQ_HDR | SMP_VAL_FE_HRQ_BDY | SMP_VAL_FE_SET_BCK | @@ -137,7 +137,7 @@ const unsigned int fetch_cap[SMP_SRC_ENTRIES] = { SMP_VAL_BE_SET_SRV | SMP_VAL_BE_SRV_CON | SMP_VAL_BE_RES_CNT | SMP_VAL_BE_HRS_HDR | SMP_VAL_BE_HRS_BDY | SMP_VAL_BE_STO_RUL | SMP_VAL_FE_RES_CNT | SMP_VAL_FE_HRS_HDR | SMP_VAL_FE_HRS_BDY | - SMP_VAL_FE_LOG_END), + SMP_VAL_FE_LOG_END | SMP_VAL___________), [SMP_SRC_HRQBO] = (SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL_FE_HRQ_BDY | SMP_VAL_FE_SET_BCK | @@ -145,7 +145,7 @@ const unsigned int fetch_cap[SMP_SRC_ENTRIES] = { SMP_VAL_BE_SET_SRV | SMP_VAL_BE_SRV_CON | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | - SMP_VAL___________), + SMP_VAL___________ | SMP_VAL___________), [SMP_SRC_BKEND] = (SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | @@ -153,7 +153,7 @@ const unsigned int fetch_cap[SMP_SRC_ENTRIES] = { SMP_VAL_BE_SET_SRV | SMP_VAL_BE_SRV_CON | SMP_VAL_BE_RES_CNT | SMP_VAL_BE_HRS_HDR | SMP_VAL_BE_HRS_BDY | SMP_VAL_BE_STO_RUL | SMP_VAL_FE_RES_CNT | SMP_VAL_FE_HRS_HDR | SMP_VAL_FE_HRS_BDY | - SMP_VAL_FE_LOG_END), + SMP_VAL_FE_LOG_END | SMP_VAL_BE_CHK_RUL), [SMP_SRC_SERVR] = (SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | @@ -161,7 +161,7 @@ const unsigned int fetch_cap[SMP_SRC_ENTRIES] = { SMP_VAL___________ | SMP_VAL_BE_SRV_CON | SMP_VAL_BE_RES_CNT | SMP_VAL_BE_HRS_HDR | SMP_VAL_BE_HRS_BDY | SMP_VAL_BE_STO_RUL | SMP_VAL_FE_RES_CNT | SMP_VAL_FE_HRS_HDR | SMP_VAL_FE_HRS_BDY | - SMP_VAL_FE_LOG_END), + SMP_VAL_FE_LOG_END | SMP_VAL_BE_CHK_RUL), [SMP_SRC_L4SRV] = (SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | @@ -169,7 +169,7 @@ const unsigned int fetch_cap[SMP_SRC_ENTRIES] = { SMP_VAL___________ | SMP_VAL___________ | SMP_VAL_BE_RES_CNT | SMP_VAL_BE_HRS_HDR | SMP_VAL_BE_HRS_BDY | SMP_VAL_BE_STO_RUL | SMP_VAL_FE_RES_CNT | SMP_VAL_FE_HRS_HDR | SMP_VAL_FE_HRS_BDY | - SMP_VAL_FE_LOG_END), + SMP_VAL_FE_LOG_END | SMP_VAL_BE_CHK_RUL), [SMP_SRC_L5SRV] = (SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | @@ -177,7 +177,7 @@ const unsigned int fetch_cap[SMP_SRC_ENTRIES] = { SMP_VAL___________ | SMP_VAL___________ | SMP_VAL_BE_RES_CNT | SMP_VAL_BE_HRS_HDR | SMP_VAL_BE_HRS_BDY | SMP_VAL_BE_STO_RUL | SMP_VAL_FE_RES_CNT | SMP_VAL_FE_HRS_HDR | SMP_VAL_FE_HRS_BDY | - SMP_VAL_FE_LOG_END), + SMP_VAL_FE_LOG_END | SMP_VAL_BE_CHK_RUL), [SMP_SRC_L6RES] = (SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | @@ -185,7 +185,7 @@ const unsigned int fetch_cap[SMP_SRC_ENTRIES] = { SMP_VAL___________ | SMP_VAL___________ | SMP_VAL_BE_RES_CNT | SMP_VAL_BE_HRS_HDR | SMP_VAL_BE_HRS_BDY | SMP_VAL_BE_STO_RUL | SMP_VAL_FE_RES_CNT | SMP_VAL_FE_HRS_HDR | SMP_VAL_FE_HRS_BDY | - SMP_VAL___________), + SMP_VAL___________ | SMP_VAL___________), [SMP_SRC_HRSHV] = (SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | @@ -193,7 +193,7 @@ const unsigned int fetch_cap[SMP_SRC_ENTRIES] = { SMP_VAL___________ | SMP_VAL___________ | SMP_VAL_BE_RES_CNT | SMP_VAL_BE_HRS_HDR | SMP_VAL_BE_HRS_BDY | SMP_VAL_BE_STO_RUL | SMP_VAL_FE_RES_CNT | SMP_VAL_FE_HRS_HDR | SMP_VAL_FE_HRS_BDY | - SMP_VAL___________), + SMP_VAL___________ | SMP_VAL___________), [SMP_SRC_HRSHP] = (SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | @@ -201,7 +201,7 @@ const unsigned int fetch_cap[SMP_SRC_ENTRIES] = { SMP_VAL___________ | SMP_VAL___________ | SMP_VAL_BE_RES_CNT | SMP_VAL_BE_HRS_HDR | SMP_VAL_BE_HRS_BDY | SMP_VAL_BE_STO_RUL | SMP_VAL_FE_RES_CNT | SMP_VAL_FE_HRS_HDR | SMP_VAL_FE_HRS_BDY | - SMP_VAL_FE_LOG_END), + SMP_VAL_FE_LOG_END | SMP_VAL___________), [SMP_SRC_HRSBO] = (SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | @@ -209,7 +209,7 @@ const unsigned int fetch_cap[SMP_SRC_ENTRIES] = { SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL_BE_HRS_BDY | SMP_VAL_BE_STO_RUL | SMP_VAL_FE_RES_CNT | SMP_VAL_FE_HRS_HDR | SMP_VAL_FE_HRS_BDY | - SMP_VAL___________), + SMP_VAL___________ | SMP_VAL___________), [SMP_SRC_RQFIN] = (SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | @@ -217,7 +217,7 @@ const unsigned int fetch_cap[SMP_SRC_ENTRIES] = { SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | - SMP_VAL_FE_LOG_END), + SMP_VAL_FE_LOG_END | SMP_VAL___________), [SMP_SRC_RSFIN] = (SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | @@ -225,7 +225,7 @@ const unsigned int fetch_cap[SMP_SRC_ENTRIES] = { SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | - SMP_VAL_FE_LOG_END), + SMP_VAL_FE_LOG_END | SMP_VAL___________), [SMP_SRC_TXFIN] = (SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | @@ -233,7 +233,7 @@ const unsigned int fetch_cap[SMP_SRC_ENTRIES] = { SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | - SMP_VAL_FE_LOG_END), + SMP_VAL_FE_LOG_END | SMP_VAL___________), [SMP_SRC_SSFIN] = (SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | @@ -241,7 +241,7 @@ const unsigned int fetch_cap[SMP_SRC_ENTRIES] = { SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | SMP_VAL___________ | - SMP_VAL_FE_LOG_END), + SMP_VAL_FE_LOG_END | SMP_VAL___________), }; static const char *fetch_src_names[SMP_SRC_ENTRIES] = { @@ -289,6 +289,7 @@ static const char *fetch_ckp_names[SMP_CKP_ENTRIES] = { [SMP_CKP_FE_HRS_HDR] = "frontend http-response header rule", [SMP_CKP_FE_HRS_BDY] = "frontend http-response body rule", [SMP_CKP_FE_LOG_END] = "logs", + [SMP_CKP_BE_CHK_RUL] = "backend tcp-check rule", }; /* This function returns the type of the data returned by the sample_expr. diff --git a/src/vars.c b/src/vars.c index 0b7b99001..7f3d2d0cf 100644 --- a/src/vars.c +++ b/src/vars.c @@ -788,6 +788,7 @@ static enum act_parse_ret parse_store(const char **args, int *arg, struct proxy case ACT_F_TCP_RES_CNT: flags = SMP_VAL_BE_RES_CNT; break; case ACT_F_HTTP_REQ: flags = SMP_VAL_FE_HRQ_HDR; break; case ACT_F_HTTP_RES: flags = SMP_VAL_BE_HRS_HDR; break; + case ACT_F_TCP_CHK: flags = SMP_VAL_BE_CHK_RUL; break; default: memprintf(err, "internal error, unexpected rule->from=%d, please report this bug!", @@ -903,6 +904,14 @@ static struct action_kw_list tcp_res_kws = { { }, { INITCALL1(STG_REGISTER, tcp_res_cont_keywords_register, &tcp_res_kws); +static struct action_kw_list tcp_check_kws = {ILH, { + { "set-var", parse_store, 1 }, + { "unset-var", parse_store, 1 }, + { /* END */ } +}}; + +INITCALL1(STG_REGISTER, tcp_check_keywords_register, &tcp_check_kws); + static struct action_kw_list http_req_kws = { { }, { { "set-var", parse_store, 1 }, { "unset-var", parse_store, 1 },