summaryrefslogtreecommitdiffstats
path: root/src/netlink_delinearize.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2024-03-27 18:42:53 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2024-04-02 17:31:56 +0200
commit3f776e8b37d8022d4492ed8be136e99f5a88ab9e (patch)
tree5ccbc1b3b3ae79280137905a6c6e88533a90e9fb /src/netlink_delinearize.c
parent5827f244629aa59ed917c7e2bbe363a82dc5f42d (diff)
netlink_delinearize: unused code in reverse cross-day meta hour range
f8f32deda31d ("meta: Introduce new conditions 'time', 'day' and 'hour'") reverses a cross-day range expressed as "22:00"-"02:00" UTC time into != "02:00"-"22:00" so meta hour ranges works. Listing is however confusing, hence, 44d144cd593e ("netlink_delinearize: reverse cross-day meta hour range") introduces code to reverse a cross-day. However, it also adds code to reverse a range in == to-from form (assuming OP_IMPLICIT) which is never exercised from the listing path because the range expression is not currently used, instead two instructions (cmp gte and cmp lte) are used to represent the range. Remove this branch otherwise a reversed notation will be used to display meta hour ranges once the range instruction is to represent this. Add test for cross-day scenario in EADT timezone. Fixes: 44d144cd593e ("netlink_delinearize: reverse cross-day meta hour range") Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/netlink_delinearize.c')
-rw-r--r--src/netlink_delinearize.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/netlink_delinearize.c b/src/netlink_delinearize.c
index 5a4cf1b8..24dfb311 100644
--- a/src/netlink_delinearize.c
+++ b/src/netlink_delinearize.c
@@ -2858,14 +2858,10 @@ static void expr_postprocess(struct rule_pp_ctx *ctx, struct expr **exprp)
* is a cross-day range.
*/
if (mpz_cmp(range->left->value,
- range->right->value) <= 0) {
- if (expr->op == OP_NEQ) {
- range_expr_swap_values(range);
- expr->op = OP_IMPLICIT;
- } else if (expr->op == OP_IMPLICIT) {
- range_expr_swap_values(range);
- expr->op = OP_NEG;
- }
+ range->right->value) <= 0 &&
+ expr->op == OP_NEQ) {
+ range_expr_swap_values(range);
+ expr->op = OP_IMPLICIT;
}
}
/* fallthrough */