diff mbox series

[nft,5/9] payload: use enum icmp_hdr_field_type in payload_may_dependency_kill_icmp()

Message ID 20230920142958.566615-6-thaller@redhat.com
State Accepted
Delegated to: Pablo Neira
Headers show
Series various cleanups related to enums and struct datatype | expand

Commit Message

Thomas Haller Sept. 20, 2023, 2:26 p.m. UTC
Don't mix icmp_dep (enum icmp_hdr_field_type) and the uint8_t icmp_type.

Signed-off-by: Thomas Haller <thaller@redhat.com>
---
 src/payload.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

Comments

Pablo Neira Ayuso Sept. 20, 2023, 4:32 p.m. UTC | #1
On Wed, Sep 20, 2023 at 04:26:06PM +0200, Thomas Haller wrote:
> Don't mix icmp_dep (enum icmp_hdr_field_type) and the uint8_t icmp_type.

Applied, thanks
diff mbox series

Patch

diff --git a/src/payload.c b/src/payload.c
index a02942b3382a..cb8edfac0338 100644
--- a/src/payload.c
+++ b/src/payload.c
@@ -802,18 +802,16 @@  static uint8_t icmp_dep_to_type(enum icmp_hdr_field_type t)
 static bool payload_may_dependency_kill_icmp(struct payload_dep_ctx *ctx, struct expr *expr)
 {
 	const struct expr *dep = payload_dependency_get(ctx, expr->payload.base);
-	uint8_t icmp_type;
+	enum icmp_hdr_field_type icmp_dep;
 
-	icmp_type = expr->payload.tmpl->icmp_dep;
-	if (icmp_type == PROTO_ICMP_ANY)
+	icmp_dep = expr->payload.tmpl->icmp_dep;
+	if (icmp_dep == PROTO_ICMP_ANY)
 		return false;
 
 	if (dep->left->payload.desc != expr->payload.desc)
 		return false;
 
-	icmp_type = icmp_dep_to_type(expr->payload.tmpl->icmp_dep);
-
-	return ctx->icmp_type == icmp_type;
+	return ctx->icmp_type == icmp_dep_to_type(icmp_dep);
 }
 
 static bool payload_may_dependency_kill_ll(struct payload_dep_ctx *ctx, struct expr *expr)