]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
evaluate: fix build with clang
authorEric Leblond <eric@regit.org>
Mon, 10 Jul 2017 22:32:53 +0000 (00:32 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 17 Jul 2017 15:20:34 +0000 (17:20 +0200)
Building with a recent clang was failing due to the following error:

src/evaluate.c|450 col 45| error: initializer element is not constant
||    static const unsigned int max_tcpoptlen = 15 * 4 * BITS_PER_BYTE - tcphdrlen;
||                                              ^~

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

index 74a4097422cdf4509ec01c889710a4543076161a..db18df05ec997d1d22a492bb63d5e69053eacb9d 100644 (file)
@@ -446,8 +446,7 @@ static int __expr_evaluate_exthdr(struct eval_ctx *ctx, struct expr **exprp)
 
        switch (expr->exthdr.op) {
        case NFT_EXTHDR_OP_TCPOPT: {
-               static const uint8_t tcphdrlen = 20 * BITS_PER_BYTE;
-               static const unsigned int max_tcpoptlen = 15 * 4 * BITS_PER_BYTE - tcphdrlen;
+               static const unsigned int max_tcpoptlen = (15 * 4 - 20) * BITS_PER_BYTE;
                unsigned int totlen = 0;
 
                totlen += expr->exthdr.tmpl->offset;