]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
iptables: move XT_LOCK_NAME from CFLAGS to config.h.
authorLorenzo Colitti <lorenzo@google.com>
Thu, 16 Mar 2017 03:54:20 +0000 (12:54 +0900)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 17 Mar 2017 13:20:39 +0000 (14:20 +0100)
This slightly simplifies configure.ac and results in more
correct dependencies.

Tested by running ./configure with --with-xt-lock-name and
without, and using strace to verify that the right lock is used.

$ make distclean-recursive && ./autogen.sh &&
  ./configure --disable-nftables --prefix /tmp/iptables &&
  make -j64 &&
  make install &&
  sudo strace -e open,flock /tmp/iptables/sbin/iptables -L foo
...
open("/run/xtables.lock", O_RDONLY|O_CREAT, 0600) = 3
flock(3, LOCK_EX|LOCK_NB)               = 0

$ make distclean-recursive && ./autogen.sh && \
  ./configure --disable-nftables --prefix /tmp/iptables \
  --with-xt-lock-name=/tmp/iptables/run/xtables.lock &&
  make -j64 &&
  make install &&
  sudo strace -e open,flock /tmp/iptables/sbin/iptables -L foo
...
open("/tmp/iptables/run/xtables.lock", O_RDONLY|O_CREAT, 0600) = 3
flock(3, LOCK_EX|LOCK_NB)               = 0

Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
configure.ac
iptables/xshared.c

index b27502667cdf21e041d272c14e5f335e5fbebd5e..221812a8f3f1fd30a2fa8e98b8cf615064834203 100644 (file)
@@ -197,7 +197,7 @@ AC_SUBST([blacklist_6_modules])
 regular_CFLAGS="-Wall -Waggregate-return -Wmissing-declarations \
        -Wmissing-prototypes -Wredundant-decls -Wshadow -Wstrict-prototypes \
        -Winline -pipe";
-regular_CPPFLAGS="${largefile_cppflags} -DXT_LOCK_NAME=\\\"\${xt_lock_name}\\\" -D_REENTRANT \
+regular_CPPFLAGS="${largefile_cppflags} -D_REENTRANT \
        -DXTABLES_LIBDIR=\\\"\${xtlibdir}\\\" -DXTABLES_INTERNAL";
 kinclude_CPPFLAGS="";
 if [[ -n "$kbuilddir" ]]; then
@@ -235,7 +235,9 @@ AC_SUBST([libxtables_vcurrent])
 AC_SUBST([libxtables_vage])
 libxtables_vmajor=$(($libxtables_vcurrent - $libxtables_vage));
 AC_SUBST([libxtables_vmajor])
-AC_SUBST([xt_lock_name])
+
+AC_DEFINE_UNQUOTED([XT_LOCK_NAME], "${xt_lock_name}",
+       [Location of the iptables lock file])
 
 AC_CONFIG_FILES([Makefile extensions/GNUmakefile include/Makefile
        iptables/Makefile iptables/xtables.pc
index 383ecf2cf2d4d6b5838f39fc1c79f848943d3147..9b8e856e25d828811033e5fa2d0227d8bd36f7c1 100644 (file)
@@ -1,3 +1,4 @@
+#include <config.h>
 #include <getopt.h>
 #include <errno.h>
 #include <libgen.h>