]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
xtables-monitor: fix build with musl libc
authorBaruch Siach <baruch@tkos.co.il>
Sat, 17 Nov 2018 20:20:08 +0000 (22:20 +0200)
committerFlorian Westphal <fw@strlen.de>
Sat, 17 Nov 2018 20:24:17 +0000 (21:24 +0100)
Commit 7c8791edac3 ("xtables-monitor: fix build with older glibc")
changed the code to use GNU style tcphdr fields. Unfortunately, musl
libc requires _GNU_SOURCE definition to expose these fields.

Fix the following build failure:

xtables-monitor.c: In function ‘trace_print_packet’:
xtables-monitor.c:406:43: error: ‘const struct tcphdr’ has no member named ‘source’
    printf("SPORT=%d DPORT=%d ", ntohs(tcph->source), ntohs(tcph->dest));
                                           ^~
xtables-monitor.c:406:64: error: ‘const struct tcphdr’ has no member named ‘dest’
    printf("SPORT=%d DPORT=%d ", ntohs(tcph->source), ntohs(tcph->dest));
                                                                ^~
...

Cc: Florian Westphal <fw@strlen.de>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Florian Westphal <fw@strlen.de>
iptables/xtables-monitor.c

index 5d1611122df520ac686b7e5d86561a45670bc02b..f835c5e503e0f32e9d8df840f69371a66f9fbd72 100644 (file)
@@ -9,6 +9,7 @@
  * This software has been sponsored by Sophos Astaro <http://www.sophos.com>
  */
 
+#define _GNU_SOURCE
 #include <stdlib.h>
 #include <time.h>
 #include <string.h>