* [PATCH] iptables: move XT_LOCK_NAME from CFLAGS to config.h.
@ 2017-03-16 3:54 Lorenzo Colitti
2017-03-17 13:14 ` Pablo Neira Ayuso
0 siblings, 1 reply; 2+ messages in thread
From: Lorenzo Colitti @ 2017-03-16 3:54 UTC (permalink / raw)
To: netfilter-devel; +Cc: pablo, jscherpelz, Lorenzo Colitti
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>
---
configure.ac | 6 ++++--
iptables/xshared.c | 1 +
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index b27502667c..221812a8f3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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
diff --git a/iptables/xshared.c b/iptables/xshared.c
index 383ecf2cf2..9b8e856e25 100644
--- a/iptables/xshared.c
+++ b/iptables/xshared.c
@@ -1,3 +1,4 @@
+#include <config.h>
#include <getopt.h>
#include <errno.h>
#include <libgen.h>
--
2.12.0.367.g23dc2f6d3c-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] iptables: move XT_LOCK_NAME from CFLAGS to config.h.
2017-03-16 3:54 [PATCH] iptables: move XT_LOCK_NAME from CFLAGS to config.h Lorenzo Colitti
@ 2017-03-17 13:14 ` Pablo Neira Ayuso
0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2017-03-17 13:14 UTC (permalink / raw)
To: Lorenzo Colitti; +Cc: netfilter-devel, jscherpelz
On Thu, Mar 16, 2017 at 12:54:20PM +0900, Lorenzo Colitti wrote:
> 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
Applied, thanks Lorenzo.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-03-17 13:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-16 3:54 [PATCH] iptables: move XT_LOCK_NAME from CFLAGS to config.h Lorenzo Colitti
2017-03-17 13:14 ` Pablo Neira Ayuso
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.