summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2024-06-18 14:26:31 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2024-06-25 17:20:12 +0200
commit081bf5f0d7952a6e6ac0d23a365ccf1fd27010c0 (patch)
tree504db7eb68465921f76a917b18ced461a5cf75f6 /include
parentf13fd62ef1e2755ed5eef11adbe0e8a479528f72 (diff)
src: add string preprocessor and use it for log prefix string
Add a string preprocessor to identify and replace variables in a string. Rework existing support to variables in log prefix strings to use it. Fixes: e76bb3794018 ("src: allow for variables in the log prefix string") Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include')
-rw-r--r--include/expression.h2
-rw-r--r--include/parser.h4
-rw-r--r--include/statement.h2
3 files changed, 5 insertions, 3 deletions
diff --git a/include/expression.h b/include/expression.h
index 01b45b7c..8982110c 100644
--- a/include/expression.h
+++ b/include/expression.h
@@ -415,8 +415,6 @@ extern const struct datatype *expr_basetype(const struct expr *expr);
extern void expr_set_type(struct expr *expr, const struct datatype *dtype,
enum byteorder byteorder);
-void expr_to_string(const struct expr *expr, char *string);
-
struct eval_ctx;
extern int expr_binary_error(struct list_head *msgs,
const struct expr *e1, const struct expr *e2,
diff --git a/include/parser.h b/include/parser.h
index f79a22f3..576e5e43 100644
--- a/include/parser.h
+++ b/include/parser.h
@@ -112,4 +112,8 @@ extern void scanner_push_buffer(void *scanner,
extern void scanner_pop_start_cond(void *scanner, enum startcond_type sc);
+const char *str_preprocess(struct parser_state *state, struct location *loc,
+ struct scope *scope, const char *x,
+ struct error_record **rec);
+
#endif /* NFTABLES_PARSER_H */
diff --git a/include/statement.h b/include/statement.h
index 662f99dd..9376911b 100644
--- a/include/statement.h
+++ b/include/statement.h
@@ -90,7 +90,7 @@ enum {
};
struct log_stmt {
- struct expr *prefix;
+ const char *prefix;
unsigned int snaplen;
uint16_t group;
uint16_t qthreshold;