Blame SOURCES/iptables-1.4.21-move_XT_LOCK_NAME_to_config.h.patch

9c64ad
Adapted version of
9c64ad
9c64ad
commit 836846f0d747e1be8e37d2d43b215a68b30ea1a9
9c64ad
Author: Lorenzo Colitti <lorenzo@google.com>
9c64ad
Date:   Thu Mar 16 12:54:20 2017 +0900
9c64ad
9c64ad
    iptables: move XT_LOCK_NAME from CFLAGS to config.h.
9c64ad
    
9c64ad
    This slightly simplifies configure.ac and results in more
9c64ad
    correct dependencies.
9c64ad
    
9c64ad
    Tested by running ./configure with --with-xt-lock-name and
9c64ad
    without, and using strace to verify that the right lock is used.
9c64ad
    
9c64ad
    $ make distclean-recursive && ./autogen.sh &&
9c64ad
      ./configure --disable-nftables --prefix /tmp/iptables &&
9c64ad
      make -j64 &&
9c64ad
      make install &&
9c64ad
      sudo strace -e open,flock /tmp/iptables/sbin/iptables -L foo
9c64ad
    ...
9c64ad
    open("/run/xtables.lock", O_RDONLY|O_CREAT, 0600) = 3
9c64ad
    flock(3, LOCK_EX|LOCK_NB)               = 0
9c64ad
    
9c64ad
    $ make distclean-recursive && ./autogen.sh && \
9c64ad
      ./configure --disable-nftables --prefix /tmp/iptables \
9c64ad
      --with-xt-lock-name=/tmp/iptables/run/xtables.lock &&
9c64ad
      make -j64 &&
9c64ad
      make install &&
9c64ad
      sudo strace -e open,flock /tmp/iptables/sbin/iptables -L foo
9c64ad
    ...
9c64ad
    open("/tmp/iptables/run/xtables.lock", O_RDONLY|O_CREAT, 0600) = 3
9c64ad
    flock(3, LOCK_EX|LOCK_NB)               = 0
9c64ad
    
9c64ad
    Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
9c64ad
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
9c64ad
9c64ad
diff -up iptables-1.4.21/configure.ac.move_XT_LOCK_NAME_to_config.h iptables-1.4.21/configure.ac
9c64ad
--- iptables-1.4.21/configure.ac.move_XT_LOCK_NAME_to_config.h	2017-04-05 14:48:11.855229929 +0200
9c64ad
+++ iptables-1.4.21/configure.ac	2017-04-05 14:48:11.856229937 +0200
9c64ad
@@ -122,7 +122,7 @@ AM_CONDITIONAL([HAVE_LIBNFNETLINK], [tes
9c64ad
 regular_CFLAGS="-Wall -Waggregate-return -Wmissing-declarations \
9c64ad
 	-Wmissing-prototypes -Wredundant-decls -Wshadow -Wstrict-prototypes \
9c64ad
 	-Winline -pipe";
9c64ad
-regular_CPPFLAGS="${largefile_cppflags} -DXT_LOCK_NAME=\\\"\${xt_lock_name}\\\" -D_REENTRANT \
9c64ad
+regular_CPPFLAGS="${largefile_cppflags} -D_REENTRANT \
9c64ad
 	-DXTABLES_LIBDIR=\\\"\${xtlibdir}\\\" -DXTABLES_INTERNAL";
9c64ad
 kinclude_CPPFLAGS="";
9c64ad
 if [[ -n "$kbuilddir" ]]; then
9c64ad
@@ -160,7 +160,9 @@ AC_SUBST([libxtables_vcurrent])
9c64ad
 AC_SUBST([libxtables_vage])
9c64ad
 libxtables_vmajor=$(($libxtables_vcurrent - $libxtables_vage));
9c64ad
 AC_SUBST([libxtables_vmajor])
9c64ad
-AC_SUBST([xt_lock_name])
9c64ad
+
9c64ad
+AC_DEFINE_UNQUOTED([XT_LOCK_NAME], "${xt_lock_name}",
9c64ad
+	[Location of the iptables lock file])
9c64ad
 
9c64ad
 AC_CONFIG_FILES([Makefile extensions/GNUmakefile include/Makefile
9c64ad
 	iptables/Makefile iptables/xtables.pc
9c64ad
diff -up iptables-1.4.21/iptables/xshared.c.move_XT_LOCK_NAME_to_config.h iptables-1.4.21/iptables/xshared.c
9c64ad
--- iptables-1.4.21/iptables/xshared.c.move_XT_LOCK_NAME_to_config.h	2017-04-05 14:48:11.855229929 +0200
9c64ad
+++ iptables-1.4.21/iptables/xshared.c	2017-04-05 14:48:11.856229937 +0200
9c64ad
@@ -1,3 +1,4 @@
9c64ad
+#include <config.h>
9c64ad
 #include <getopt.h>
9c64ad
 #include <errno.h>
9c64ad
 #include <libgen.h>