diff mbox

[iptables] utils: nfsynproxy: fix build with musl libc

Message ID 06e0312d0bfd1f0b9e7c23ab654f18524d49e86b.1488440107.git.baruch@tkos.co.il
State Accepted
Delegated to: Pablo Neira
Headers show

Commit Message

Baruch Siach March 2, 2017, 7:35 a.m. UTC
The musl libc exposes some struct tcphdr field only when _GNU_SOURCE is
defined. Fix the following build failure:

nfsynproxy.c: In function ‘parse_packet’:
nfsynproxy.c:34:9: error: ‘const struct tcphdr’ has no member named ‘syn’
  if (!th->syn || !th->ack)
         ^
nfsynproxy.c:34:21: error: ‘const struct tcphdr’ has no member named ‘ack’
  if (!th->syn || !th->ack)
                     ^
nfsynproxy.c:42:8: error: ‘const struct tcphdr’ has no member named ‘res2’
  if (th->res2 == 0x1)
        ^
nfsynproxy.c:45:13: error: ‘const struct tcphdr’ has no member named ‘doff’
  length = th->doff * 4 - sizeof(*th);
             ^

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
 utils/nfsynproxy.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Pablo Neira Ayuso March 3, 2017, 9:55 a.m. UTC | #1
On Thu, Mar 02, 2017 at 09:35:07AM +0200, Baruch Siach wrote:
> The musl libc exposes some struct tcphdr field only when _GNU_SOURCE is
> defined. Fix the following build failure:
> 
> nfsynproxy.c: In function ‘parse_packet’:
> nfsynproxy.c:34:9: error: ‘const struct tcphdr’ has no member named ‘syn’
>   if (!th->syn || !th->ack)
>          ^
> nfsynproxy.c:34:21: error: ‘const struct tcphdr’ has no member named ‘ack’
>   if (!th->syn || !th->ack)
>                      ^
> nfsynproxy.c:42:8: error: ‘const struct tcphdr’ has no member named ‘res2’
>   if (th->res2 == 0x1)
>         ^
> nfsynproxy.c:45:13: error: ‘const struct tcphdr’ has no member named ‘doff’
>   length = th->doff * 4 - sizeof(*th);
>              ^

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/utils/nfsynproxy.c b/utils/nfsynproxy.c
index baedc92c5d9f..bf5c416340f1 100644
--- a/utils/nfsynproxy.c
+++ b/utils/nfsynproxy.c
@@ -6,6 +6,7 @@ 
  * published by the Free Software Foundation.
  */
 
+#define _GNU_SOURCE
 #include <stdlib.h>
 #include <stdbool.h>
 #include <unistd.h>