[nft PATCH 05/12] Review raw payload allocation points

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In parser_bison.y, call payload_init_raw() instead of assigning all
fields manually. Also drop manual initialization of flags field: it is
not touched in allocation path, so no need for that.

In stmt_evaluate_payload(), setting dtype field is redundant since
payload_init_raw() does that already.

Signed-off-by: Phil Sutter <phil@xxxxxx>
---
 src/evaluate.c     | 1 -
 src/parser_bison.y | 6 +-----
 2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/src/evaluate.c b/src/evaluate.c
index efdbb5e516eea..db63494ce2f3a 100644
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -1951,7 +1951,6 @@ static int stmt_evaluate_payload(struct eval_ctx *ctx, struct stmt *stmt)
 			 payload_byte_size * BITS_PER_BYTE);
 
 	payload_bytes->payload.desc	 = payload->payload.desc;
-	payload_bytes->dtype		 = &integer_type;
 	payload_bytes->byteorder	 = payload->byteorder;
 
 	payload->len = payload_bytes->len;
diff --git a/src/parser_bison.y b/src/parser_bison.y
index f1617eeaf1496..93346d76e2ef5 100644
--- a/src/parser_bison.y
+++ b/src/parser_bison.y
@@ -3682,13 +3682,9 @@ payload_expr		:	payload_raw_expr
 payload_raw_expr	:	AT	payload_base_spec	COMMA	NUM	COMMA	NUM
 			{
 				$$ = payload_expr_alloc(&@$, NULL, 0);
-				$$->payload.base	= $2;
-				$$->payload.offset	= $4;
-				$$->len			= $6;
-				$$->dtype		= &integer_type;
+				payload_init_raw($$, $2, $4, $6);
 				$$->byteorder		= BYTEORDER_BIG_ENDIAN;
 				$$->payload.is_raw	= true;
-				$$->flags		= 0;
 			}
 			;
 
-- 
2.16.1

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux