From 477a2d86c54ee8e1a8426838439e9960f892ac29 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Wed, 14 Feb 2018 16:26:50 +0100 Subject: src: add payload_dependency_exists() This helper function tells us if there is already a protocol key payload expression, ie. those with EXPR_F_PROTOCOL flag set on, that we might want to remove since we can infer from another expression in the upper protocol base, eg. ip protocol tcp tcp dport 22 'ip protocol tcp' can be removed in the ip family since it is redundant, but not in the netdev, bridge and inet families, where we cannot make assumptions on the layer 3 protocol. Signed-off-by: Pablo Neira Ayuso --- include/payload.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include/payload.h') diff --git a/include/payload.h b/include/payload.h index 294ff270..dec4647a 100644 --- a/include/payload.h +++ b/include/payload.h @@ -40,8 +40,9 @@ void payload_dependency_reset(struct payload_dep_ctx *ctx); extern void payload_dependency_store(struct payload_dep_ctx *ctx, struct stmt *stmt, enum proto_bases base); +extern bool payload_dependency_exists(const struct payload_dep_ctx *ctx, + enum proto_bases base); extern void __payload_dependency_kill(struct payload_dep_ctx *ctx, - enum proto_bases base, unsigned int family); extern void payload_dependency_kill(struct payload_dep_ctx *ctx, struct expr *expr, unsigned int family); -- cgit v1.2.3