]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
evaluate: don't adjust offset from resolve_protocol_conflict()
authorPablo Neira Ayuso <pablo@netfilter.org>
Thu, 28 Jan 2016 11:52:47 +0000 (12:52 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Sun, 31 Jan 2016 22:43:35 +0000 (23:43 +0100)
This is not itself a conflict, move this check out of this function.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/evaluate.c

index a294070af765b3e617de61a8901f4b0e6a595532..5ef035be23f52a44f6fa74b5cc6c4196fe38cad5 100644 (file)
@@ -395,11 +395,6 @@ static int resolve_protocol_conflict(struct eval_ctx *ctx,
        struct stmt *nstmt = NULL;
        int link, err;
 
-       if (desc == payload->payload.desc) {
-               payload->payload.offset += ctx->pctx.protocol[base].offset;
-               return 0;
-       }
-
        err = supersede_dep(ctx, desc, payload);
        if (err <= 0)
                return err;
@@ -448,6 +443,14 @@ static int __expr_evaluate_payload(struct eval_ctx *ctx, struct expr *expr)
                        return -1;
                list_add_tail(&nstmt->list, &ctx->stmt->list);
        } else {
+               /* No conflict: Same payload protocol as context, adjust offset
+                * if needed.
+                */
+               if (desc == payload->payload.desc) {
+                       payload->payload.offset +=
+                               ctx->pctx.protocol[base].offset;
+                       return 0;
+               }
                /* If we already have context and this payload is on the same
                 * base, try to resolve the protocol conflict.
                 */