diff --git a/include/types/acl.h b/include/types/acl.h index 0eecd335f..fe0ce5f64 100644 --- a/include/types/acl.h +++ b/include/types/acl.h @@ -130,10 +130,12 @@ struct session; * successive calls. */ +struct acl_expr; 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, void *arg, struct acl_test *test); + 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); int use_cnt; }; diff --git a/src/acl.c b/src/acl.c index 2cd154ca0..0cc924833 100644 --- a/src/acl.c +++ b/src/acl.c @@ -659,7 +659,7 @@ int acl_exec_cond(struct acl_cond *cond, struct proxy *px, struct session *l4, v /* we need to reset context and flags */ memset(&test, 0, sizeof(test)); fetch_next: - if (!expr->kw->fetch(px, l4, l7, dir, expr->arg.str, &test)) + if (!expr->kw->fetch(px, l4, l7, dir, expr, &test)) continue; /* apply all tests to this value */ diff --git a/src/client.c b/src/client.c index 39d53221f..3995b53d6 100644 --- a/src/client.c +++ b/src/client.c @@ -454,7 +454,8 @@ int event_accept(int fd) { /* set test->ptr to point to the source IPv4/IPv6 address and test->i to the family */ static int -acl_fetch_src(struct proxy *px, struct session *l4, void *l7, int dir, void *arg, struct acl_test *test) +acl_fetch_src(struct proxy *px, struct session *l4, void *l7, int dir, + struct acl_expr *expr, struct acl_test *test) { test->i = l4->cli_addr.ss_family; if (test->i == AF_INET) @@ -468,7 +469,8 @@ acl_fetch_src(struct proxy *px, struct session *l4, void *l7, int dir, void *arg /* set test->i to the connexion's source port */ static int -acl_fetch_sport(struct proxy *px, struct session *l4, void *l7, int dir, void *arg, struct acl_test *test) +acl_fetch_sport(struct proxy *px, struct session *l4, void *l7, int dir, + struct acl_expr *expr, struct acl_test *test) { if (l4->cli_addr.ss_family == AF_INET) test->i = ntohs(((struct sockaddr_in *)&l4->cli_addr)->sin_port); @@ -481,7 +483,8 @@ acl_fetch_sport(struct proxy *px, struct session *l4, void *l7, int dir, void *a /* 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, void *arg, struct acl_test *test) +acl_fetch_dst(struct proxy *px, struct session *l4, void *l7, int dir, + struct acl_expr *expr, struct acl_test *test) { if (!(l4->flags & SN_FRT_ADDR_SET)) get_frt_addr(l4); @@ -498,7 +501,8 @@ acl_fetch_dst(struct proxy *px, struct session *l4, void *l7, int dir, void *arg /* set test->i to the frontend connexion's destination port */ static int -acl_fetch_dport(struct proxy *px, struct session *l4, void *l7, int dir, void *arg, struct acl_test *test) +acl_fetch_dport(struct proxy *px, struct session *l4, void *l7, int dir, + struct acl_expr *expr, struct acl_test *test) { if (!(l4->flags & SN_FRT_ADDR_SET)) get_frt_addr(l4); @@ -513,7 +517,8 @@ acl_fetch_dport(struct proxy *px, struct session *l4, void *l7, int dir, void *a /* set test->i to the number of connexions to the proxy */ static int -acl_fetch_dconn(struct proxy *px, struct session *l4, void *l7, int dir, void *arg, struct acl_test *test) +acl_fetch_dconn(struct proxy *px, struct session *l4, void *l7, int dir, + struct acl_expr *expr, struct acl_test *test) { test->i = px->feconn; return 1; diff --git a/src/proto_http.c b/src/proto_http.c index 5f991e57a..ea199d9b9 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -5165,7 +5165,8 @@ 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, void *arg, struct acl_test *test) +acl_fetch_meth(struct proxy *px, struct session *l4, void *l7, int dir, + struct acl_expr *expr, struct acl_test *test) { int meth; struct http_txn *txn = l7; @@ -5209,7 +5210,8 @@ 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, void *arg, struct acl_test *test) +acl_fetch_rqver(struct proxy *px, struct session *l4, void *l7, int dir, + struct acl_expr *expr, struct acl_test *test) { struct http_txn *txn = l7; char *ptr; @@ -5230,7 +5232,8 @@ acl_fetch_rqver(struct proxy *px, struct session *l4, void *l7, int dir, void *a } static int -acl_fetch_stver(struct proxy *px, struct session *l4, void *l7, int dir, void *arg, struct acl_test *test) +acl_fetch_stver(struct proxy *px, struct session *l4, void *l7, int dir, + struct acl_expr *expr, struct acl_test *test) { struct http_txn *txn = l7; char *ptr; @@ -5252,7 +5255,8 @@ acl_fetch_stver(struct proxy *px, struct session *l4, void *l7, int dir, void *a /* 3. Check on Status Code. We manipulate integers here. */ static int -acl_fetch_stcode(struct proxy *px, struct session *l4, void *l7, int dir, void *arg, struct acl_test *test) +acl_fetch_stcode(struct proxy *px, struct session *l4, void *l7, int dir, + struct acl_expr *expr, struct acl_test *test) { struct http_txn *txn = l7; char *ptr; @@ -5268,7 +5272,8 @@ acl_fetch_stcode(struct proxy *px, struct session *l4, void *l7, int dir, void * /* 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, void *arg, struct acl_test *test) +acl_fetch_url(struct proxy *px, struct session *l4, void *l7, int dir, + struct acl_expr *expr, struct acl_test *test) { struct http_txn *txn = l7;