diff mbox series

[iptables] xtables-monitor: fix build with musl libc

Message ID 6f6369e6a5471a76beb896d755e108ca5b384123.1542486008.git.baruch@tkos.co.il
State Accepted
Headers show
Series [iptables] xtables-monitor: fix build with musl libc | expand

Commit Message

Baruch Siach Nov. 17, 2018, 8:20 p.m. UTC
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>
---
 iptables/xtables-monitor.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Florian Westphal Nov. 17, 2018, 8:25 p.m. UTC | #1
Baruch Siach <baruch@tkos.co.il> wrote:
> 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:

Applied, thanks.
diff mbox series

Patch

diff --git a/iptables/xtables-monitor.c b/iptables/xtables-monitor.c
index 5d1611122df5..f835c5e503e0 100644
--- a/iptables/xtables-monitor.c
+++ b/iptables/xtables-monitor.c
@@ -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>