]> git.ipfire.org Git - thirdparty/iptables.git/commit
xtables-monitor: fix build with older glibc
authorBaruch Siach <baruch@tkos.co.il>
Fri, 16 Nov 2018 05:23:32 +0000 (07:23 +0200)
committerFlorian Westphal <fw@strlen.de>
Fri, 16 Nov 2018 06:25:18 +0000 (07:25 +0100)
commit7c8791edac3e74f6ce0bf21f98bc820db8e55e62
tree23b5cb6cf37ed09b8d8a7b45a0ba5f528b64ed90
parent907e429d7548157016cd51aba4adc5d0c7d9f816
xtables-monitor: fix build with older glibc

glibc older than 2.19 only expose BSD style fields of struct tcphdr when
_BSD_SOURCE is define. Current glibc however, warn that _BSD_SOURCE is
deprecated. Migrate to the GNU style of tcphdr fields to make the code
compatible with any glibc version.

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 'th_sport'
    printf("SPORT=%d DPORT=%d ", ntohs(tcph->th_sport), ntohs(tcph->th_dport));
                                           ^
xtables-monitor.c:406:66: error: 'const struct tcphdr' has no member named 'th_dport'
    printf("SPORT=%d DPORT=%d ", ntohs(tcph->th_sport), ntohs(tcph->th_dport));
                                                                  ^
...

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