summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJeremy Sowden <jeremy@azazel.net>2020-02-03 11:20:20 +0000
committerPablo Neira Ayuso <pablo@netfilter.org>2020-02-07 16:57:30 +0100
commitaae18ff0b2aa18091c54be5873ddf1de97cd24ad (patch)
tree549a68b5b6862683fb1ea295da606dea99125ed0 /src
parent05f50c4f8320e8b34593307c990d493324bb513d (diff)
evaluate: change shift byte-order to host-endian.
The byte-order of the righthand operands of the right-shifts generated for payload and exthdr expressions is big-endian. However, all right operands should be host-endian. Since evaluation of the shift binop will insert a byte-order conversion to enforce this, change the endianness in order to avoid the extra operation. Signed-off-by: Jeremy Sowden <jeremy@azazel.net> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src')
-rw-r--r--src/evaluate.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/evaluate.c b/src/evaluate.c
index b6c05a81..a3cbf939 100644
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -492,7 +492,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);
rshift = binop_expr_alloc(&expr->location, OP_RSHIFT, and, off);