[nft,v3,6/9] evaluate: change shift byte-order to host-endian.
diff mbox series

Message ID 20200119225710.222976-7-jeremy@azazel.net
State Changes Requested
Delegated to: Pablo Neira
Headers show
Series
  • bitwise shift support
Related show

Commit Message

Jeremy Sowden Jan. 19, 2020, 10:57 p.m. UTC
The byte-order of the righthand operands of the right-shifts generated
for payload and exthdr expressions is big-endian.  However, all right
shift operands should be host-endian.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
---
 src/evaluate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch
diff mbox series

diff --git a/src/evaluate.c b/src/evaluate.c
index 5bd0858cbee1..52719f56abea 100644
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -487,7 +487,7 @@  static void expr_evaluate_bits(struct eval_ctx *ctx, struct expr **exprp)
 	if (shift) {
 		off = constant_expr_alloc(&expr->location,
 					  expr_basetype(expr),
-					  BYTEORDER_BIG_ENDIAN,
+					  BYTEORDER_HOST_ENDIAN,
 					  sizeof(shift), &shift);
 
 		lshift = binop_expr_alloc(&expr->location, OP_RSHIFT, and, off);