mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-04-11 03:31:36 +00:00
MAJOR: acl: make use of the new sample struct and get rid of acl_test
This change is invasive in lines of code but not much in terms of functionalities as it's mainly a replacement of struct acl_test with struct sample.
This commit is contained in:
parent
422aa0792d
commit
3740635b88
@ -135,13 +135,13 @@ void acl_unregister_keywords(struct acl_kw_list *kwl);
|
||||
int acl_parse_nothing(const char **text, struct acl_pattern *pattern, int *opaque);
|
||||
|
||||
/* NB: For two strings to be identical, it is required that their lengths match */
|
||||
int acl_match_str(struct acl_test *test, struct acl_pattern *pattern);
|
||||
int acl_match_str(struct sample *smp, struct acl_pattern *pattern);
|
||||
|
||||
/* Checks that the length of the pattern in <test> is included between min and max */
|
||||
int acl_match_len(struct acl_test *test, struct acl_pattern *pattern);
|
||||
int acl_match_len(struct sample *smp, struct acl_pattern *pattern);
|
||||
|
||||
/* Checks that the integer in <test> is included between min and max */
|
||||
int acl_match_int(struct acl_test *test, struct acl_pattern *pattern);
|
||||
int acl_match_int(struct sample *smp, struct acl_pattern *pattern);
|
||||
|
||||
/* Parse an integer. It is put both in min and max. */
|
||||
int acl_parse_int(const char **text, struct acl_pattern *pattern, int *opaque);
|
||||
@ -172,45 +172,45 @@ int acl_parse_ip(const char **text, struct acl_pattern *pattern, int *opaque);
|
||||
|
||||
/* always fake a data retrieval */
|
||||
int acl_fetch_nothing(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test);
|
||||
struct acl_expr *expr, struct sample *smp);
|
||||
|
||||
/* always return false */
|
||||
int acl_match_nothing(struct acl_test *test, struct acl_pattern *pattern);
|
||||
int acl_match_nothing(struct sample *smp, struct acl_pattern *pattern);
|
||||
|
||||
/* Fetch the RDP cookie identified in the expression. */
|
||||
int acl_fetch_rdp_cookie(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test);
|
||||
struct acl_expr *expr, struct sample *smp);
|
||||
|
||||
/* Checks that the pattern matches the end of the tested string. */
|
||||
int acl_match_end(struct acl_test *test, struct acl_pattern *pattern);
|
||||
int acl_match_end(struct sample *smp, struct acl_pattern *pattern);
|
||||
|
||||
/* Checks that the pattern matches the beginning of the tested string. */
|
||||
int acl_match_beg(struct acl_test *test, struct acl_pattern *pattern);
|
||||
int acl_match_beg(struct sample *smp, struct acl_pattern *pattern);
|
||||
|
||||
/* Checks that the pattern is included inside the tested string. */
|
||||
int acl_match_sub(struct acl_test *test, struct acl_pattern *pattern);
|
||||
int acl_match_sub(struct sample *smp, struct acl_pattern *pattern);
|
||||
|
||||
/* Checks that the pattern is included inside the tested string, but enclosed
|
||||
* between slashes or at the beginning or end of the string. Slashes at the
|
||||
* beginning or end of the pattern are ignored.
|
||||
*/
|
||||
int acl_match_dir(struct acl_test *test, struct acl_pattern *pattern);
|
||||
int acl_match_dir(struct sample *smp, struct acl_pattern *pattern);
|
||||
|
||||
/* Checks that the pattern is included inside the tested string, but enclosed
|
||||
* between dots or at the beginning or end of the string. Dots at the beginning
|
||||
* or end of the pattern are ignored.
|
||||
*/
|
||||
int acl_match_dom(struct acl_test *test, struct acl_pattern *pattern);
|
||||
int acl_match_dom(struct sample *smp, struct acl_pattern *pattern);
|
||||
|
||||
/* Check that the IPv4 address in <test> matches the IP/mask in pattern */
|
||||
int acl_match_ip(struct acl_test *test, struct acl_pattern *pattern);
|
||||
int acl_match_ip(struct sample *smp, struct acl_pattern *pattern);
|
||||
|
||||
/* Executes a regex. It needs to change the data. If it is marked READ_ONLY
|
||||
* then it will be allocated and duplicated in place so that others may use
|
||||
* it later on. Note that this is embarrassing because we always try to avoid
|
||||
* allocating memory at run time.
|
||||
*/
|
||||
int acl_match_reg(struct acl_test *test, struct acl_pattern *pattern);
|
||||
int acl_match_reg(struct sample *smp, struct acl_pattern *pattern);
|
||||
|
||||
#endif /* _PROTO_ACL_H */
|
||||
|
||||
|
@ -21,7 +21,7 @@ extern struct userlist *userlist;
|
||||
struct userlist *auth_find_userlist(char *name);
|
||||
unsigned int auth_resolve_groups(struct userlist *l, char *groups);
|
||||
void userlist_free(struct userlist *ul);
|
||||
int acl_match_auth(struct acl_test *test, struct acl_pattern *pattern);
|
||||
int acl_match_auth(struct sample *smp, struct acl_pattern *pattern);
|
||||
int check_user(struct userlist *ul, unsigned int group_mask, const char *user, const char *pass);
|
||||
|
||||
#endif /* _PROTO_AUTH_H */
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
#include <types/arg.h>
|
||||
#include <types/auth.h>
|
||||
#include <types/pattern.h>
|
||||
#include <types/proxy.h>
|
||||
#include <types/server.h>
|
||||
#include <types/session.h>
|
||||
@ -70,26 +71,6 @@ enum {
|
||||
ACL_COND_UNLESS, /* negative condition (after 'unless') */
|
||||
};
|
||||
|
||||
/* possible flags for intermediate test values. The flags are maintained
|
||||
* across consecutive fetches for a same entry (eg: parse all req lines).
|
||||
*/
|
||||
enum {
|
||||
ACL_TEST_F_READ_ONLY = 1 << 0, /* test data are read-only */
|
||||
ACL_TEST_F_MUST_FREE = 1 << 1, /* test data must be freed after end of evaluation */
|
||||
ACL_TEST_F_VOL_TEST = 1 << 2, /* result must not survive longer than the test (eg: time) */
|
||||
ACL_TEST_F_VOL_HDR = 1 << 3, /* result sensitive to changes in headers */
|
||||
ACL_TEST_F_VOL_1ST = 1 << 4, /* result sensitive to changes in first line (eg: URI) */
|
||||
ACL_TEST_F_VOL_TXN = 1 << 5, /* result sensitive to new transaction (eg: persist) */
|
||||
ACL_TEST_F_VOL_SESS = 1 << 6, /* result sensitive to new session (eg: IP) */
|
||||
ACL_TEST_F_VOLATILE = (1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6),
|
||||
ACL_TEST_F_FETCH_MORE = 1 << 7, /* if test does not match, retry with next entry (for multi-match) */
|
||||
ACL_TEST_F_MAY_CHANGE = 1 << 8, /* if test does not match, retry later (eg: request size) */
|
||||
ACL_TEST_F_RES_SET = 1 << 9, /* for fetch() function to assign the result without calling match() */
|
||||
ACL_TEST_F_RES_PASS = 1 << 10,/* with SET_RESULT, sets result to PASS (defaults to FAIL) */
|
||||
ACL_TEST_F_SET_RES_PASS = (ACL_TEST_F_RES_SET|ACL_TEST_F_RES_PASS), /* sets result to PASS */
|
||||
ACL_TEST_F_SET_RES_FAIL = (ACL_TEST_F_RES_SET), /* sets result to FAIL */
|
||||
};
|
||||
|
||||
/* ACLs can be evaluated on requests and on responses, and on partial or complete data */
|
||||
enum {
|
||||
ACL_DIR_REQ = 0, /* ACL evaluated on request */
|
||||
@ -236,21 +217,6 @@ struct acl_pattern {
|
||||
int flags; /* expr or pattern flags. */
|
||||
};
|
||||
|
||||
/* The structure exchanged between an acl_fetch_* function responsible for
|
||||
* retrieving a value, and an acl_match_* function responsible for testing it.
|
||||
*/
|
||||
struct acl_test {
|
||||
int flags; /* ACL_TEST_F_* set to 0 on first call */
|
||||
union { /* fetch_* functions context for any purpose */
|
||||
void *p; /* any pointer */
|
||||
int i; /* any integer */
|
||||
long long ll; /* any long long or smaller */
|
||||
double d; /* any float or double */
|
||||
void *a[8]; /* any array of up to 8 pointers */
|
||||
} ctx;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* ACL keyword: Associates keywords with parsers, methods to retrieve the value and testers.
|
||||
*/
|
||||
@ -273,8 +239,8 @@ struct acl_keyword {
|
||||
const char *kw;
|
||||
int (*parse)(const char **text, struct acl_pattern *pattern, int *opaque);
|
||||
int (*fetch)(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test);
|
||||
int (*match)(struct acl_test *test, struct acl_pattern *pattern);
|
||||
struct acl_expr *expr, struct sample *smp);
|
||||
int (*match)(struct sample *smp, struct acl_pattern *pattern);
|
||||
unsigned int requires; /* bit mask of all ACL_USE_* required to evaluate this keyword */
|
||||
int arg_mask; /* mask describing up to 7 arg types */
|
||||
/* must be after the config params */
|
||||
|
124
src/acl.c
124
src/acl.c
@ -66,9 +66,9 @@ static struct acl_kw_list acl_keywords = {
|
||||
/* force TRUE to be returned at the fetch level */
|
||||
static int
|
||||
acl_fetch_true(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
test->flags |= ACL_TEST_F_SET_RES_PASS;
|
||||
smp->flags |= SMP_F_SET_RES_PASS;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -77,42 +77,42 @@ acl_fetch_true(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_wait_end(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
if (dir & ACL_PARTIAL) {
|
||||
test->flags |= ACL_TEST_F_MAY_CHANGE;
|
||||
smp->flags |= SMP_F_MAY_CHANGE;
|
||||
return 0;
|
||||
}
|
||||
test->flags |= ACL_TEST_F_SET_RES_PASS;
|
||||
smp->flags |= SMP_F_SET_RES_PASS;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* force FALSE to be returned at the fetch level */
|
||||
static int
|
||||
acl_fetch_false(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
test->flags |= ACL_TEST_F_SET_RES_FAIL;
|
||||
smp->flags |= SMP_F_SET_RES_FAIL;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* return the number of bytes in the request buffer */
|
||||
static int
|
||||
acl_fetch_req_len(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
if (!l4 || !l4->req)
|
||||
return 0;
|
||||
|
||||
temp_pattern.data.uint = l4->req->i;
|
||||
test->flags = ACL_TEST_F_VOLATILE | ACL_TEST_F_MAY_CHANGE;
|
||||
smp->flags = SMP_F_VOLATILE | SMP_F_MAY_CHANGE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
acl_fetch_ssl_hello_type(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
int hs_len;
|
||||
int hs_type, bleft;
|
||||
@ -158,12 +158,12 @@ acl_fetch_ssl_hello_type(struct proxy *px, struct session *l4, void *l7, int dir
|
||||
}
|
||||
|
||||
temp_pattern.data.uint = hs_type;
|
||||
test->flags = ACL_TEST_F_VOLATILE;
|
||||
smp->flags = SMP_F_VOLATILE;
|
||||
|
||||
return 1;
|
||||
|
||||
too_short:
|
||||
test->flags = ACL_TEST_F_MAY_CHANGE;
|
||||
smp->flags = SMP_F_MAY_CHANGE;
|
||||
|
||||
not_ssl_hello:
|
||||
|
||||
@ -180,7 +180,7 @@ acl_fetch_ssl_hello_type(struct proxy *px, struct session *l4, void *l7, int dir
|
||||
*/
|
||||
static int
|
||||
acl_fetch_req_ssl_ver(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
int version, bleft, msg_len;
|
||||
const unsigned char *data;
|
||||
@ -271,11 +271,11 @@ acl_fetch_req_ssl_ver(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
* the protocol version.
|
||||
*/
|
||||
temp_pattern.data.uint = version;
|
||||
test->flags = ACL_TEST_F_VOLATILE;
|
||||
smp->flags = SMP_F_VOLATILE;
|
||||
return 1;
|
||||
|
||||
too_short:
|
||||
test->flags = ACL_TEST_F_MAY_CHANGE;
|
||||
smp->flags = SMP_F_MAY_CHANGE;
|
||||
not_ssl:
|
||||
return 0;
|
||||
}
|
||||
@ -315,7 +315,7 @@ acl_fetch_req_ssl_ver(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_ssl_hello_sni(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
int hs_len, ext_len, bleft;
|
||||
struct buffer *b;
|
||||
@ -427,7 +427,7 @@ acl_fetch_ssl_hello_sni(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
if (name_type == 0) { /* hostname */
|
||||
temp_pattern.data.str.str = (char *)data + 9;
|
||||
temp_pattern.data.str.len = name_len;
|
||||
test->flags = ACL_TEST_F_VOLATILE;
|
||||
smp->flags = SMP_F_VOLATILE;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -439,7 +439,7 @@ acl_fetch_ssl_hello_sni(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
goto not_ssl_hello;
|
||||
|
||||
too_short:
|
||||
test->flags = ACL_TEST_F_MAY_CHANGE;
|
||||
smp->flags = SMP_F_MAY_CHANGE;
|
||||
|
||||
not_ssl_hello:
|
||||
|
||||
@ -453,7 +453,7 @@ acl_fetch_ssl_hello_sni(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
int
|
||||
acl_fetch_rdp_cookie(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
int bleft;
|
||||
const unsigned char *data;
|
||||
@ -461,7 +461,7 @@ acl_fetch_rdp_cookie(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
if (!l4 || !l4->req)
|
||||
return 0;
|
||||
|
||||
test->flags = 0;
|
||||
smp->flags = 0;
|
||||
|
||||
bleft = l4->req->i;
|
||||
if (bleft <= 11)
|
||||
@ -529,30 +529,30 @@ acl_fetch_rdp_cookie(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
goto not_cookie;
|
||||
|
||||
temp_pattern.data.str.len = (char *)data - temp_pattern.data.str.str;
|
||||
test->flags = ACL_TEST_F_VOLATILE;
|
||||
smp->flags = SMP_F_VOLATILE;
|
||||
return 1;
|
||||
|
||||
too_short:
|
||||
test->flags = ACL_TEST_F_MAY_CHANGE;
|
||||
smp->flags = SMP_F_MAY_CHANGE;
|
||||
not_cookie:
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
acl_fetch_rdp_cookie_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = acl_fetch_rdp_cookie(px, l4, l7, dir, expr, test);
|
||||
ret = acl_fetch_rdp_cookie(px, l4, l7, dir, expr, smp);
|
||||
|
||||
temp_pattern.data.str.str = NULL;
|
||||
temp_pattern.data.str.len = 0;
|
||||
|
||||
if (test->flags & ACL_TEST_F_MAY_CHANGE)
|
||||
if (smp->flags & SMP_F_MAY_CHANGE)
|
||||
return 0;
|
||||
|
||||
test->flags = ACL_TEST_F_VOLATILE;
|
||||
smp->flags = SMP_F_VOLATILE;
|
||||
temp_pattern.data.uint = ret;
|
||||
|
||||
return 1;
|
||||
@ -571,20 +571,20 @@ int acl_parse_nothing(const char **text, struct acl_pattern *pattern, int *opaqu
|
||||
|
||||
/* always fake a data retrieval */
|
||||
int acl_fetch_nothing(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* always return false */
|
||||
int acl_match_nothing(struct acl_test *test, struct acl_pattern *pattern)
|
||||
int acl_match_nothing(struct sample *smp, struct acl_pattern *pattern)
|
||||
{
|
||||
return ACL_PAT_FAIL;
|
||||
}
|
||||
|
||||
|
||||
/* NB: For two strings to be identical, it is required that their lengths match */
|
||||
int acl_match_str(struct acl_test *test, struct acl_pattern *pattern)
|
||||
int acl_match_str(struct sample *smp, struct acl_pattern *pattern)
|
||||
{
|
||||
int icase;
|
||||
|
||||
@ -601,7 +601,7 @@ int acl_match_str(struct acl_test *test, struct acl_pattern *pattern)
|
||||
/* Lookup a string in the expression's pattern tree. The node is returned if it
|
||||
* exists, otherwise NULL.
|
||||
*/
|
||||
void *acl_lookup_str(struct acl_test *test, struct acl_expr *expr)
|
||||
static void *acl_lookup_str(struct sample *smp, struct acl_expr *expr)
|
||||
{
|
||||
/* data are stored in a tree */
|
||||
struct ebmb_node *node;
|
||||
@ -622,12 +622,12 @@ void *acl_lookup_str(struct acl_test *test, struct acl_expr *expr)
|
||||
* it later on. Note that this is embarrassing because we always try to avoid
|
||||
* allocating memory at run time.
|
||||
*/
|
||||
int acl_match_reg(struct acl_test *test, struct acl_pattern *pattern)
|
||||
int acl_match_reg(struct sample *smp, struct acl_pattern *pattern)
|
||||
{
|
||||
char old_char;
|
||||
int ret;
|
||||
|
||||
if (unlikely(test->flags & ACL_TEST_F_READ_ONLY)) {
|
||||
if (unlikely(smp->flags & SMP_F_READ_ONLY)) {
|
||||
char *new_str;
|
||||
|
||||
new_str = calloc(1, temp_pattern.data.str.len + 1);
|
||||
@ -636,11 +636,11 @@ int acl_match_reg(struct acl_test *test, struct acl_pattern *pattern)
|
||||
|
||||
memcpy(new_str, temp_pattern.data.str.str, temp_pattern.data.str.len);
|
||||
new_str[temp_pattern.data.str.len] = 0;
|
||||
if (test->flags & ACL_TEST_F_MUST_FREE)
|
||||
if (smp->flags & SMP_F_MUST_FREE)
|
||||
free(temp_pattern.data.str.str);
|
||||
temp_pattern.data.str.str = new_str;
|
||||
test->flags |= ACL_TEST_F_MUST_FREE;
|
||||
test->flags &= ~ACL_TEST_F_READ_ONLY;
|
||||
smp->flags |= SMP_F_MUST_FREE;
|
||||
smp->flags &= ~SMP_F_READ_ONLY;
|
||||
}
|
||||
|
||||
old_char = temp_pattern.data.str.str[temp_pattern.data.str.len];
|
||||
@ -656,7 +656,7 @@ int acl_match_reg(struct acl_test *test, struct acl_pattern *pattern)
|
||||
}
|
||||
|
||||
/* Checks that the pattern matches the beginning of the tested string. */
|
||||
int acl_match_beg(struct acl_test *test, struct acl_pattern *pattern)
|
||||
int acl_match_beg(struct sample *smp, struct acl_pattern *pattern)
|
||||
{
|
||||
int icase;
|
||||
|
||||
@ -671,7 +671,7 @@ int acl_match_beg(struct acl_test *test, struct acl_pattern *pattern)
|
||||
}
|
||||
|
||||
/* Checks that the pattern matches the end of the tested string. */
|
||||
int acl_match_end(struct acl_test *test, struct acl_pattern *pattern)
|
||||
int acl_match_end(struct sample *smp, struct acl_pattern *pattern)
|
||||
{
|
||||
int icase;
|
||||
|
||||
@ -687,7 +687,7 @@ int acl_match_end(struct acl_test *test, struct acl_pattern *pattern)
|
||||
/* Checks that the pattern is included inside the tested string.
|
||||
* NB: Suboptimal, should be rewritten using a Boyer-Moore method.
|
||||
*/
|
||||
int acl_match_sub(struct acl_test *test, struct acl_pattern *pattern)
|
||||
int acl_match_sub(struct sample *smp, struct acl_pattern *pattern)
|
||||
{
|
||||
int icase;
|
||||
char *end;
|
||||
@ -744,7 +744,7 @@ static inline unsigned int make_4delim(unsigned char d1, unsigned char d2, unsig
|
||||
* provided as an unsigned int made by make_4delim() and match up to 4 different
|
||||
* delimiters. Delimiters are stripped at the beginning and end of the pattern.
|
||||
*/
|
||||
static int match_word(struct acl_test *test, struct acl_pattern *pattern, unsigned int delimiters)
|
||||
static int match_word(struct sample *smp, struct acl_pattern *pattern, unsigned int delimiters)
|
||||
{
|
||||
int may_match, icase;
|
||||
char *c, *end;
|
||||
@ -797,22 +797,22 @@ static int match_word(struct acl_test *test, struct acl_pattern *pattern, unsign
|
||||
* between the delimiters '?' or '/' or at the beginning or end of the string.
|
||||
* Delimiters at the beginning or end of the pattern are ignored.
|
||||
*/
|
||||
int acl_match_dir(struct acl_test *test, struct acl_pattern *pattern)
|
||||
int acl_match_dir(struct sample *smp, struct acl_pattern *pattern)
|
||||
{
|
||||
return match_word(test, pattern, make_4delim('/', '?', '?', '?'));
|
||||
return match_word(smp, pattern, make_4delim('/', '?', '?', '?'));
|
||||
}
|
||||
|
||||
/* Checks that the pattern is included inside the tested string, but enclosed
|
||||
* between the delmiters '/', '?', '.' or ":" or at the beginning or end of
|
||||
* the string. Delimiters at the beginning or end of the pattern are ignored.
|
||||
*/
|
||||
int acl_match_dom(struct acl_test *test, struct acl_pattern *pattern)
|
||||
int acl_match_dom(struct sample *smp, struct acl_pattern *pattern)
|
||||
{
|
||||
return match_word(test, pattern, make_4delim('/', '?', '.', ':'));
|
||||
return match_word(smp, pattern, make_4delim('/', '?', '.', ':'));
|
||||
}
|
||||
|
||||
/* Checks that the integer in <test> is included between min and max */
|
||||
int acl_match_int(struct acl_test *test, struct acl_pattern *pattern)
|
||||
int acl_match_int(struct sample *smp, struct acl_pattern *pattern)
|
||||
{
|
||||
if ((!pattern->val.range.min_set || pattern->val.range.min <= temp_pattern.data.uint) &&
|
||||
(!pattern->val.range.max_set || temp_pattern.data.uint <= pattern->val.range.max))
|
||||
@ -821,7 +821,7 @@ int acl_match_int(struct acl_test *test, struct acl_pattern *pattern)
|
||||
}
|
||||
|
||||
/* Checks that the length of the pattern in <test> is included between min and max */
|
||||
int acl_match_len(struct acl_test *test, struct acl_pattern *pattern)
|
||||
int acl_match_len(struct sample *smp, struct acl_pattern *pattern)
|
||||
{
|
||||
if ((!pattern->val.range.min_set || pattern->val.range.min <= temp_pattern.data.str.len) &&
|
||||
(!pattern->val.range.max_set || temp_pattern.data.str.len <= pattern->val.range.max))
|
||||
@ -829,7 +829,7 @@ int acl_match_len(struct acl_test *test, struct acl_pattern *pattern)
|
||||
return ACL_PAT_FAIL;
|
||||
}
|
||||
|
||||
int acl_match_ip(struct acl_test *test, struct acl_pattern *pattern)
|
||||
int acl_match_ip(struct sample *smp, struct acl_pattern *pattern)
|
||||
{
|
||||
struct in_addr *s;
|
||||
|
||||
@ -845,7 +845,7 @@ int acl_match_ip(struct acl_test *test, struct acl_pattern *pattern)
|
||||
/* Lookup an IPv4 address in the expression's pattern tree using the longest
|
||||
* match method. The node is returned if it exists, otherwise NULL.
|
||||
*/
|
||||
void *acl_lookup_ip(struct acl_test *test, struct acl_expr *expr)
|
||||
static void *acl_lookup_ip(struct sample *smp, struct acl_expr *expr)
|
||||
{
|
||||
struct in_addr *s;
|
||||
|
||||
@ -910,8 +910,8 @@ acl_parse_strcat(const char **text, struct acl_pattern *pattern, int *opaque)
|
||||
}
|
||||
|
||||
/* Free data allocated by acl_parse_reg */
|
||||
static void acl_free_reg(void *ptr) {
|
||||
|
||||
static void acl_free_reg(void *ptr)
|
||||
{
|
||||
regfree((regex_t *)ptr);
|
||||
}
|
||||
|
||||
@ -1825,7 +1825,7 @@ int acl_exec_cond(struct acl_cond *cond, struct proxy *px, struct session *l4, v
|
||||
struct acl_expr *expr;
|
||||
struct acl *acl;
|
||||
struct acl_pattern *pattern;
|
||||
struct acl_test test;
|
||||
struct sample smp;
|
||||
int acl_res, suite_res, cond_res;
|
||||
|
||||
/* We're doing a logical OR between conditions so we initialize to FAIL.
|
||||
@ -1855,17 +1855,17 @@ int acl_exec_cond(struct acl_cond *cond, struct proxy *px, struct session *l4, v
|
||||
acl_res = ACL_PAT_FAIL;
|
||||
list_for_each_entry(expr, &acl->expr, list) {
|
||||
/* we need to reset context and flags */
|
||||
memset(&test, 0, sizeof(test));
|
||||
memset(&smp, 0, sizeof(smp));
|
||||
fetch_next:
|
||||
if (!expr->kw->fetch(px, l4, l7, dir, expr, &test)) {
|
||||
if (!expr->kw->fetch(px, l4, l7, dir, expr, &smp)) {
|
||||
/* maybe we could not fetch because of missing data */
|
||||
if (test.flags & ACL_TEST_F_MAY_CHANGE && dir & ACL_PARTIAL)
|
||||
if (smp.flags & SMP_F_MAY_CHANGE && dir & ACL_PARTIAL)
|
||||
acl_res |= ACL_PAT_MISS;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (test.flags & ACL_TEST_F_RES_SET) {
|
||||
if (test.flags & ACL_TEST_F_RES_PASS)
|
||||
if (smp.flags & SMP_F_RES_SET) {
|
||||
if (smp.flags & SMP_F_RES_PASS)
|
||||
acl_res |= ACL_PAT_PASS;
|
||||
else
|
||||
acl_res |= ACL_PAT_FAIL;
|
||||
@ -1874,16 +1874,16 @@ int acl_exec_cond(struct acl_cond *cond, struct proxy *px, struct session *l4, v
|
||||
if (!eb_is_empty(&expr->pattern_tree)) {
|
||||
/* a tree is present, let's check what type it is */
|
||||
if (expr->kw->match == acl_match_str)
|
||||
acl_res |= acl_lookup_str(&test, expr) ? ACL_PAT_PASS : ACL_PAT_FAIL;
|
||||
acl_res |= acl_lookup_str(&smp, expr) ? ACL_PAT_PASS : ACL_PAT_FAIL;
|
||||
else if (expr->kw->match == acl_match_ip)
|
||||
acl_res |= acl_lookup_ip(&test, expr) ? ACL_PAT_PASS : ACL_PAT_FAIL;
|
||||
acl_res |= acl_lookup_ip(&smp, expr) ? ACL_PAT_PASS : ACL_PAT_FAIL;
|
||||
}
|
||||
|
||||
/* call the match() function for all tests on this value */
|
||||
list_for_each_entry(pattern, &expr->patterns, list) {
|
||||
if (acl_res == ACL_PAT_PASS)
|
||||
break;
|
||||
acl_res |= expr->kw->match(&test, pattern);
|
||||
acl_res |= expr->kw->match(&smp, pattern);
|
||||
}
|
||||
}
|
||||
/*
|
||||
@ -1891,14 +1891,14 @@ int acl_exec_cond(struct acl_cond *cond, struct proxy *px, struct session *l4, v
|
||||
* as one of ACL_PAT_FAIL, ACL_PAT_MISS or ACL_PAT_PASS.
|
||||
*
|
||||
* Then if (!MISS) we can cache the result, and put
|
||||
* (test.flags & ACL_TEST_F_VOLATILE) in the cache flags.
|
||||
* (smp.flags & SMP_F_VOLATILE) in the cache flags.
|
||||
*
|
||||
* FIXME: implement cache.
|
||||
*
|
||||
*/
|
||||
|
||||
/* now we may have some cleanup to do */
|
||||
if (test.flags & ACL_TEST_F_MUST_FREE) {
|
||||
if (smp.flags & SMP_F_MUST_FREE) {
|
||||
free(temp_pattern.data.str.str);
|
||||
temp_pattern.data.str.len = 0;
|
||||
}
|
||||
@ -1907,14 +1907,14 @@ int acl_exec_cond(struct acl_cond *cond, struct proxy *px, struct session *l4, v
|
||||
if (acl_res == ACL_PAT_PASS)
|
||||
break;
|
||||
|
||||
if (test.flags & ACL_TEST_F_FETCH_MORE)
|
||||
if (smp.flags & SMP_F_NOT_LAST)
|
||||
goto fetch_next;
|
||||
|
||||
/* sometimes we know the fetched data is subject to change
|
||||
* later and give another chance for a new match (eg: request
|
||||
* size, time, ...)
|
||||
*/
|
||||
if (test.flags & ACL_TEST_F_MAY_CHANGE && dir & ACL_PARTIAL)
|
||||
if (smp.flags & SMP_F_MAY_CHANGE && dir & ACL_PARTIAL)
|
||||
acl_res |= ACL_PAT_MISS;
|
||||
}
|
||||
/*
|
||||
|
@ -167,12 +167,12 @@ check_user(struct userlist *ul, unsigned int group_mask, const char *user, const
|
||||
}
|
||||
|
||||
int
|
||||
acl_match_auth(struct acl_test *test, struct acl_pattern *pattern)
|
||||
acl_match_auth(struct sample *smp, struct acl_pattern *pattern)
|
||||
{
|
||||
|
||||
struct userlist *ul = test->ctx.a[0];
|
||||
char *user = test->ctx.a[1];
|
||||
char *pass = test->ctx.a[2];
|
||||
struct userlist *ul = smp->ctx.a[0];
|
||||
char *user = smp->ctx.a[1];
|
||||
char *pass = smp->ctx.a[2];
|
||||
unsigned int group_mask = pattern->val.group_mask;
|
||||
|
||||
if (check_user(ul, group_mask, user, pass))
|
||||
|
@ -403,7 +403,7 @@ struct server *get_server_rch(struct session *s)
|
||||
const char *p;
|
||||
int ret;
|
||||
struct acl_expr expr;
|
||||
struct acl_test test;
|
||||
struct sample smp;
|
||||
struct arg args[2];
|
||||
|
||||
/* tot_weight appears to mean srv_count */
|
||||
@ -411,7 +411,7 @@ struct server *get_server_rch(struct session *s)
|
||||
return NULL;
|
||||
|
||||
memset(&expr, 0, sizeof(expr));
|
||||
memset(&test, 0, sizeof(test));
|
||||
memset(&smp, 0, sizeof(smp));
|
||||
|
||||
args[0].type = ARGT_STR;
|
||||
args[0].data.str.str = px->hh_name;
|
||||
@ -420,10 +420,10 @@ struct server *get_server_rch(struct session *s)
|
||||
|
||||
expr.args = args;
|
||||
|
||||
ret = acl_fetch_rdp_cookie(px, s, NULL, ACL_DIR_REQ, &expr, &test);
|
||||
ret = acl_fetch_rdp_cookie(px, s, NULL, ACL_DIR_REQ, &expr, &smp);
|
||||
len = temp_pattern.data.str.len;
|
||||
|
||||
if (ret == 0 || (test.flags & ACL_TEST_F_MAY_CHANGE) || len == 0)
|
||||
if (ret == 0 || (smp.flags & SMP_F_MAY_CHANGE) || len == 0)
|
||||
return NULL;
|
||||
|
||||
/* note: we won't hash if there's only one server left */
|
||||
@ -1114,7 +1114,7 @@ int tcp_persist_rdp_cookie(struct session *s, struct buffer *req, int an_bit)
|
||||
struct proxy *px = s->be;
|
||||
int ret;
|
||||
struct acl_expr expr;
|
||||
struct acl_test test;
|
||||
struct sample smp;
|
||||
struct server *srv = px->srv;
|
||||
struct sockaddr_in addr;
|
||||
char *p;
|
||||
@ -1133,7 +1133,7 @@ int tcp_persist_rdp_cookie(struct session *s, struct buffer *req, int an_bit)
|
||||
goto no_cookie;
|
||||
|
||||
memset(&expr, 0, sizeof(expr));
|
||||
memset(&test, 0, sizeof(test));
|
||||
memset(&smp, 0, sizeof(smp));
|
||||
|
||||
args[0].type = ARGT_STR;
|
||||
args[0].data.str.str = s->be->rdp_cookie_name;
|
||||
@ -1142,8 +1142,8 @@ int tcp_persist_rdp_cookie(struct session *s, struct buffer *req, int an_bit)
|
||||
|
||||
expr.args = args;
|
||||
|
||||
ret = acl_fetch_rdp_cookie(px, s, NULL, ACL_DIR_REQ, &expr, &test);
|
||||
if (ret == 0 || (test.flags & ACL_TEST_F_MAY_CHANGE) || temp_pattern.data.str.len == 0)
|
||||
ret = acl_fetch_rdp_cookie(px, s, NULL, ACL_DIR_REQ, &expr, &smp);
|
||||
if (ret == 0 || (smp.flags & SMP_F_MAY_CHANGE) || temp_pattern.data.str.len == 0)
|
||||
goto no_cookie;
|
||||
|
||||
memset(&addr, 0, sizeof(addr));
|
||||
@ -1383,9 +1383,9 @@ int backend_parse_balance(const char **args, char *err, int errlen, struct proxy
|
||||
*/
|
||||
static int
|
||||
acl_fetch_nbsrv(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
test->flags = ACL_TEST_F_VOL_TEST;
|
||||
smp->flags = SMP_F_VOL_TEST;
|
||||
px = expr->args->data.prx;
|
||||
|
||||
if (px->srv_act)
|
||||
@ -1398,23 +1398,23 @@ acl_fetch_nbsrv(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* report in test->flags a success or failure depending on the designated
|
||||
/* report in smp->flags a success or failure depending on the designated
|
||||
* server's state. There is no match function involved since there's no pattern.
|
||||
* Accepts exactly 1 argument. Argument is a server, other types will lead to
|
||||
* undefined behaviour.
|
||||
*/
|
||||
static int
|
||||
acl_fetch_srv_is_up(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
struct server *srv = expr->args->data.srv;
|
||||
|
||||
test->flags = ACL_TEST_F_VOL_TEST;
|
||||
smp->flags = SMP_F_VOL_TEST;
|
||||
if (!(srv->state & SRV_MAINTAIN) &&
|
||||
(!(srv->state & SRV_CHECKED) || (srv->state & SRV_RUNNING)))
|
||||
test->flags |= ACL_TEST_F_SET_RES_PASS;
|
||||
smp->flags |= SMP_F_SET_RES_PASS;
|
||||
else
|
||||
test->flags |= ACL_TEST_F_SET_RES_FAIL;
|
||||
smp->flags |= SMP_F_SET_RES_FAIL;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1424,11 +1424,11 @@ acl_fetch_srv_is_up(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_connslots(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
struct server *iterator;
|
||||
|
||||
test->flags = ACL_TEST_F_VOL_TEST;
|
||||
smp->flags = SMP_F_VOL_TEST;
|
||||
temp_pattern.data.uint = 0;
|
||||
|
||||
for (iterator = expr->args->data.prx->srv; iterator; iterator = iterator->next) {
|
||||
@ -1451,9 +1451,9 @@ acl_fetch_connslots(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
/* set temp integer to the id of the backend */
|
||||
static int
|
||||
acl_fetch_be_id(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test) {
|
||||
|
||||
test->flags = ACL_TEST_F_READ_ONLY;
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
smp->flags = SMP_F_READ_ONLY;
|
||||
temp_pattern.data.uint = l4->be->uuid;
|
||||
|
||||
return 1;
|
||||
@ -1462,12 +1462,12 @@ acl_fetch_be_id(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
/* set temp integer to the id of the server */
|
||||
static int
|
||||
acl_fetch_srv_id(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test) {
|
||||
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
if (!target_srv(&l4->target))
|
||||
return 0;
|
||||
|
||||
test->flags = ACL_TEST_F_READ_ONLY;
|
||||
smp->flags = SMP_F_READ_ONLY;
|
||||
temp_pattern.data.uint = target_srv(&l4->target)->puid;
|
||||
|
||||
return 1;
|
||||
@ -1479,9 +1479,9 @@ acl_fetch_srv_id(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_be_sess_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
test->flags = ACL_TEST_F_VOL_TEST;
|
||||
smp->flags = SMP_F_VOL_TEST;
|
||||
temp_pattern.data.uint = read_freq_ctr(&expr->args->data.prx->be_sess_per_sec);
|
||||
return 1;
|
||||
}
|
||||
@ -1492,9 +1492,9 @@ acl_fetch_be_sess_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_be_conn(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
test->flags = ACL_TEST_F_VOL_TEST;
|
||||
smp->flags = SMP_F_VOL_TEST;
|
||||
temp_pattern.data.uint = expr->args->data.prx->beconn;
|
||||
return 1;
|
||||
}
|
||||
@ -1505,9 +1505,9 @@ acl_fetch_be_conn(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_queue_size(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
test->flags = ACL_TEST_F_VOL_TEST;
|
||||
smp->flags = SMP_F_VOL_TEST;
|
||||
temp_pattern.data.uint = expr->args->data.prx->totpend;
|
||||
return 1;
|
||||
}
|
||||
@ -1522,11 +1522,11 @@ acl_fetch_queue_size(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_avg_queue_size(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
int nbsrv;
|
||||
|
||||
test->flags = ACL_TEST_F_VOL_TEST;
|
||||
smp->flags = SMP_F_VOL_TEST;
|
||||
px = expr->args->data.prx;
|
||||
|
||||
if (px->srv_act)
|
||||
@ -1550,7 +1550,7 @@ acl_fetch_avg_queue_size(struct proxy *px, struct session *l4, void *l7, int dir
|
||||
*/
|
||||
static int
|
||||
acl_fetch_srv_conn(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
temp_pattern.data.uint = expr->args->data.srv->cur_sess;
|
||||
return 1;
|
||||
|
@ -500,9 +500,9 @@ int make_proxy_line(char *buf, int buf_len, struct sockaddr_storage *src, struct
|
||||
/* set temp integer to the id of the frontend */
|
||||
static int
|
||||
acl_fetch_fe_id(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test) {
|
||||
|
||||
test->flags = ACL_TEST_F_READ_ONLY;
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
smp->flags = SMP_F_READ_ONLY;
|
||||
temp_pattern.data.uint = l4->fe->uuid;
|
||||
return 1;
|
||||
}
|
||||
@ -513,9 +513,9 @@ acl_fetch_fe_id(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_fe_sess_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
test->flags = ACL_TEST_F_VOL_TEST;
|
||||
smp->flags = SMP_F_VOL_TEST;
|
||||
temp_pattern.data.uint = read_freq_ctr(&expr->args->data.prx->fe_sess_per_sec);
|
||||
return 1;
|
||||
}
|
||||
@ -526,9 +526,9 @@ acl_fetch_fe_sess_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_fe_conn(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
test->flags = ACL_TEST_F_VOL_TEST;
|
||||
smp->flags = SMP_F_VOL_TEST;
|
||||
temp_pattern.data.uint = expr->args->data.prx->feconn;
|
||||
return 1;
|
||||
}
|
||||
|
132
src/proto_http.c
132
src/proto_http.c
@ -7541,7 +7541,7 @@ req_error_parsing:
|
||||
*/
|
||||
static int
|
||||
acl_prefetch_http(struct proxy *px, struct session *s, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
struct http_txn *txn = l7;
|
||||
struct http_msg *msg = &txn->req;
|
||||
@ -7561,7 +7561,7 @@ acl_prefetch_http(struct proxy *px, struct session *s, void *l7, int dir,
|
||||
|
||||
if (unlikely(txn->req.msg_state < HTTP_MSG_BODY)) {
|
||||
if ((msg->msg_state == HTTP_MSG_ERROR) || (s->req->flags & BF_FULL)) {
|
||||
test->flags |= ACL_TEST_F_SET_RES_FAIL;
|
||||
smp->flags |= SMP_F_SET_RES_FAIL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -7572,11 +7572,11 @@ acl_prefetch_http(struct proxy *px, struct session *s, void *l7, int dir,
|
||||
/* Still no valid request ? */
|
||||
if (unlikely(msg->msg_state < HTTP_MSG_BODY)) {
|
||||
if ((msg->msg_state == HTTP_MSG_ERROR) || (s->req->flags & BF_FULL)) {
|
||||
test->flags |= ACL_TEST_F_SET_RES_FAIL;
|
||||
smp->flags |= SMP_F_SET_RES_FAIL;
|
||||
return -1;
|
||||
}
|
||||
/* wait for final state */
|
||||
test->flags |= ACL_TEST_F_MAY_CHANGE;
|
||||
smp->flags |= SMP_F_MAY_CHANGE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -7589,7 +7589,7 @@ acl_prefetch_http(struct proxy *px, struct session *s, void *l7, int dir,
|
||||
s->flags |= SN_REDIRECTABLE;
|
||||
|
||||
if (unlikely(msg->sl.rq.v_l == 0) && !http_upgrade_v09_to_v10(txn)) {
|
||||
test->flags |= ACL_TEST_F_SET_RES_FAIL;
|
||||
smp->flags |= SMP_F_SET_RES_FAIL;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -7612,7 +7612,7 @@ acl_prefetch_http(struct proxy *px, struct session *s, void *l7, int dir,
|
||||
}
|
||||
|
||||
#define CHECK_HTTP_MESSAGE_FIRST() \
|
||||
do { int r = acl_prefetch_http(px, l4, l7, dir, expr, test); if (r <= 0) return r; } while (0)
|
||||
do { int r = acl_prefetch_http(px, l4, l7, dir, expr, smp); if (r <= 0) return r; } while (0)
|
||||
|
||||
|
||||
/* 1. Check on METHOD
|
||||
@ -7646,7 +7646,7 @@ static int acl_parse_meth(const char **text, struct acl_pattern *pattern, int *o
|
||||
*/
|
||||
static int
|
||||
acl_fetch_meth(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
int meth;
|
||||
struct http_txn *txn = l7;
|
||||
@ -7663,12 +7663,12 @@ acl_fetch_meth(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
temp_pattern.data.str.len = txn->req.sl.rq.m_l;
|
||||
temp_pattern.data.str.str = txn->req.buf->p + txn->req.sol;
|
||||
}
|
||||
test->flags = ACL_TEST_F_READ_ONLY | ACL_TEST_F_VOL_1ST;
|
||||
smp->flags = SMP_F_READ_ONLY | SMP_F_VOL_1ST;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* See above how the method is stored in the global pattern */
|
||||
static int acl_match_meth(struct acl_test *test, struct acl_pattern *pattern)
|
||||
static int acl_match_meth(struct sample *smp, struct acl_pattern *pattern)
|
||||
{
|
||||
int icase;
|
||||
|
||||
@ -7709,7 +7709,7 @@ static int acl_parse_ver(const char **text, struct acl_pattern *pattern, int *op
|
||||
|
||||
static int
|
||||
acl_fetch_rqver(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
struct http_txn *txn = l7;
|
||||
char *ptr;
|
||||
@ -7727,13 +7727,13 @@ acl_fetch_rqver(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
temp_pattern.data.str.str = ptr;
|
||||
temp_pattern.data.str.len = len;
|
||||
|
||||
test->flags = ACL_TEST_F_READ_ONLY | ACL_TEST_F_VOL_1ST;
|
||||
smp->flags = SMP_F_READ_ONLY | SMP_F_VOL_1ST;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
acl_fetch_stver(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
struct http_txn *txn = l7;
|
||||
char *ptr;
|
||||
@ -7751,14 +7751,14 @@ acl_fetch_stver(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
temp_pattern.data.str.str = ptr;
|
||||
temp_pattern.data.str.len = len;
|
||||
|
||||
test->flags = ACL_TEST_F_READ_ONLY | ACL_TEST_F_VOL_1ST;
|
||||
smp->flags = SMP_F_READ_ONLY | SMP_F_VOL_1ST;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* 3. Check on Status Code. We manipulate integers here. */
|
||||
static int
|
||||
acl_fetch_stcode(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
struct http_txn *txn = l7;
|
||||
char *ptr;
|
||||
@ -7770,14 +7770,14 @@ acl_fetch_stcode(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
ptr = txn->rsp.buf->p + txn->rsp.sol + txn->rsp.sl.st.c;
|
||||
|
||||
temp_pattern.data.uint = __strl2ui(ptr, len);
|
||||
test->flags = ACL_TEST_F_VOL_1ST;
|
||||
smp->flags = SMP_F_VOL_1ST;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* 4. Check on URL/URI. A pointer to the URI is stored. */
|
||||
static int
|
||||
acl_fetch_url(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
struct http_txn *txn = l7;
|
||||
|
||||
@ -7787,13 +7787,13 @@ acl_fetch_url(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
temp_pattern.data.str.str = txn->req.buf->p + txn->req.sol + txn->req.sl.rq.u;
|
||||
|
||||
/* we do not need to set READ_ONLY because the data is in a buffer */
|
||||
test->flags = ACL_TEST_F_VOL_1ST;
|
||||
smp->flags = SMP_F_VOL_1ST;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
acl_fetch_url_ip(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
struct http_txn *txn = l7;
|
||||
|
||||
@ -7813,13 +7813,13 @@ acl_fetch_url_ip(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
if (px->options & PR_O_HTTP_PROXY)
|
||||
l4->flags |= SN_ADDR_SET;
|
||||
|
||||
test->flags = 0;
|
||||
smp->flags = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
acl_fetch_url_port(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
struct http_txn *txn = l7;
|
||||
|
||||
@ -7832,7 +7832,7 @@ acl_fetch_url_port(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
if (px->options & PR_O_HTTP_PROXY)
|
||||
l4->flags |= SN_ADDR_SET;
|
||||
|
||||
test->flags = ACL_TEST_F_READ_ONLY;
|
||||
smp->flags = SMP_F_READ_ONLY;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -7841,11 +7841,11 @@ acl_fetch_url_port(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_hdr(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
struct http_txn *txn = l7;
|
||||
struct hdr_idx *idx = &txn->hdr_idx;
|
||||
struct hdr_ctx *ctx = (struct hdr_ctx *)test->ctx.a;
|
||||
struct hdr_ctx *ctx = (struct hdr_ctx *)smp->ctx.a;
|
||||
const struct http_msg *msg = ((dir & ACL_DIR_MASK) == ACL_DIR_REQ) ? &txn->req : &txn->rsp;
|
||||
|
||||
if (!expr->args || expr->args->type != ARGT_STR)
|
||||
@ -7853,21 +7853,21 @@ acl_fetch_hdr(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
|
||||
CHECK_HTTP_MESSAGE_FIRST();
|
||||
|
||||
if (!(test->flags & ACL_TEST_F_FETCH_MORE))
|
||||
if (!(smp->flags & SMP_F_NOT_LAST))
|
||||
/* search for header from the beginning */
|
||||
ctx->idx = 0;
|
||||
|
||||
if (http_find_header2(expr->args->data.str.str, expr->args->data.str.len, msg->buf->p + msg->sol, idx, ctx)) {
|
||||
test->flags |= ACL_TEST_F_FETCH_MORE;
|
||||
test->flags |= ACL_TEST_F_VOL_HDR;
|
||||
smp->flags |= SMP_F_NOT_LAST;
|
||||
smp->flags |= SMP_F_VOL_HDR;
|
||||
temp_pattern.data.str.str = (char *)ctx->line + ctx->val;
|
||||
temp_pattern.data.str.len = ctx->vlen;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
test->flags &= ~ACL_TEST_F_FETCH_MORE;
|
||||
test->flags |= ACL_TEST_F_VOL_HDR;
|
||||
smp->flags &= ~SMP_F_NOT_LAST;
|
||||
smp->flags |= SMP_F_VOL_HDR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -7876,7 +7876,7 @@ acl_fetch_hdr(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_hdr_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
struct http_txn *txn = l7;
|
||||
struct hdr_idx *idx = &txn->hdr_idx;
|
||||
@ -7895,7 +7895,7 @@ acl_fetch_hdr_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
cnt++;
|
||||
|
||||
temp_pattern.data.uint = cnt;
|
||||
test->flags = ACL_TEST_F_VOL_HDR;
|
||||
smp->flags = SMP_F_VOL_HDR;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -7904,9 +7904,9 @@ acl_fetch_hdr_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_hdr_val(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
int ret = acl_fetch_hdr(px, l4, l7, dir, expr, test);
|
||||
int ret = acl_fetch_hdr(px, l4, l7, dir, expr, smp);
|
||||
|
||||
if (ret > 0)
|
||||
temp_pattern.data.uint = strl2ic(temp_pattern.data.str.str, temp_pattern.data.str.len);
|
||||
@ -7918,11 +7918,11 @@ acl_fetch_hdr_val(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_hdr_ip(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
int ret;
|
||||
|
||||
while ((ret = acl_fetch_hdr(px, l4, l7, dir, expr, test)) > 0) {
|
||||
while ((ret = acl_fetch_hdr(px, l4, l7, dir, expr, smp)) > 0) {
|
||||
temp_pattern.type = SMP_T_IPV4;
|
||||
if (url2ipv4((char *)temp_pattern.data.str.str, &temp_pattern.data.ipv4))
|
||||
break;
|
||||
@ -7936,7 +7936,7 @@ acl_fetch_hdr_ip(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_path(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
struct http_txn *txn = l7;
|
||||
char *ptr, *end;
|
||||
@ -7957,13 +7957,13 @@ acl_fetch_path(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
temp_pattern.data.str.len = ptr - temp_pattern.data.str.str;
|
||||
|
||||
/* we do not need to set READ_ONLY because the data is in a buffer */
|
||||
test->flags = ACL_TEST_F_VOL_1ST;
|
||||
smp->flags = SMP_F_VOL_1ST;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
acl_fetch_proto_http(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
/* Note: hdr_idx.v cannot be NULL in this ACL because the ACL is tagged
|
||||
* as a layer7 ACL, which involves automatic allocation of hdr_idx.
|
||||
@ -7971,22 +7971,22 @@ acl_fetch_proto_http(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
|
||||
CHECK_HTTP_MESSAGE_FIRST();
|
||||
|
||||
test->flags |= ACL_TEST_F_SET_RES_PASS;
|
||||
smp->flags |= SMP_F_SET_RES_PASS;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* return a valid test if the current request is the first one on the connection */
|
||||
static int
|
||||
acl_fetch_http_first_req(struct proxy *px, struct session *s, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
if (!s)
|
||||
return 0;
|
||||
|
||||
if (s->txn.flags & TX_NOT_FIRST)
|
||||
test->flags |= ACL_TEST_F_SET_RES_FAIL;
|
||||
smp->flags |= SMP_F_SET_RES_FAIL;
|
||||
else
|
||||
test->flags |= ACL_TEST_F_SET_RES_PASS;
|
||||
smp->flags |= SMP_F_SET_RES_PASS;
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -7994,7 +7994,7 @@ acl_fetch_http_first_req(struct proxy *px, struct session *s, void *l7, int dir,
|
||||
/* Accepts exactly 1 argument of type userlist */
|
||||
static int
|
||||
acl_fetch_http_auth(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
|
||||
if (!expr->args || expr->args->type != ARGT_USR)
|
||||
@ -8006,9 +8006,9 @@ acl_fetch_http_auth(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
return 0;
|
||||
|
||||
if (check_user(expr->args->data.usr, 0, l4->txn.auth.user, l4->txn.auth.pass))
|
||||
test->flags |= ACL_TEST_F_SET_RES_PASS;
|
||||
smp->flags |= SMP_F_SET_RES_PASS;
|
||||
else
|
||||
test->flags |= ACL_TEST_F_SET_RES_FAIL;
|
||||
smp->flags |= SMP_F_SET_RES_FAIL;
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -8109,19 +8109,19 @@ extract_cookie_value(char *hdr, const char *hdr_end,
|
||||
}
|
||||
|
||||
/* Iterate over all cookies present in a message. The context is stored in
|
||||
* test->ctx.a[0] for the in-header position, test->ctx.a[1] for the
|
||||
* end-of-header-value, and test->ctx.a[2] for the hdr_idx. Depending on
|
||||
* smp->ctx.a[0] for the in-header position, smp->ctx.a[1] for the
|
||||
* end-of-header-value, and smp->ctx.a[2] for the hdr_idx. Depending on
|
||||
* the direction, multiple cookies may be parsed on the same line or not.
|
||||
* The cookie name is in expr->arg and the name length in expr->args->data.str.len.
|
||||
* Accepts exactly 1 argument of type string.
|
||||
*/
|
||||
static int
|
||||
acl_fetch_cookie_value(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
struct http_txn *txn = l7;
|
||||
struct hdr_idx *idx = &txn->hdr_idx;
|
||||
struct hdr_ctx *ctx = (struct hdr_ctx *)&test->ctx.a[2];
|
||||
struct hdr_ctx *ctx = (struct hdr_ctx *)&smp->ctx.a[2];
|
||||
const struct http_msg *msg;
|
||||
const char *hdr_name;
|
||||
int hdr_name_len;
|
||||
@ -8143,43 +8143,43 @@ acl_fetch_cookie_value(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
}
|
||||
|
||||
sol = msg->buf->p + msg->sol;
|
||||
if (!(test->flags & ACL_TEST_F_FETCH_MORE)) {
|
||||
if (!(smp->flags & SMP_F_NOT_LAST)) {
|
||||
/* search for the header from the beginning, we must first initialize
|
||||
* the search parameters.
|
||||
*/
|
||||
test->ctx.a[0] = NULL;
|
||||
smp->ctx.a[0] = NULL;
|
||||
ctx->idx = 0;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
/* Note: test->ctx.a[0] == NULL every time we need to fetch a new header */
|
||||
if (!test->ctx.a[0]) {
|
||||
/* Note: smp->ctx.a[0] == NULL every time we need to fetch a new header */
|
||||
if (!smp->ctx.a[0]) {
|
||||
if (!http_find_header2(hdr_name, hdr_name_len, sol, idx, ctx))
|
||||
goto out;
|
||||
|
||||
if (ctx->vlen < expr->args->data.str.len + 1)
|
||||
continue;
|
||||
|
||||
test->ctx.a[0] = ctx->line + ctx->val;
|
||||
test->ctx.a[1] = test->ctx.a[0] + ctx->vlen;
|
||||
smp->ctx.a[0] = ctx->line + ctx->val;
|
||||
smp->ctx.a[1] = smp->ctx.a[0] + ctx->vlen;
|
||||
}
|
||||
|
||||
test->ctx.a[0] = extract_cookie_value(test->ctx.a[0], test->ctx.a[1],
|
||||
expr->args->data.str.str, expr->args->data.str.len,
|
||||
(dir & ACL_DIR_MASK) == ACL_DIR_REQ,
|
||||
&temp_pattern.data.str.str,
|
||||
&temp_pattern.data.str.len);
|
||||
if (test->ctx.a[0]) {
|
||||
smp->ctx.a[0] = extract_cookie_value(smp->ctx.a[0], smp->ctx.a[1],
|
||||
expr->args->data.str.str, expr->args->data.str.len,
|
||||
(dir & ACL_DIR_MASK) == ACL_DIR_REQ,
|
||||
&temp_pattern.data.str.str,
|
||||
&temp_pattern.data.str.len);
|
||||
if (smp->ctx.a[0]) {
|
||||
/* one value was returned into temp_pattern.data.str.{str,len} */
|
||||
test->flags |= ACL_TEST_F_FETCH_MORE;
|
||||
test->flags |= ACL_TEST_F_VOL_HDR;
|
||||
smp->flags |= SMP_F_NOT_LAST;
|
||||
smp->flags |= SMP_F_VOL_HDR;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
test->flags &= ~ACL_TEST_F_FETCH_MORE;
|
||||
test->flags |= ACL_TEST_F_VOL_HDR;
|
||||
smp->flags &= ~SMP_F_NOT_LAST;
|
||||
smp->flags |= SMP_F_VOL_HDR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -8190,7 +8190,7 @@ acl_fetch_cookie_value(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_cookie_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
struct http_txn *txn = l7;
|
||||
struct hdr_idx *idx = &txn->hdr_idx;
|
||||
@ -8245,7 +8245,7 @@ acl_fetch_cookie_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
}
|
||||
|
||||
temp_pattern.data.uint = cnt;
|
||||
test->flags |= ACL_TEST_F_VOL_HDR;
|
||||
smp->flags |= SMP_F_VOL_HDR;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1254,7 +1254,7 @@ static int tcp_parse_tcp_req(char **args, int section_type, struct proxy *curpx,
|
||||
/* copy the source IPv4/v6 address into temp_pattern */
|
||||
static int
|
||||
acl_fetch_src(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
switch (l4->si[0].addr.from.ss_family) {
|
||||
case AF_INET:
|
||||
@ -1269,7 +1269,7 @@ acl_fetch_src(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
return 0;
|
||||
}
|
||||
|
||||
test->flags = 0;
|
||||
smp->flags = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1300,12 +1300,12 @@ pattern_fetch_src6(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
/* set temp integer to the connection's source port */
|
||||
static int
|
||||
acl_fetch_sport(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
if (!(temp_pattern.data.uint = get_host_port(&l4->si[0].addr.from)))
|
||||
return 0;
|
||||
|
||||
test->flags = 0;
|
||||
smp->flags = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1313,7 +1313,7 @@ acl_fetch_sport(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
/* set test->ptr to point to the frontend's IPv4/IPv6 address and test->i to the family */
|
||||
static int
|
||||
acl_fetch_dst(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
stream_sock_get_to_addr(&l4->si[0]);
|
||||
|
||||
@ -1330,7 +1330,7 @@ acl_fetch_dst(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
return 0;
|
||||
}
|
||||
|
||||
test->flags = 0;
|
||||
smp->flags = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1366,14 +1366,14 @@ pattern_fetch_dst6(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
/* set temp integer to the frontend connexion's destination port */
|
||||
static int
|
||||
acl_fetch_dport(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
stream_sock_get_to_addr(&l4->si[0]);
|
||||
|
||||
if (!(temp_pattern.data.uint = get_host_port(&l4->si[0].addr.to)))
|
||||
return 0;
|
||||
|
||||
test->flags = 0;
|
||||
smp->flags = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1469,14 +1469,14 @@ pattern_fetch_rdp_cookie(struct proxy *px, struct session *l4, void *l7, int dir
|
||||
{
|
||||
int ret;
|
||||
struct acl_expr expr;
|
||||
struct acl_test test;
|
||||
struct sample smp;
|
||||
struct arg args[2];
|
||||
|
||||
if (!l4)
|
||||
return 0;
|
||||
|
||||
memset(&expr, 0, sizeof(expr));
|
||||
memset(&test, 0, sizeof(test));
|
||||
memset(&smp, 0, sizeof(smp));
|
||||
|
||||
args[0].type = ARGT_STR;
|
||||
args[0].data.str.str = arg_p[0].data.str.str;
|
||||
@ -1485,8 +1485,8 @@ pattern_fetch_rdp_cookie(struct proxy *px, struct session *l4, void *l7, int dir
|
||||
|
||||
expr.args = args;
|
||||
|
||||
ret = acl_fetch_rdp_cookie(px, l4, NULL, ACL_DIR_REQ, &expr, &test);
|
||||
if (ret == 0 || (test.flags & ACL_TEST_F_MAY_CHANGE) || temp_pattern.data.str.len == 0)
|
||||
ret = acl_fetch_rdp_cookie(px, l4, NULL, ACL_DIR_REQ, &expr, &smp);
|
||||
if (ret == 0 || (smp.flags & SMP_F_MAY_CHANGE) || temp_pattern.data.str.len == 0)
|
||||
return 0;
|
||||
|
||||
data->str = temp_pattern.data.str;
|
||||
|
@ -326,7 +326,7 @@ int protocol_disable_all(void)
|
||||
/* set temp integer to the number of connexions to the same listening socket */
|
||||
static int
|
||||
acl_fetch_dconn(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
temp_pattern.data.uint = l4->listener->nbconn;
|
||||
return 1;
|
||||
@ -335,9 +335,9 @@ acl_fetch_dconn(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
/* set temp integer to the id of the socket (listener) */
|
||||
static int
|
||||
acl_fetch_so_id(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test) {
|
||||
|
||||
test->flags = ACL_TEST_F_READ_ONLY;
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
smp->flags = SMP_F_READ_ONLY;
|
||||
temp_pattern.data.uint = l4->listener->luid;
|
||||
return 1;
|
||||
}
|
||||
|
268
src/session.c
268
src/session.c
@ -2308,9 +2308,9 @@ void session_shutdown(struct session *session, int why)
|
||||
|
||||
/* set temp integer to the General Purpose Counter 0 value in the stksess entry <ts> */
|
||||
static int
|
||||
acl_fetch_get_gpc0(struct stktable *table, struct acl_test *test, struct stksess *ts)
|
||||
acl_fetch_get_gpc0(struct stktable *table, struct sample *smp, struct stksess *ts)
|
||||
{
|
||||
test->flags = ACL_TEST_F_VOL_TEST;
|
||||
smp->flags = SMP_F_VOL_TEST;
|
||||
temp_pattern.data.uint = 0;
|
||||
if (ts != NULL) {
|
||||
void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_GPC0);
|
||||
@ -2326,11 +2326,11 @@ acl_fetch_get_gpc0(struct stktable *table, struct acl_test *test, struct stksess
|
||||
*/
|
||||
static int
|
||||
acl_fetch_sc1_get_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr1_entry)
|
||||
return 0;
|
||||
return acl_fetch_get_gpc0(l4->stkctr1_table, test, l4->stkctr1_entry);
|
||||
return acl_fetch_get_gpc0(l4->stkctr1_table, smp, l4->stkctr1_entry);
|
||||
}
|
||||
|
||||
/* set temp integer to the General Purpose Counter 0 value from the session's tracked
|
||||
@ -2338,11 +2338,11 @@ acl_fetch_sc1_get_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_sc2_get_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr2_entry)
|
||||
return 0;
|
||||
return acl_fetch_get_gpc0(l4->stkctr2_table, test, l4->stkctr2_entry);
|
||||
return acl_fetch_get_gpc0(l4->stkctr2_table, smp, l4->stkctr2_entry);
|
||||
}
|
||||
|
||||
/* set temp integer to the General Purpose Counter 0 value from the session's source
|
||||
@ -2351,7 +2351,7 @@ acl_fetch_sc2_get_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_src_get_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
struct stktable_key *key;
|
||||
|
||||
@ -2360,16 +2360,16 @@ acl_fetch_src_get_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
return 0;
|
||||
|
||||
px = expr->args->data.prx;
|
||||
return acl_fetch_get_gpc0(&px->table, test, stktable_lookup_key(&px->table, key));
|
||||
return acl_fetch_get_gpc0(&px->table, smp, stktable_lookup_key(&px->table, key));
|
||||
}
|
||||
|
||||
/* Increment the General Purpose Counter 0 value in the stksess entry <ts> and
|
||||
* return it into temp integer.
|
||||
*/
|
||||
static int
|
||||
acl_fetch_inc_gpc0(struct stktable *table, struct acl_test *test, struct stksess *ts)
|
||||
acl_fetch_inc_gpc0(struct stktable *table, struct sample *smp, struct stksess *ts)
|
||||
{
|
||||
test->flags = ACL_TEST_F_VOL_TEST;
|
||||
smp->flags = SMP_F_VOL_TEST;
|
||||
temp_pattern.data.uint = 0;
|
||||
if (ts != NULL) {
|
||||
void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_GPC0);
|
||||
@ -2385,11 +2385,11 @@ acl_fetch_inc_gpc0(struct stktable *table, struct acl_test *test, struct stksess
|
||||
*/
|
||||
static int
|
||||
acl_fetch_sc1_inc_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr1_entry)
|
||||
return 0;
|
||||
return acl_fetch_inc_gpc0(l4->stkctr1_table, test, l4->stkctr1_entry);
|
||||
return acl_fetch_inc_gpc0(l4->stkctr1_table, smp, l4->stkctr1_entry);
|
||||
}
|
||||
|
||||
/* Increment the General Purpose Counter 0 value from the session's tracked
|
||||
@ -2397,11 +2397,11 @@ acl_fetch_sc1_inc_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_sc2_inc_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr2_entry)
|
||||
return 0;
|
||||
return acl_fetch_inc_gpc0(l4->stkctr2_table, test, l4->stkctr2_entry);
|
||||
return acl_fetch_inc_gpc0(l4->stkctr2_table, smp, l4->stkctr2_entry);
|
||||
}
|
||||
|
||||
/* Increment the General Purpose Counter 0 value from the session's source
|
||||
@ -2410,7 +2410,7 @@ acl_fetch_sc2_inc_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_src_inc_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
struct stktable_key *key;
|
||||
|
||||
@ -2419,16 +2419,16 @@ acl_fetch_src_inc_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
return 0;
|
||||
|
||||
px = expr->args->data.prx;
|
||||
return acl_fetch_inc_gpc0(&px->table, test, stktable_update_key(&px->table, key));
|
||||
return acl_fetch_inc_gpc0(&px->table, smp, stktable_update_key(&px->table, key));
|
||||
}
|
||||
|
||||
/* Clear the General Purpose Counter 0 value in the stksess entry <ts> and
|
||||
* return its previous value into temp integer.
|
||||
*/
|
||||
static int
|
||||
acl_fetch_clr_gpc0(struct stktable *table, struct acl_test *test, struct stksess *ts)
|
||||
acl_fetch_clr_gpc0(struct stktable *table, struct sample *smp, struct stksess *ts)
|
||||
{
|
||||
test->flags = ACL_TEST_F_VOL_TEST;
|
||||
smp->flags = SMP_F_VOL_TEST;
|
||||
temp_pattern.data.uint = 0;
|
||||
if (ts != NULL) {
|
||||
void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_GPC0);
|
||||
@ -2445,11 +2445,11 @@ acl_fetch_clr_gpc0(struct stktable *table, struct acl_test *test, struct stksess
|
||||
*/
|
||||
static int
|
||||
acl_fetch_sc1_clr_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr1_entry)
|
||||
return 0;
|
||||
return acl_fetch_clr_gpc0(l4->stkctr1_table, test, l4->stkctr1_entry);
|
||||
return acl_fetch_clr_gpc0(l4->stkctr1_table, smp, l4->stkctr1_entry);
|
||||
}
|
||||
|
||||
/* Clear the General Purpose Counter 0 value from the session's tracked
|
||||
@ -2457,11 +2457,11 @@ acl_fetch_sc1_clr_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_sc2_clr_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr2_entry)
|
||||
return 0;
|
||||
return acl_fetch_clr_gpc0(l4->stkctr2_table, test, l4->stkctr2_entry);
|
||||
return acl_fetch_clr_gpc0(l4->stkctr2_table, smp, l4->stkctr2_entry);
|
||||
}
|
||||
|
||||
/* Clear the General Purpose Counter 0 value from the session's source address
|
||||
@ -2470,7 +2470,7 @@ acl_fetch_sc2_clr_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_src_clr_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
struct stktable_key *key;
|
||||
|
||||
@ -2479,14 +2479,14 @@ acl_fetch_src_clr_gpc0(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
return 0;
|
||||
|
||||
px = expr->args->data.prx;
|
||||
return acl_fetch_clr_gpc0(&px->table, test, stktable_update_key(&px->table, key));
|
||||
return acl_fetch_clr_gpc0(&px->table, smp, stktable_update_key(&px->table, key));
|
||||
}
|
||||
|
||||
/* set temp integer to the cumulated number of connections in the stksess entry <ts> */
|
||||
static int
|
||||
acl_fetch_conn_cnt(struct stktable *table, struct acl_test *test, struct stksess *ts)
|
||||
acl_fetch_conn_cnt(struct stktable *table, struct sample *smp, struct stksess *ts)
|
||||
{
|
||||
test->flags = ACL_TEST_F_VOL_TEST;
|
||||
smp->flags = SMP_F_VOL_TEST;
|
||||
temp_pattern.data.uint = 0;
|
||||
if (ts != NULL) {
|
||||
void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_CONN_CNT);
|
||||
@ -2500,23 +2500,23 @@ acl_fetch_conn_cnt(struct stktable *table, struct acl_test *test, struct stksess
|
||||
/* set temp integer to the cumulated number of connections from the session's tracked FE counters */
|
||||
static int
|
||||
acl_fetch_sc1_conn_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr1_entry)
|
||||
return 0;
|
||||
|
||||
return acl_fetch_conn_cnt(l4->stkctr1_table, test, l4->stkctr1_entry);
|
||||
return acl_fetch_conn_cnt(l4->stkctr1_table, smp, l4->stkctr1_entry);
|
||||
}
|
||||
|
||||
/* set temp integer to the cumulated number of connections from the session's tracked BE counters */
|
||||
static int
|
||||
acl_fetch_sc2_conn_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr2_entry)
|
||||
return 0;
|
||||
|
||||
return acl_fetch_conn_cnt(l4->stkctr2_table, test, l4->stkctr2_entry);
|
||||
return acl_fetch_conn_cnt(l4->stkctr2_table, smp, l4->stkctr2_entry);
|
||||
}
|
||||
|
||||
/* set temp integer to the cumulated number of connections from the session's source
|
||||
@ -2525,7 +2525,7 @@ acl_fetch_sc2_conn_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_src_conn_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
struct stktable_key *key;
|
||||
|
||||
@ -2534,14 +2534,14 @@ acl_fetch_src_conn_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
return 0;
|
||||
|
||||
px = expr->args->data.prx;
|
||||
return acl_fetch_conn_cnt(&px->table, test, stktable_lookup_key(&px->table, key));
|
||||
return acl_fetch_conn_cnt(&px->table, smp, stktable_lookup_key(&px->table, key));
|
||||
}
|
||||
|
||||
/* set temp integer to the connection rate in the stksess entry <ts> over the configured period */
|
||||
static int
|
||||
acl_fetch_conn_rate(struct stktable *table, struct acl_test *test, struct stksess *ts)
|
||||
acl_fetch_conn_rate(struct stktable *table, struct sample *smp, struct stksess *ts)
|
||||
{
|
||||
test->flags = ACL_TEST_F_VOL_TEST;
|
||||
smp->flags = SMP_F_VOL_TEST;
|
||||
temp_pattern.data.uint = 0;
|
||||
if (ts != NULL) {
|
||||
void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_CONN_RATE);
|
||||
@ -2558,12 +2558,12 @@ acl_fetch_conn_rate(struct stktable *table, struct acl_test *test, struct stkses
|
||||
*/
|
||||
static int
|
||||
acl_fetch_sc1_conn_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr1_entry)
|
||||
return 0;
|
||||
|
||||
return acl_fetch_conn_rate(l4->stkctr1_table, test, l4->stkctr1_entry);
|
||||
return acl_fetch_conn_rate(l4->stkctr1_table, smp, l4->stkctr1_entry);
|
||||
}
|
||||
|
||||
/* set temp integer to the connection rate from the session's tracked BE counters over
|
||||
@ -2571,12 +2571,12 @@ acl_fetch_sc1_conn_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_sc2_conn_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr2_entry)
|
||||
return 0;
|
||||
|
||||
return acl_fetch_conn_rate(l4->stkctr2_table, test, l4->stkctr2_entry);
|
||||
return acl_fetch_conn_rate(l4->stkctr2_table, smp, l4->stkctr2_entry);
|
||||
}
|
||||
|
||||
/* set temp integer to the connection rate from the session's source address in the
|
||||
@ -2585,7 +2585,7 @@ acl_fetch_sc2_conn_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_src_conn_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
struct stktable_key *key;
|
||||
|
||||
@ -2594,7 +2594,7 @@ acl_fetch_src_conn_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
return 0;
|
||||
|
||||
px = expr->args->data.prx;
|
||||
return acl_fetch_conn_rate(&px->table, test, stktable_lookup_key(&px->table, key));
|
||||
return acl_fetch_conn_rate(&px->table, smp, stktable_lookup_key(&px->table, key));
|
||||
}
|
||||
|
||||
/* set temp integer to the number of connections from the session's source address
|
||||
@ -2603,7 +2603,7 @@ acl_fetch_src_conn_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_src_updt_conn_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
struct stksess *ts;
|
||||
struct stktable_key *key;
|
||||
@ -2624,15 +2624,15 @@ acl_fetch_src_updt_conn_cnt(struct proxy *px, struct session *l4, void *l7, int
|
||||
return 0; /* parameter not stored in this table */
|
||||
|
||||
temp_pattern.data.uint = ++stktable_data_cast(ptr, conn_cnt);
|
||||
test->flags = ACL_TEST_F_VOL_TEST;
|
||||
smp->flags = SMP_F_VOL_TEST;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* set temp integer to the number of concurrent connections in the stksess entry <ts> */
|
||||
static int
|
||||
acl_fetch_conn_cur(struct stktable *table, struct acl_test *test, struct stksess *ts)
|
||||
acl_fetch_conn_cur(struct stktable *table, struct sample *smp, struct stksess *ts)
|
||||
{
|
||||
test->flags = ACL_TEST_F_VOL_TEST;
|
||||
smp->flags = SMP_F_VOL_TEST;
|
||||
temp_pattern.data.uint = 0;
|
||||
|
||||
if (ts != NULL) {
|
||||
@ -2647,23 +2647,23 @@ acl_fetch_conn_cur(struct stktable *table, struct acl_test *test, struct stksess
|
||||
/* set temp integer to the number of concurrent connections from the session's tracked FE counters */
|
||||
static int
|
||||
acl_fetch_sc1_conn_cur(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr1_entry)
|
||||
return 0;
|
||||
|
||||
return acl_fetch_conn_cur(l4->stkctr1_table, test, l4->stkctr1_entry);
|
||||
return acl_fetch_conn_cur(l4->stkctr1_table, smp, l4->stkctr1_entry);
|
||||
}
|
||||
|
||||
/* set temp integer to the number of concurrent connections from the session's tracked BE counters */
|
||||
static int
|
||||
acl_fetch_sc2_conn_cur(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr2_entry)
|
||||
return 0;
|
||||
|
||||
return acl_fetch_conn_cur(l4->stkctr2_table, test, l4->stkctr2_entry);
|
||||
return acl_fetch_conn_cur(l4->stkctr2_table, smp, l4->stkctr2_entry);
|
||||
}
|
||||
|
||||
/* set temp integer to the number of concurrent connections from the session's source
|
||||
@ -2672,7 +2672,7 @@ acl_fetch_sc2_conn_cur(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_src_conn_cur(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
struct stktable_key *key;
|
||||
|
||||
@ -2681,14 +2681,14 @@ acl_fetch_src_conn_cur(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
return 0;
|
||||
|
||||
px = expr->args->data.prx;
|
||||
return acl_fetch_conn_cur(&px->table, test, stktable_lookup_key(&px->table, key));
|
||||
return acl_fetch_conn_cur(&px->table, smp, stktable_lookup_key(&px->table, key));
|
||||
}
|
||||
|
||||
/* set temp integer to the cumulated number of sessions in the stksess entry <ts> */
|
||||
static int
|
||||
acl_fetch_sess_cnt(struct stktable *table, struct acl_test *test, struct stksess *ts)
|
||||
acl_fetch_sess_cnt(struct stktable *table, struct sample *smp, struct stksess *ts)
|
||||
{
|
||||
test->flags = ACL_TEST_F_VOL_TEST;
|
||||
smp->flags = SMP_F_VOL_TEST;
|
||||
temp_pattern.data.uint = 0;
|
||||
if (ts != NULL) {
|
||||
void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_SESS_CNT);
|
||||
@ -2702,23 +2702,23 @@ acl_fetch_sess_cnt(struct stktable *table, struct acl_test *test, struct stksess
|
||||
/* set temp integer to the cumulated number of sessions from the session's tracked FE counters */
|
||||
static int
|
||||
acl_fetch_sc1_sess_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr1_entry)
|
||||
return 0;
|
||||
|
||||
return acl_fetch_sess_cnt(l4->stkctr1_table, test, l4->stkctr1_entry);
|
||||
return acl_fetch_sess_cnt(l4->stkctr1_table, smp, l4->stkctr1_entry);
|
||||
}
|
||||
|
||||
/* set temp integer to the cumulated number of sessions from the session's tracked BE counters */
|
||||
static int
|
||||
acl_fetch_sc2_sess_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr2_entry)
|
||||
return 0;
|
||||
|
||||
return acl_fetch_sess_cnt(l4->stkctr2_table, test, l4->stkctr2_entry);
|
||||
return acl_fetch_sess_cnt(l4->stkctr2_table, smp, l4->stkctr2_entry);
|
||||
}
|
||||
|
||||
/* set temp integer to the cumulated number of session from the session's source
|
||||
@ -2727,7 +2727,7 @@ acl_fetch_sc2_sess_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_src_sess_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
struct stktable_key *key;
|
||||
|
||||
@ -2736,14 +2736,14 @@ acl_fetch_src_sess_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
return 0;
|
||||
|
||||
px = expr->args->data.prx;
|
||||
return acl_fetch_sess_cnt(&px->table, test, stktable_lookup_key(&px->table, key));
|
||||
return acl_fetch_sess_cnt(&px->table, smp, stktable_lookup_key(&px->table, key));
|
||||
}
|
||||
|
||||
/* set temp integer to the session rate in the stksess entry <ts> over the configured period */
|
||||
static int
|
||||
acl_fetch_sess_rate(struct stktable *table, struct acl_test *test, struct stksess *ts)
|
||||
acl_fetch_sess_rate(struct stktable *table, struct sample *smp, struct stksess *ts)
|
||||
{
|
||||
test->flags = ACL_TEST_F_VOL_TEST;
|
||||
smp->flags = SMP_F_VOL_TEST;
|
||||
temp_pattern.data.uint = 0;
|
||||
if (ts != NULL) {
|
||||
void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_SESS_RATE);
|
||||
@ -2760,12 +2760,12 @@ acl_fetch_sess_rate(struct stktable *table, struct acl_test *test, struct stkses
|
||||
*/
|
||||
static int
|
||||
acl_fetch_sc1_sess_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr1_entry)
|
||||
return 0;
|
||||
|
||||
return acl_fetch_sess_rate(l4->stkctr1_table, test, l4->stkctr1_entry);
|
||||
return acl_fetch_sess_rate(l4->stkctr1_table, smp, l4->stkctr1_entry);
|
||||
}
|
||||
|
||||
/* set temp integer to the session rate from the session's tracked BE counters over
|
||||
@ -2773,12 +2773,12 @@ acl_fetch_sc1_sess_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_sc2_sess_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr2_entry)
|
||||
return 0;
|
||||
|
||||
return acl_fetch_sess_rate(l4->stkctr2_table, test, l4->stkctr2_entry);
|
||||
return acl_fetch_sess_rate(l4->stkctr2_table, smp, l4->stkctr2_entry);
|
||||
}
|
||||
|
||||
/* set temp integer to the session rate from the session's source address in the
|
||||
@ -2787,7 +2787,7 @@ acl_fetch_sc2_sess_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_src_sess_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
struct stktable_key *key;
|
||||
|
||||
@ -2796,14 +2796,14 @@ acl_fetch_src_sess_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
return 0;
|
||||
|
||||
px = expr->args->data.prx;
|
||||
return acl_fetch_sess_rate(&px->table, test, stktable_lookup_key(&px->table, key));
|
||||
return acl_fetch_sess_rate(&px->table, smp, stktable_lookup_key(&px->table, key));
|
||||
}
|
||||
|
||||
/* set temp integer to the cumulated number of sessions in the stksess entry <ts> */
|
||||
static int
|
||||
acl_fetch_http_req_cnt(struct stktable *table, struct acl_test *test, struct stksess *ts)
|
||||
acl_fetch_http_req_cnt(struct stktable *table, struct sample *smp, struct stksess *ts)
|
||||
{
|
||||
test->flags = ACL_TEST_F_VOL_TEST;
|
||||
smp->flags = SMP_F_VOL_TEST;
|
||||
temp_pattern.data.uint = 0;
|
||||
if (ts != NULL) {
|
||||
void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_HTTP_REQ_CNT);
|
||||
@ -2817,23 +2817,23 @@ acl_fetch_http_req_cnt(struct stktable *table, struct acl_test *test, struct stk
|
||||
/* set temp integer to the cumulated number of sessions from the session's tracked FE counters */
|
||||
static int
|
||||
acl_fetch_sc1_http_req_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr1_entry)
|
||||
return 0;
|
||||
|
||||
return acl_fetch_http_req_cnt(l4->stkctr1_table, test, l4->stkctr1_entry);
|
||||
return acl_fetch_http_req_cnt(l4->stkctr1_table, smp, l4->stkctr1_entry);
|
||||
}
|
||||
|
||||
/* set temp integer to the cumulated number of sessions from the session's tracked BE counters */
|
||||
static int
|
||||
acl_fetch_sc2_http_req_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr2_entry)
|
||||
return 0;
|
||||
|
||||
return acl_fetch_http_req_cnt(l4->stkctr2_table, test, l4->stkctr2_entry);
|
||||
return acl_fetch_http_req_cnt(l4->stkctr2_table, smp, l4->stkctr2_entry);
|
||||
}
|
||||
|
||||
/* set temp integer to the cumulated number of session from the session's source
|
||||
@ -2842,7 +2842,7 @@ acl_fetch_sc2_http_req_cnt(struct proxy *px, struct session *l4, void *l7, int d
|
||||
*/
|
||||
static int
|
||||
acl_fetch_src_http_req_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
struct stktable_key *key;
|
||||
|
||||
@ -2851,14 +2851,14 @@ acl_fetch_src_http_req_cnt(struct proxy *px, struct session *l4, void *l7, int d
|
||||
return 0;
|
||||
|
||||
px = expr->args->data.prx;
|
||||
return acl_fetch_http_req_cnt(&px->table, test, stktable_lookup_key(&px->table, key));
|
||||
return acl_fetch_http_req_cnt(&px->table, smp, stktable_lookup_key(&px->table, key));
|
||||
}
|
||||
|
||||
/* set temp integer to the session rate in the stksess entry <ts> over the configured period */
|
||||
static int
|
||||
acl_fetch_http_req_rate(struct stktable *table, struct acl_test *test, struct stksess *ts)
|
||||
acl_fetch_http_req_rate(struct stktable *table, struct sample *smp, struct stksess *ts)
|
||||
{
|
||||
test->flags = ACL_TEST_F_VOL_TEST;
|
||||
smp->flags = SMP_F_VOL_TEST;
|
||||
temp_pattern.data.uint = 0;
|
||||
if (ts != NULL) {
|
||||
void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_HTTP_REQ_RATE);
|
||||
@ -2875,12 +2875,12 @@ acl_fetch_http_req_rate(struct stktable *table, struct acl_test *test, struct st
|
||||
*/
|
||||
static int
|
||||
acl_fetch_sc1_http_req_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr1_entry)
|
||||
return 0;
|
||||
|
||||
return acl_fetch_http_req_rate(l4->stkctr1_table, test, l4->stkctr1_entry);
|
||||
return acl_fetch_http_req_rate(l4->stkctr1_table, smp, l4->stkctr1_entry);
|
||||
}
|
||||
|
||||
/* set temp integer to the session rate from the session's tracked BE counters over
|
||||
@ -2888,12 +2888,12 @@ acl_fetch_sc1_http_req_rate(struct proxy *px, struct session *l4, void *l7, int
|
||||
*/
|
||||
static int
|
||||
acl_fetch_sc2_http_req_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr2_entry)
|
||||
return 0;
|
||||
|
||||
return acl_fetch_http_req_rate(l4->stkctr2_table, test, l4->stkctr2_entry);
|
||||
return acl_fetch_http_req_rate(l4->stkctr2_table, smp, l4->stkctr2_entry);
|
||||
}
|
||||
|
||||
/* set temp integer to the session rate from the session's source address in the
|
||||
@ -2902,7 +2902,7 @@ acl_fetch_sc2_http_req_rate(struct proxy *px, struct session *l4, void *l7, int
|
||||
*/
|
||||
static int
|
||||
acl_fetch_src_http_req_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
struct stktable_key *key;
|
||||
|
||||
@ -2911,14 +2911,14 @@ acl_fetch_src_http_req_rate(struct proxy *px, struct session *l4, void *l7, int
|
||||
return 0;
|
||||
|
||||
px = expr->args->data.prx;
|
||||
return acl_fetch_http_req_rate(&px->table, test, stktable_lookup_key(&px->table, key));
|
||||
return acl_fetch_http_req_rate(&px->table, smp, stktable_lookup_key(&px->table, key));
|
||||
}
|
||||
|
||||
/* set temp integer to the cumulated number of sessions in the stksess entry <ts> */
|
||||
static int
|
||||
acl_fetch_http_err_cnt(struct stktable *table, struct acl_test *test, struct stksess *ts)
|
||||
acl_fetch_http_err_cnt(struct stktable *table, struct sample *smp, struct stksess *ts)
|
||||
{
|
||||
test->flags = ACL_TEST_F_VOL_TEST;
|
||||
smp->flags = SMP_F_VOL_TEST;
|
||||
temp_pattern.data.uint = 0;
|
||||
if (ts != NULL) {
|
||||
void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_HTTP_ERR_CNT);
|
||||
@ -2932,23 +2932,23 @@ acl_fetch_http_err_cnt(struct stktable *table, struct acl_test *test, struct stk
|
||||
/* set temp integer to the cumulated number of sessions from the session's tracked FE counters */
|
||||
static int
|
||||
acl_fetch_sc1_http_err_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr1_entry)
|
||||
return 0;
|
||||
|
||||
return acl_fetch_http_err_cnt(l4->stkctr1_table, test, l4->stkctr1_entry);
|
||||
return acl_fetch_http_err_cnt(l4->stkctr1_table, smp, l4->stkctr1_entry);
|
||||
}
|
||||
|
||||
/* set temp integer to the cumulated number of sessions from the session's tracked BE counters */
|
||||
static int
|
||||
acl_fetch_sc2_http_err_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr2_entry)
|
||||
return 0;
|
||||
|
||||
return acl_fetch_http_err_cnt(l4->stkctr2_table, test, l4->stkctr2_entry);
|
||||
return acl_fetch_http_err_cnt(l4->stkctr2_table, smp, l4->stkctr2_entry);
|
||||
}
|
||||
|
||||
/* set temp integer to the cumulated number of session from the session's source
|
||||
@ -2957,7 +2957,7 @@ acl_fetch_sc2_http_err_cnt(struct proxy *px, struct session *l4, void *l7, int d
|
||||
*/
|
||||
static int
|
||||
acl_fetch_src_http_err_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
struct stktable_key *key;
|
||||
|
||||
@ -2966,14 +2966,14 @@ acl_fetch_src_http_err_cnt(struct proxy *px, struct session *l4, void *l7, int d
|
||||
return 0;
|
||||
|
||||
px = expr->args->data.prx;
|
||||
return acl_fetch_http_err_cnt(&px->table, test, stktable_lookup_key(&px->table, key));
|
||||
return acl_fetch_http_err_cnt(&px->table, smp, stktable_lookup_key(&px->table, key));
|
||||
}
|
||||
|
||||
/* set temp integer to the session rate in the stksess entry <ts> over the configured period */
|
||||
static int
|
||||
acl_fetch_http_err_rate(struct stktable *table, struct acl_test *test, struct stksess *ts)
|
||||
acl_fetch_http_err_rate(struct stktable *table, struct sample *smp, struct stksess *ts)
|
||||
{
|
||||
test->flags = ACL_TEST_F_VOL_TEST;
|
||||
smp->flags = SMP_F_VOL_TEST;
|
||||
temp_pattern.data.uint = 0;
|
||||
if (ts != NULL) {
|
||||
void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_HTTP_ERR_RATE);
|
||||
@ -2990,12 +2990,12 @@ acl_fetch_http_err_rate(struct stktable *table, struct acl_test *test, struct st
|
||||
*/
|
||||
static int
|
||||
acl_fetch_sc1_http_err_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr1_entry)
|
||||
return 0;
|
||||
|
||||
return acl_fetch_http_err_rate(l4->stkctr1_table, test, l4->stkctr1_entry);
|
||||
return acl_fetch_http_err_rate(l4->stkctr1_table, smp, l4->stkctr1_entry);
|
||||
}
|
||||
|
||||
/* set temp integer to the session rate from the session's tracked BE counters over
|
||||
@ -3003,12 +3003,12 @@ acl_fetch_sc1_http_err_rate(struct proxy *px, struct session *l4, void *l7, int
|
||||
*/
|
||||
static int
|
||||
acl_fetch_sc2_http_err_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr2_entry)
|
||||
return 0;
|
||||
|
||||
return acl_fetch_http_err_rate(l4->stkctr2_table, test, l4->stkctr2_entry);
|
||||
return acl_fetch_http_err_rate(l4->stkctr2_table, smp, l4->stkctr2_entry);
|
||||
}
|
||||
|
||||
/* set temp integer to the session rate from the session's source address in the
|
||||
@ -3017,7 +3017,7 @@ acl_fetch_sc2_http_err_rate(struct proxy *px, struct session *l4, void *l7, int
|
||||
*/
|
||||
static int
|
||||
acl_fetch_src_http_err_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
struct stktable_key *key;
|
||||
|
||||
@ -3026,14 +3026,14 @@ acl_fetch_src_http_err_rate(struct proxy *px, struct session *l4, void *l7, int
|
||||
return 0;
|
||||
|
||||
px = expr->args->data.prx;
|
||||
return acl_fetch_http_err_rate(&px->table, test, stktable_lookup_key(&px->table, key));
|
||||
return acl_fetch_http_err_rate(&px->table, smp, stktable_lookup_key(&px->table, key));
|
||||
}
|
||||
|
||||
/* set temp integer to the number of kbytes received from clients matching the stksess entry <ts> */
|
||||
static int
|
||||
acl_fetch_kbytes_in(struct stktable *table, struct acl_test *test, struct stksess *ts)
|
||||
acl_fetch_kbytes_in(struct stktable *table, struct sample *smp, struct stksess *ts)
|
||||
{
|
||||
test->flags = ACL_TEST_F_VOL_TEST;
|
||||
smp->flags = SMP_F_VOL_TEST;
|
||||
temp_pattern.data.uint = 0;
|
||||
|
||||
if (ts != NULL) {
|
||||
@ -3050,12 +3050,12 @@ acl_fetch_kbytes_in(struct stktable *table, struct acl_test *test, struct stkses
|
||||
*/
|
||||
static int
|
||||
acl_fetch_sc1_kbytes_in(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr1_entry)
|
||||
return 0;
|
||||
|
||||
return acl_fetch_kbytes_in(l4->stkctr1_table, test, l4->stkctr1_entry);
|
||||
return acl_fetch_kbytes_in(l4->stkctr1_table, smp, l4->stkctr1_entry);
|
||||
}
|
||||
|
||||
/* set temp integer to the number of kbytes received from clients according to the
|
||||
@ -3063,12 +3063,12 @@ acl_fetch_sc1_kbytes_in(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_sc2_kbytes_in(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr2_entry)
|
||||
return 0;
|
||||
|
||||
return acl_fetch_kbytes_in(l4->stkctr2_table, test, l4->stkctr2_entry);
|
||||
return acl_fetch_kbytes_in(l4->stkctr2_table, smp, l4->stkctr2_entry);
|
||||
}
|
||||
|
||||
/* set temp integer to the number of kbytes received from the session's source
|
||||
@ -3077,7 +3077,7 @@ acl_fetch_sc2_kbytes_in(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_src_kbytes_in(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
struct stktable_key *key;
|
||||
|
||||
@ -3086,16 +3086,16 @@ acl_fetch_src_kbytes_in(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
return 0;
|
||||
|
||||
px = expr->args->data.prx;
|
||||
return acl_fetch_kbytes_in(&px->table, test, stktable_lookup_key(&px->table, key));
|
||||
return acl_fetch_kbytes_in(&px->table, smp, stktable_lookup_key(&px->table, key));
|
||||
}
|
||||
|
||||
/* set temp integer to the bytes rate from clients in the stksess entry <ts> over the
|
||||
* configured period.
|
||||
*/
|
||||
static int
|
||||
acl_fetch_bytes_in_rate(struct stktable *table, struct acl_test *test, struct stksess *ts)
|
||||
acl_fetch_bytes_in_rate(struct stktable *table, struct sample *smp, struct stksess *ts)
|
||||
{
|
||||
test->flags = ACL_TEST_F_VOL_TEST;
|
||||
smp->flags = SMP_F_VOL_TEST;
|
||||
temp_pattern.data.uint = 0;
|
||||
if (ts != NULL) {
|
||||
void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_BYTES_IN_RATE);
|
||||
@ -3112,12 +3112,12 @@ acl_fetch_bytes_in_rate(struct stktable *table, struct acl_test *test, struct st
|
||||
*/
|
||||
static int
|
||||
acl_fetch_sc1_bytes_in_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr1_entry)
|
||||
return 0;
|
||||
|
||||
return acl_fetch_bytes_in_rate(l4->stkctr1_table, test, l4->stkctr1_entry);
|
||||
return acl_fetch_bytes_in_rate(l4->stkctr1_table, smp, l4->stkctr1_entry);
|
||||
}
|
||||
|
||||
/* set temp integer to the bytes rate from clients from the session's tracked BE
|
||||
@ -3125,12 +3125,12 @@ acl_fetch_sc1_bytes_in_rate(struct proxy *px, struct session *l4, void *l7, int
|
||||
*/
|
||||
static int
|
||||
acl_fetch_sc2_bytes_in_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr2_entry)
|
||||
return 0;
|
||||
|
||||
return acl_fetch_bytes_in_rate(l4->stkctr2_table, test, l4->stkctr2_entry);
|
||||
return acl_fetch_bytes_in_rate(l4->stkctr2_table, smp, l4->stkctr2_entry);
|
||||
}
|
||||
|
||||
/* set temp integer to the bytes rate from clients from the session's source address
|
||||
@ -3139,7 +3139,7 @@ acl_fetch_sc2_bytes_in_rate(struct proxy *px, struct session *l4, void *l7, int
|
||||
*/
|
||||
static int
|
||||
acl_fetch_src_bytes_in_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
struct stktable_key *key;
|
||||
|
||||
@ -3148,14 +3148,14 @@ acl_fetch_src_bytes_in_rate(struct proxy *px, struct session *l4, void *l7, int
|
||||
return 0;
|
||||
|
||||
px = expr->args->data.prx;
|
||||
return acl_fetch_bytes_in_rate(&px->table, test, stktable_lookup_key(&px->table, key));
|
||||
return acl_fetch_bytes_in_rate(&px->table, smp, stktable_lookup_key(&px->table, key));
|
||||
}
|
||||
|
||||
/* set temp integer to the number of kbytes sent to clients matching the stksess entry <ts> */
|
||||
static int
|
||||
acl_fetch_kbytes_out(struct stktable *table, struct acl_test *test, struct stksess *ts)
|
||||
acl_fetch_kbytes_out(struct stktable *table, struct sample *smp, struct stksess *ts)
|
||||
{
|
||||
test->flags = ACL_TEST_F_VOL_TEST;
|
||||
smp->flags = SMP_F_VOL_TEST;
|
||||
temp_pattern.data.uint = 0;
|
||||
|
||||
if (ts != NULL) {
|
||||
@ -3172,12 +3172,12 @@ acl_fetch_kbytes_out(struct stktable *table, struct acl_test *test, struct stkse
|
||||
*/
|
||||
static int
|
||||
acl_fetch_sc1_kbytes_out(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr1_entry)
|
||||
return 0;
|
||||
|
||||
return acl_fetch_kbytes_out(l4->stkctr1_table, test, l4->stkctr1_entry);
|
||||
return acl_fetch_kbytes_out(l4->stkctr1_table, smp, l4->stkctr1_entry);
|
||||
}
|
||||
|
||||
/* set temp integer to the number of kbytes sent to clients according to the session's
|
||||
@ -3185,12 +3185,12 @@ acl_fetch_sc1_kbytes_out(struct proxy *px, struct session *l4, void *l7, int dir
|
||||
*/
|
||||
static int
|
||||
acl_fetch_sc2_kbytes_out(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr2_entry)
|
||||
return 0;
|
||||
|
||||
return acl_fetch_kbytes_out(l4->stkctr2_table, test, l4->stkctr2_entry);
|
||||
return acl_fetch_kbytes_out(l4->stkctr2_table, smp, l4->stkctr2_entry);
|
||||
}
|
||||
|
||||
/* set temp integer to the number of kbytes sent to the session's source address in
|
||||
@ -3199,7 +3199,7 @@ acl_fetch_sc2_kbytes_out(struct proxy *px, struct session *l4, void *l7, int dir
|
||||
*/
|
||||
static int
|
||||
acl_fetch_src_kbytes_out(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
struct stktable_key *key;
|
||||
|
||||
@ -3208,16 +3208,16 @@ acl_fetch_src_kbytes_out(struct proxy *px, struct session *l4, void *l7, int dir
|
||||
return 0;
|
||||
|
||||
px = expr->args->data.prx;
|
||||
return acl_fetch_kbytes_out(&px->table, test, stktable_lookup_key(&px->table, key));
|
||||
return acl_fetch_kbytes_out(&px->table, smp, stktable_lookup_key(&px->table, key));
|
||||
}
|
||||
|
||||
/* set temp integer to the bytes rate to clients in the stksess entry <ts> over the
|
||||
* configured period.
|
||||
*/
|
||||
static int
|
||||
acl_fetch_bytes_out_rate(struct stktable *table, struct acl_test *test, struct stksess *ts)
|
||||
acl_fetch_bytes_out_rate(struct stktable *table, struct sample *smp, struct stksess *ts)
|
||||
{
|
||||
test->flags = ACL_TEST_F_VOL_TEST;
|
||||
smp->flags = SMP_F_VOL_TEST;
|
||||
temp_pattern.data.uint = 0;
|
||||
if (ts != NULL) {
|
||||
void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_BYTES_OUT_RATE);
|
||||
@ -3234,12 +3234,12 @@ acl_fetch_bytes_out_rate(struct stktable *table, struct acl_test *test, struct s
|
||||
*/
|
||||
static int
|
||||
acl_fetch_sc1_bytes_out_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr1_entry)
|
||||
return 0;
|
||||
|
||||
return acl_fetch_bytes_out_rate(l4->stkctr1_table, test, l4->stkctr1_entry);
|
||||
return acl_fetch_bytes_out_rate(l4->stkctr1_table, smp, l4->stkctr1_entry);
|
||||
}
|
||||
|
||||
/* set temp integer to the bytes rate to clients from the session's tracked BE counters
|
||||
@ -3247,12 +3247,12 @@ acl_fetch_sc1_bytes_out_rate(struct proxy *px, struct session *l4, void *l7, int
|
||||
*/
|
||||
static int
|
||||
acl_fetch_sc2_bytes_out_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
if (!l4->stkctr2_entry)
|
||||
return 0;
|
||||
|
||||
return acl_fetch_bytes_out_rate(l4->stkctr2_table, test, l4->stkctr2_entry);
|
||||
return acl_fetch_bytes_out_rate(l4->stkctr2_table, smp, l4->stkctr2_entry);
|
||||
}
|
||||
|
||||
/* set temp integer to the bytes rate to client from the session's source address in
|
||||
@ -3261,7 +3261,7 @@ acl_fetch_sc2_bytes_out_rate(struct proxy *px, struct session *l4, void *l7, int
|
||||
*/
|
||||
static int
|
||||
acl_fetch_src_bytes_out_rate(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
struct stktable_key *key;
|
||||
|
||||
@ -3270,7 +3270,7 @@ acl_fetch_src_bytes_out_rate(struct proxy *px, struct session *l4, void *l7, int
|
||||
return 0;
|
||||
|
||||
px = expr->args->data.prx;
|
||||
return acl_fetch_bytes_out_rate(&px->table, test, stktable_lookup_key(&px->table, key));
|
||||
return acl_fetch_bytes_out_rate(&px->table, smp, stktable_lookup_key(&px->table, key));
|
||||
}
|
||||
|
||||
/* set temp integer to the number of used entries in the table pointed to by expr.
|
||||
@ -3278,9 +3278,9 @@ acl_fetch_src_bytes_out_rate(struct proxy *px, struct session *l4, void *l7, int
|
||||
*/
|
||||
static int
|
||||
acl_fetch_table_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
test->flags = ACL_TEST_F_VOL_TEST;
|
||||
smp->flags = SMP_F_VOL_TEST;
|
||||
temp_pattern.data.uint = expr->args->data.prx->table.current;
|
||||
return 1;
|
||||
}
|
||||
@ -3290,10 +3290,10 @@ acl_fetch_table_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
*/
|
||||
static int
|
||||
acl_fetch_table_avl(struct proxy *px, struct session *l4, void *l7, int dir,
|
||||
struct acl_expr *expr, struct acl_test *test)
|
||||
struct acl_expr *expr, struct sample *smp)
|
||||
{
|
||||
px = expr->args->data.prx;
|
||||
test->flags = ACL_TEST_F_VOL_TEST;
|
||||
smp->flags = SMP_F_VOL_TEST;
|
||||
temp_pattern.data.uint = px->table.size - px->table.current;
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user