diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2023-03-17 10:16:40 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2023-03-28 10:26:34 +0200 |
commit | edecd58755a84dbe8f36795f619189490eeb3ef1 (patch) | |
tree | 8314b45f383d6213023df14d709a783be89bf7d2 /include | |
parent | cd2d1fc4e8b114f8526b0ce61cfd5cfce8eacac6 (diff) |
evaluate: support shifts larger than the width of the left operand
If we want to left-shift a value of narrower type and assign the result
to a variable of a wider type, we are constrained to only shifting up to
the width of the narrower type. Thus:
add rule t c meta mark set ip dscp << 2
works, but:
add rule t c meta mark set ip dscp << 8
does not, even though the lvalue is large enough to accommodate the
result.
Upgrade the maximum length based on the statement datatype length, which
is provided via context, if it is larger than expression lvalue.
Update netlink_delinearize.c to handle the case where the length of a
shift expression does not match that of its left-hand operand.
Based on patch from Jeremy Sowden.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/rule.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/rule.h b/include/rule.h index e1efbb81..ef094c90 100644 --- a/include/rule.h +++ b/include/rule.h @@ -766,6 +766,7 @@ struct eval_ctx { struct rule *rule; struct set *set; struct stmt *stmt; + uint32_t stmt_len; struct expr_ctx ectx; struct proto_ctx _pctx[2]; const struct proto_desc *inner_desc; |