Skip to contentSkip to conversation

build: do not compile nfct if we disabled cttimeout

PATCH In review Hangbin Liu 2 participants 8 messages May 8, 2014 – May 12, 2014 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 build: do not compile nfct if we disabled cttimeout

If we do not have libnetfilter_cttimeout and disabled cttimeout, conntrack-tools will compile fail because nfct.c include nfnetlink_cttimeout.h. Fix it by only compile nfct when we have enabled cttimeout

---
 src/Makefile.am | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
src/Makefile.am +4 -1
index 1bc3622..3f8ddee 100644
@@ -8,7 +8,10 @@ AM_YFLAGS = -d
 
 CLEANFILES = read_config_yy.c read_config_lex.c
 
-sbin_PROGRAMS = conntrack conntrackd nfct
+sbin_PROGRAMS = conntrack conntrackd
+if HAVE_CTTIMEOUT
+sbin_PROGRAMS += nfct
+endif
 
 conntrack_SOURCES = conntrack.c
 conntrack_LDADD = ../extensions/libct_proto_tcp.la ../extensions/libct_proto_udp.la ../extensions/libct_proto_udplite.la ../extensions/libct_proto_icmp.la ../extensions/libct_proto_icmpv6.la ../extensions/libct_proto_sctp.la ../extensions/libct_proto_dccp.la ../extensions/libct_proto_gre.la ../extensions/libct_proto_unknown.la ${LIBNETFILTER_CONNTRACK_LIBS} ${LIBMNL_LIBS} ${LIBNFNETLINK_LIBS}
Signature · 1 line
1.8.1.4
#1 lore raw
Quoted 3 lines · Hangbin Liu

If we do not have libnetfilter_cttimeout and disabled cttimeout, conntrack-tools will compile fail because nfct.c include nfnetlink_cttimeout.h. Fix it by only compile nfct when we have enabled cttimeout

Strange. The nfnetlink_cttimeout.h file is cached inside the conntrack-tools tree:

conntrack-tools/include/linux/netfilter/nfnetlink_cttimeout.h

Here this compiles fine with my current tree and using:

./configure --prefix=/usr --disable-cthelper --disable-cttimeout

Please, investigate this issue a bit further.

#2 lore raw
Quoted 8 lines · Pablo Neira Ayuso
Quoted 3 lines · Hangbin Liu

If we do not have libnetfilter_cttimeout and disabled cttimeout, conntrack-tools will compile fail because nfct.c include nfnetlink_cttimeout.h. Fix it by only compile nfct when we have enabled cttimeout

Strange. The nfnetlink_cttimeout.h file is cached inside the conntrack-tools tree:

Quoted 7 lines

conntrack-tools/include/linux/netfilter/nfnetlink_cttimeout.h

Here this compiles fine with my current tree and using:

./configure --prefix=/usr --disable-cthelper --disable-cttimeout

Please, investigate this issue a bit further.

That's weird, on my system without libnetfilter_cttimeout.

# ./configure --prefix=/usr
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes

<snip>

checking for LIBNETFILTER_CONNTRACK... yes
checking for LIBNETFILTER_CTTIMEOUT... no
configure: error: Package requirements (libnetfilter_cttimeout >= 1.0.0) were not met:

No package 'libnetfilter_cttimeout' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix.

Alternatively, you may set the environment variables LIBNETFILTER_CTTIMEOUT_CFLAGS and LIBNETFILTER_CTTIMEOUT_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.

# ./configure --prefix=/usr --disable-cthelper --disable-cttimeout

<snip>

config.status: executing depfiles commands
config.status: executing libtool commands

conntrack-tools configuration:
userspace conntrack helper support: no
conntrack timeout support: no

# make
Making all in extensions
make[1]: Entering directory `/root/conntrack-tools/extensions'
  CC       libct_proto_tcp.lo
  CCLD     libct_proto_tcp.la

<snip>

YACC read_config_yy.c
updating read_config_yy.h

  CC       read_config_yy.o
  LEX      read_config_lex.c
  CC       read_config_lex.o

read_config_lex.c: In function ‘yylex’:
read_config_lex.c:2333:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for ( yyl = 0; yyl < yyleng; ++yyl )
^
read_config_lex.c: In function ‘yy_scan_bytes’:
read_config_lex.c:3658:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for ( i = 0; i < _yybytes_len; ++i )

                 ^
  CC       stack.o
  CCLD     conntrackd
  CC       nfct.o
nfct.c:26:59: fatal error: libnetfilter_cttimeout/libnetfilter_cttimeout.h: No such file or directory
 #include <libnetfilter_cttimeout/libnetfilter_cttimeout.h>
                                                           ^

compilation terminated.
make[2]: *** [nfct.o] Error 1
make[2]: Leaving directory `/root/conntrack-tools/src' make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/conntrack-tools/src'
make: *** [all-recursive] Error 1

It didn't check our library path, should we add it in LIBRARY_PATH?

Signature · 2 lines
Thanks & Best Regards
Hangbin Liu <[email protected]>
#3 lore raw
Quoted 70 lines · Hangbin Liu
Quoted 8 lines · Pablo Neira Ayuso
Quoted 3 lines · Hangbin Liu

If we do not have libnetfilter_cttimeout and disabled cttimeout, conntrack-tools will compile fail because nfct.c include nfnetlink_cttimeout.h. Fix it by only compile nfct when we have enabled cttimeout

Strange. The nfnetlink_cttimeout.h file is cached inside the conntrack-tools tree:

Quoted 7 lines

conntrack-tools/include/linux/netfilter/nfnetlink_cttimeout.h

Here this compiles fine with my current tree and using:

./configure --prefix=/usr --disable-cthelper --disable-cttimeout

Please, investigate this issue a bit further.

That's weird, on my system without libnetfilter_cttimeout.

# ./configure --prefix=/usr
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes

<snip>

checking for LIBNETFILTER_CONNTRACK... yes
checking for LIBNETFILTER_CTTIMEOUT... no
configure: error: Package requirements (libnetfilter_cttimeout >= 1.0.0) were not met:

No package 'libnetfilter_cttimeout' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix.

Alternatively, you may set the environment variables LIBNETFILTER_CTTIMEOUT_CFLAGS and LIBNETFILTER_CTTIMEOUT_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.

# ./configure --prefix=/usr --disable-cthelper --disable-cttimeout

<snip>

config.status: executing depfiles commands
config.status: executing libtool commands

conntrack-tools configuration:
userspace conntrack helper support: no
conntrack timeout support: no

# make
Making all in extensions
make[1]: Entering directory `/root/conntrack-tools/extensions'
  CC       libct_proto_tcp.lo
  CCLD     libct_proto_tcp.la

<snip>

YACC read_config_yy.c
updating read_config_yy.h

  CC       read_config_yy.o
  LEX      read_config_lex.c
  CC       read_config_lex.o

read_config_lex.c: In function ‘yylex’:
read_config_lex.c:2333:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for ( yyl = 0; yyl < yyleng; ++yyl )
^
read_config_lex.c: In function ‘yy_scan_bytes’:
read_config_lex.c:3658:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for ( i = 0; i < _yybytes_len; ++i )

Quoted 7 lines
                 ^
  CC       stack.o
  CCLD     conntrackd
  CC       nfct.o
nfct.c:26:59: fatal error: libnetfilter_cttimeout/libnetfilter_cttimeout.h: No such file or directory
 #include <libnetfilter_cttimeout/libnetfilter_cttimeout.h>
                                                           ^

OK, I see. That's not nfnetlink_cttimeout.h, it's
libnetfilter_cttimeout.h.

Let me check if I can come up with some alternative solution.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw
Quoted 9 lines · Pablo Neira Ayuso
Quoted 5 lines · Hangbin Liu
Quoted 4 lines · Pablo Neira Ayuso
Quoted 3 lines · Hangbin Liu

If we do not have libnetfilter_cttimeout and disabled cttimeout, conntrack-tools will compile fail because nfct.c include nfnetlink_cttimeout.h. Fix it by only compile nfct when we have enabled cttimeout

OK, I see. That's not nfnetlink_cttimeout.h, it's
libnetfilter_cttimeout.h.

Ah, sorry, my mistake

Quoted 2 lines

Let me check if I can come up with some alternative solution.

Signature · 2 lines
Thanks & Best Regards
Hangbin Liu <[email protected]>
#5 lore raw
Quoted 4 lines · Hangbin Liu
Quoted 3 lines · Pablo Neira Ayuso
Quoted 2 lines · Hangbin Liu
Quoted 1 line · Pablo Neira Ayuso

On Thu, May 08, 2014 at 06:02:25PM +0800, Hangbin Liu wrote:

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

If we do not have libnetfilter_cttimeout and disabled cttimeout, conntrack-tools will compile fail because nfct.c include nfnetlink_cttimeout.h. Fix it by only compile nfct when we have enabled cttimeout

OK, I see. That's not nfnetlink_cttimeout.h, it's
libnetfilter_cttimeout.h.

Ah, sorry, my mistake

Please, give a try to the attached patch.

Thanks.

#6 lore raw
Quoted 9 lines · Pablo Neira Ayuso
Quoted 8 lines · Hangbin Liu
Quoted 7 lines · Pablo Neira Ayuso
Quoted 5 lines · Hangbin Liu
Quoted 4 lines · Pablo Neira Ayuso
Quoted 3 lines · Hangbin Liu

If we do not have libnetfilter_cttimeout and disabled cttimeout, conntrack-tools will compile fail because nfct.c include nfnetlink_cttimeout.h. Fix it by only compile nfct when we have enabled cttimeout

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

OK, I see. That's not nfnetlink_cttimeout.h, it's
libnetfilter_cttimeout.h.

Ah, sorry, my mistake

Please, give a try to the attached patch.

Now, really attaching the patch.

Quoted 1 line

From 34a8e200eee54b4bbecadf52bba8901cae129795 Mon Sep 17 00:00:00 2001

From: Pablo Neira Ayuso <[email protected]>
Date: Mon, 12 May 2014 17:21:21 +0200
Subject: [PATCH] nfct: remove unneeded included header

This fixes a compilation breakage when libnetfilter_cttimeout.h is not installed.

---
 src/nfct.c |    2 --
 1 file changed, 2 deletions(-)
src/nfct.c +0 -2
index 19e44be..533d75d 100644
@@ -22,8 +22,6 @@
 #include <errno.h>
 
 #include <libmnl/libmnl.h>
-#include <linux/netfilter/nfnetlink_cttimeout.h>
-#include <libnetfilter_cttimeout/libnetfilter_cttimeout.h>
 
 #include "linux_list.h"
 #include "nfct.h"
Signature · 1 line
1.7.10.4
#7 lore raw
Quoted 10 lines · Pablo Neira Ayuso
Quoted 9 lines · Pablo Neira Ayuso
Quoted 8 lines · Hangbin Liu
Quoted 7 lines · Pablo Neira Ayuso
Quoted 5 lines · Hangbin Liu
Quoted 4 lines · Pablo Neira Ayuso
Quoted 3 lines · Hangbin Liu

If we do not have libnetfilter_cttimeout and disabled cttimeout, conntrack-tools will compile fail because nfct.c include nfnetlink_cttimeout.h. Fix it by only compile nfct when we have enabled cttimeout

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

OK, I see. That's not nfnetlink_cttimeout.h, it's
libnetfilter_cttimeout.h.

Ah, sorry, my mistake

Please, give a try to the attached patch.

Now, really attaching the patch.

Good, this works for me.

Quoted 30 lines

From 34a8e200eee54b4bbecadf52bba8901cae129795 Mon Sep 17 00:00:00 2001
From: Pablo Neira Ayuso <[email protected]>
Date: Mon, 12 May 2014 17:21:21 +0200
Subject: [PATCH] nfct: remove unneeded included header

This fixes a compilation breakage when libnetfilter_cttimeout.h is not installed.

---
 src/nfct.c |    2 --
 1 file changed, 2 deletions(-)
src/nfct.c +0 -2
index 19e44be..533d75d 100644
@@ -22,8 +22,6 @@
 #include <errno.h>
 
 #include <libmnl/libmnl.h>
-#include <linux/netfilter/nfnetlink_cttimeout.h>
-#include <libnetfilter_cttimeout/libnetfilter_cttimeout.h>
 
 #include "linux_list.h"
 #include "nfct.h"
Signature · 1 line
1.7.10.4
Signature · 2 lines
Thanks & Best Regards
Hangbin Liu <[email protected]>