diff mbox

[nft,5/7] evaluate: fix build with clang

Message ID 20170710223255.29885-6-eric@regit.org
State Accepted
Delegated to: Pablo Neira
Headers show

Commit Message

Eric Leblond July 10, 2017, 10:32 p.m. UTC
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>
---
 src/evaluate.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff mbox

Patch

diff --git a/src/evaluate.c b/src/evaluate.c
index ca8b63b..86eea19 100644
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -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;