MEDIUM: acl: have a pointer to the keyword name in acl_expr
The acl_expr struct used to hold a pointer to the ACL keyword. But since
we now have all the relevant pointers, we don't need that anymore, we just
need the pointer to the keyword as a string in order to return warnings
and error messages.
So let's change this in order to remove the dependency on the acl_keyword
struct from acl_expr.
During this change, acl_cond_kw_conflicts() used to return a pointer to an
ACL keyword but had to be changed to return a const char* for the same reason.
diff --git a/src/proto_tcp.c b/src/proto_tcp.c
index e8d7d60..dc3817e 100644
--- a/src/proto_tcp.c
+++ b/src/proto_tcp.c
@@ -1190,7 +1190,7 @@
struct tcp_rule *rule;
unsigned int where;
const struct acl *acl;
- const struct acl_keyword *kw;
+ const char *kw;
if (!*args[1]) {
memprintf(err, "missing argument for '%s' in %s '%s'",
@@ -1249,7 +1249,7 @@
memprintf(err,
"anonymous acl will never match in '%s %s' because it uses keyword '%s' which is incompatible with '%s'",
args[0], args[1],
- LIST_ELEM(acl->expr.n, struct acl_expr *, list)->kw->kw,
+ LIST_ELEM(acl->expr.n, struct acl_expr *, list)->kw,
sample_ckp_names(where));
warn++;
@@ -1258,11 +1258,11 @@
if (acl->name && *acl->name)
memprintf(err,
"acl '%s' involves keyword '%s' which is incompatible with '%s'",
- acl->name, kw->kw, sample_ckp_names(where));
+ acl->name, kw, sample_ckp_names(where));
else
memprintf(err,
"anonymous acl involves keyword '%s' which is incompatible with '%s'",
- kw->kw, sample_ckp_names(where));
+ kw, sample_ckp_names(where));
warn++;
}
@@ -1296,7 +1296,7 @@
struct tcp_rule *rule;
unsigned int where;
const struct acl *acl;
- const struct acl_keyword *kw;
+ const char *kw;
if (!*args[1]) {
if (curpx == defpx)
@@ -1358,7 +1358,7 @@
memprintf(err,
"anonymous acl will never match in '%s %s' because it uses keyword '%s' which is incompatible with '%s'",
args[0], args[1],
- LIST_ELEM(acl->expr.n, struct acl_expr *, list)->kw->kw,
+ LIST_ELEM(acl->expr.n, struct acl_expr *, list)->kw,
sample_ckp_names(where));
warn++;
@@ -1367,11 +1367,11 @@
if (acl->name && *acl->name)
memprintf(err,
"acl '%s' involves keyword '%s' which is incompatible with '%s'",
- acl->name, kw->kw, sample_ckp_names(where));
+ acl->name, kw, sample_ckp_names(where));
else
memprintf(err,
"anonymous acl involves keyword '%s' which is incompatible with '%s'",
- kw->kw, sample_ckp_names(where));
+ kw, sample_ckp_names(where));
warn++;
}
@@ -1401,7 +1401,7 @@
memprintf(err,
"anonymous acl will never match in '%s %s' because it uses keyword '%s' which is incompatible with '%s'",
args[0], args[1],
- LIST_ELEM(acl->expr.n, struct acl_expr *, list)->kw->kw,
+ LIST_ELEM(acl->expr.n, struct acl_expr *, list)->kw,
sample_ckp_names(where));
warn++;
@@ -1410,11 +1410,11 @@
if (acl->name && *acl->name)
memprintf(err,
"acl '%s' involves keyword '%s' which is incompatible with '%s'",
- acl->name, kw->kw, sample_ckp_names(where));
+ acl->name, kw, sample_ckp_names(where));
else
memprintf(err,
"anonymous acl involves keyword '%s' which is incompatible with '%s'",
- kw->kw, sample_ckp_names(where));
+ kw, sample_ckp_names(where));
warn++;
}