Skip to contentSkip to conversation

iptables updates

PATCH Applied Jan Engelhardt 2 participants 22 messages Apr 15, 2008 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Following are:

╟ Resolve warnings on 64-bit compile──(0e15210)

Wanted.

╟ Wrap dlopen code into NO_SHARED_LIBS──(2727dbd)

Needed for --enable-static.

╟ Remove support for compilation of conditional extensions──(bfc4434)

As before; header files for SET got added.

╟ Resolve libipt_set warnings──(17a9554)

╟ Update documentation about building the package──(d1acf22)

All those new configure options

╟ configure.ac: AC_SUBST must be separate──(06a71a3)

╟ Dynamically create xtables.h.in with version──(f29980f)

External modules need this in xtables.h.

╟ Remove old functions, constants──(7c7d0eb)

Switches to XTABLES_VERSION, removed the "register_match" wrapper that wrapped xtables_register_match, and exchanges IPT_ALIGN/IP6T_ALIGN to XT_ALIGN (since the former two are just an indirect #define).

╟ Move libipt_recent to libxt_recent──(5b015b7)

It's just the rename - no features, please consider applying.

╟ libxt_recent: add missing --rsource,--rdest options to manpage──(a9299b7)

A manpage fix ontop of the rename.
--
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

#1 lore raw

PATCH 1/10 Resolve warnings on 64-bit compile

---
 xtables.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
xtables.c +2 -2
index 21da4b5..b988054 100644
@@ -318,7 +318,7 @@ static void *load_extension(const char *search_path, const char *prefix,
 		if (next == NULL)
 			next = dir + strlen(dir);
 		snprintf(path, sizeof(path), "%.*s/libxt_%s.so",
-		         next - dir, dir, name);
+		         (unsigned int)(next - dir), dir, name);
 
 		if (dlopen(path, RTLD_NOW) != NULL) {
 			/* Found library.  If it didn't register itself,
@@ -335,7 +335,7 @@ static void *load_extension(const char *search_path, const char *prefix,
 			return ptr;
 
 		snprintf(path, sizeof(path), "%.*s/%s%s.so",
-		         next - dir, dir, prefix, name);
+		         (unsigned int)(next - dir), dir, prefix, name);
 		if (dlopen(path, RTLD_NOW) != NULL) {
 			if (is_target)
 				ptr = find_target(name, DONT_LOAD);
Signature · 1 line
1.5.5.rc3
#2 lore raw

Re: [PATCH 01/10] Resolve warnings on 64-bit compile

Quoted 3 lines · Jan Engelhardt
---
 xtables.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Applied.

#3 lore raw

PATCH 2/10 Wrap dlopen code into NO_SHARED_LIBS

In reply to Jan Engelhardt
---
 xtables.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
xtables.c +2 -0
index b988054..743c07b 100644
@@ -305,6 +305,7 @@ void parse_interface(const char *arg, char *vianame, unsigned char *mask)
 	}
 }
 
+#ifndef NO_SHARED_LIBS
 static void *load_extension(const char *search_path, const char *prefix,
     const char *name, bool is_target)
 {
@@ -353,6 +354,7 @@ static void *load_extension(const char *search_path, const char *prefix,
 
 	return NULL;
 }
+#endif
 
 struct xtables_match *find_match(const char *name, enum xt_tryload tryload,
 				 struct xtables_rule_match **matches)
Signature · 1 line
1.5.5.rc3
#4 lore raw

Re: [PATCH 02/10] Wrap dlopen code into NO_SHARED_LIBS

Quoted 3 lines · Jan Engelhardt
---
 xtables.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

Applied.

#5 lore raw

PATCH 3/10 Remove support for compilation of conditional extensions

In reply to Jan Engelhardt
---
 extensions/.condition-test             |    4 -
 extensions/.condition-test6            |    4 -
 extensions/.set-test                   |    4 -
 extensions/GNUmakefile.in              |   27 +--
 extensions/libip6t_condition.c         |   95 -----
 extensions/libip6t_condition.man       |    4 -
 extensions/libipt_condition.c          |   94 -----
 extensions/libipt_condition.man        |    4 -
 include/linux/netfilter_ipv4/ip_set.h  |  498 ++++++++++++++++++++++++
 include/linux/netfilter_ipv4/ipt_set.h |   21 +
 10 files changed, 522 insertions(+), 233 deletions(-)
 delete mode 100755 extensions/.condition-test
 delete mode 100755 extensions/.condition-test6
 delete mode 100755 extensions/.set-test
 delete mode 100644 extensions/libip6t_condition.c
 delete mode 100644 extensions/libip6t_condition.man
 delete mode 100644 extensions/libipt_condition.c
 delete mode 100644 extensions/libipt_condition.man
 create mode 100644 include/linux/netfilter_ipv4/ip_set.h
 create mode 100644 include/linux/netfilter_ipv4/ipt_set.h
extensions/.condition-test deleted +0 -4
deleted file mode 100755
index 2470a18..0000000
@@ -1,4 +0,0 @@
-#!/bin/sh
-[ "$1" == "provides" -o \
--f "$KERNEL_DIR/include/linux/netfilter_ipv4/ipt_condition.h" ] && \
-echo "condition";
extensions/.condition-test6 deleted +0 -4
deleted file mode 100755
index 15a0f04..0000000
@@ -1,4 +0,0 @@
-#!/bin/sh
-[ "$1" == "provides" -o \
--f "$KERNEL_DIR/include/linux/netfilter_ipv6/ip6t_condition.h" ] && \
-echo "condition";
extensions/.set-test deleted +0 -4
deleted file mode 100755
index 754abfd..0000000
@@ -1,4 +0,0 @@
-#! /bin/sh
-[ "$1" == "provides" -o \
--f "$KERNEL_DIR/include/linux/netfilter_ipv4/ip_set.h" ] && \
-echo "set SET";
extensions/GNUmakefile.in +3 -24
index ee20469..31e6fb7 100644
@@ -32,30 +32,9 @@ endif
 #
 #	Wildcard module list
 #
-pfx_all_mod := $(patsubst ${srcdir}/libxt_%.c,%,$(wildcard ${srcdir}/libxt_*.c))
-pf4_all_mod := $(patsubst ${srcdir}/libipt_%.c,%,$(wildcard ${srcdir}/libipt_*.c))
-pf6_all_mod := $(patsubst ${srcdir}/libip6t_%.c,%,$(wildcard ${srcdir}/libip6t_*.c))
-
-#
-#	Conditional module list
-#
-pfx_cond_mod := $(foreach i,$(wildcard ${srcdir}/.*-testx),$(shell KERNEL_DIR=${ksourcedir} ${i} provides))
-pf4_cond_mod := $(foreach i,$(wildcard ${srcdir}/.*-test),$(shell KERNEL_DIR=${ksourcedir} ${i} provides))
-pf6_cond_mod := $(foreach i,$(wildcard ${srcdir}/.*-test6),$(shell KERNEL_DIR=${ksourcedir} ${i} provides))
-
-#
-#	Conditional modules to build
-#
-pfx_bc_mod := $(foreach i,$(wildcard ${srcdir}/.*-testx),$(shell KERNEL_DIR=${ksourcedir} ${i}))
-pf4_bc_mod := $(foreach i,$(wildcard ${srcdir}/.*-test),$(shell KERNEL_DIR=${ksourcedir} ${i}))
-pf6_bc_mod := $(foreach i,$(wildcard ${srcdir}/.*-test6),$(shell KERNEL_DIR=${ksourcedir} ${i}))
-
-#
-#	Total list of modules to build
-#
-pfx_build_mod := $(filter-out ${pfx_cond_mod},${pfx_all_mod}) ${pfx_bc_mod}
-pf4_build_mod := $(filter-out ${pf4_cond_mod},${pf4_all_mod}) ${pf4_bc_mod}
-pf6_build_mod := $(filter-out ${pf6_cond_mod},${pf6_all_mod}) ${pf6_bc_mod}
+pfx_build_mod := $(patsubst ${srcdir}/libxt_%.c,%,$(wildcard ${srcdir}/libxt_*.c))
+pf4_build_mod := $(patsubst ${srcdir}/libipt_%.c,%,$(wildcard ${srcdir}/libipt_*.c))
+pf6_build_mod := $(patsubst ${srcdir}/libip6t_%.c,%,$(wildcard ${srcdir}/libip6t_*.c))
 pfx_objs      := $(patsubst %,libxt_%.o,${pfx_build_mod})
 pf4_objs      := $(patsubst %,libipt_%.o,${pf4_build_mod})
 pf6_objs      := $(patsubst %,libip6t_%.o,${pf6_build_mod})
extensions/libip6t_condition.c deleted +0 -95

95 lines not on this page · raw message

extensions/libip6t_condition.man deleted +0 -4
deleted file mode 100644
index e0bba75..0000000
@@ -1,4 +0,0 @@
-This matches if a specific /proc filename is '0' or '1'.
-.TP
-.BR "--condition " "[!] \fIfilename"
-Match on boolean value stored in /proc/net/ip6t_condition/filename file
extensions/libipt_condition.c deleted +0 -94

94 lines not on this page · raw message

extensions/libipt_condition.man deleted +0 -4
deleted file mode 100644
index ce2aa95..0000000
@@ -1,4 +0,0 @@
-This matches if a specific /proc filename is '0' or '1'.
-.TP
-.BI "--condition " "[!] \fIfilename\fP"
-Match on boolean value stored in /proc/net/ipt_condition/filename file
include/linux/netfilter_ipv4/ip_set.h new file +498 -0

498 lines not on this page · raw message

include/linux/netfilter_ipv4/ipt_set.h new file +21 -0
new file mode 100644
index 0000000..2a18b93
@@ -0,0 +1,21 @@
+#ifndef _IPT_SET_H
+#define _IPT_SET_H
+
+#include <linux/netfilter_ipv4/ip_set.h>
+
+struct ipt_set_info {
+	ip_set_id_t index;
+	u_int32_t flags[IP_SET_MAX_BINDINGS + 1];
+};
+
+/* match info */
+struct ipt_set_info_match {
+	struct ipt_set_info match_set;
+};
+
+struct ipt_set_info_target {
+	struct ipt_set_info add_set;
+	struct ipt_set_info del_set;
+};
+
+#endif /*_IPT_SET_H*/
Signature · 1 line
1.5.5.rc3
#6 lore raw

Re: [PATCH 03/10] Remove support for compilation of conditional extensions

Quoted 13 lines · Jan Engelhardt
---
 extensions/.condition-test             |    4 -
 extensions/.condition-test6            |    4 -
 extensions/.set-test                   |    4 -
 extensions/GNUmakefile.in              |   27 +--
 extensions/libip6t_condition.c         |   95 -----
 extensions/libip6t_condition.man       |    4 -
 extensions/libipt_condition.c          |   94 -----
 extensions/libipt_condition.man        |    4 -
 include/linux/netfilter_ipv4/ip_set.h  |  498 ++++++++++++++++++++++++
 include/linux/netfilter_ipv4/ipt_set.h |   21 +
 10 files changed, 522 insertions(+), 233 deletions(-)
 delete mode 100755 extensions/.condition-test
Quoted 8 lines
 delete mode 100755 extensions/.condition-test6
 delete mode 100755 extensions/.set-test
 delete mode 100644 extensions/libip6t_condition.c
 delete mode 100644 extensions/libip6t_condition.man
 delete mode 100644 extensions/libipt_condition.c
 delete mode 100644 extensions/libipt_condition.man
 create mode 100644 include/linux/netfilter_ipv4/ip_set.h
 create mode 100644 include/linux/netfilter_ipv4/ipt_set.h

Applied.

#7 lore raw

PATCH 4/10 Resolve libipt_set warnings

In reply to Jan Engelhardt
---
 extensions/libipt_set.h |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)
extensions/libipt_set.h +9 -9
index 02de0fa..3e70d7b 100644
@@ -12,9 +12,9 @@
 #endif
 
 static void
-parse_bindings(const char *optarg, struct ipt_set_info *info)
+parse_bindings(const char *opt_arg, struct ipt_set_info *info)
 {
-	char *saved = strdup(optarg);
+	char *saved = strdup(opt_arg);
 	char *ptr, *tmp = saved;
 	int i = 0;
 	
@@ -66,8 +66,8 @@ static void get_set_byname(const char *setname, struct ipt_set_info *info)
 	if (size != sizeof(struct ip_set_req_get_set))
 		exit_error(OTHER_PROBLEM,
 			   "Incorrect return size from kernel during ipset lookup, "
-			   "(want %ld, got %ld)\n",
-			   sizeof(struct ip_set_req_get_set), size);
+			   "(want %zu, got %zu)\n",
+			   sizeof(struct ip_set_req_get_set), (size_t)size);
 	if (req.set.index == IP_SET_INVALID_ID)
 		exit_error(PARAMETER_PROBLEM,
 			   "Set %s doesn't exist.\n", setname);
@@ -75,7 +75,7 @@ static void get_set_byname(const char *setname, struct ipt_set_info *info)
 	info->index = req.set.index;
 }
 
-static void get_set_byid(char * setname, ip_set_id_t index)
+static void get_set_byid(char * setname, ip_set_id_t idx)
 {
 	struct ip_set_req_get_set req;
 	socklen_t size = sizeof(struct ip_set_req_get_set);
@@ -83,7 +83,7 @@ static void get_set_byid(char * setname, ip_set_id_t index)
 
 	req.op = IP_SET_OP_GET_BYINDEX;
 	req.version = IP_SET_PROTOCOL_VERSION;
-	req.set.index = index;
+	req.set.index = idx;
 	res = get_set_getsockopt(&req, &size);
 	if (res != 0)
 		exit_error(OTHER_PROBLEM,
@@ -92,11 +92,11 @@ static void get_set_byid(char * setname, ip_set_id_t index)
 	if (size != sizeof(struct ip_set_req_get_set))
 		exit_error(OTHER_PROBLEM,
 			   "Incorrect return size from kernel during ipset lookup, "
-			   "(want %ld, got %ld)\n",
-			   sizeof(struct ip_set_req_get_set), size);
+			   "(want %zu, got %zu)\n",
+			   sizeof(struct ip_set_req_get_set), (size_t)size);
 	if (req.set.name[0] == '\0')
 		exit_error(PARAMETER_PROBLEM,
-			   "Set id %i in kernel doesn't exist.\n", index);
+			   "Set id %i in kernel doesn't exist.\n", idx);
 
 	strncpy(setname, req.set.name, IP_SET_MAXNAMELEN);
 }
Signature · 1 line
1.5.5.rc3
#8 lore raw

Re: [PATCH 04/10] Resolve libipt_set warnings

Quoted 3 lines · Jan Engelhardt
---
 extensions/libipt_set.h |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

Applied. Please include the warnings a patch fixes in the commit message.

#9 lore raw

PATCH 5/10 Update documentation about building the package

In reply to Jan Engelhardt
---
 INSTALL      |   96 ++++++++++++++++++++++++++++++++------------------
 configure.ac |    4 +-
 2 files changed, 64 insertions(+), 36 deletions(-)
INSTALL +62 -34
index a41e0cc..4a44989 100644
@@ -1,52 +1,80 @@
-FOLLOW THESE STEPS:
+Installation instructions for iptables
+======================================
 
-0) There may be some outstanding bugfixes or tweaks which are not yet
-   in the official kernel.  Those are now (as of iptables-1.2.7) kept
-   in a seperate package, called patch-o-matic.  It is available from
-   ftp://ftp.netfilter.org/pub/patch-o-matic/
+iptables uses the well-known configure(autotools) infrastructure.
 
-1) Next, make the package. If you use a standard distribution kernel,
-   just run ./configure.
+	$ ./configure
+	$ make
+	# make install
 
-   If you want to build against an own kernel tree:
 
-	$ ./configure --with-kernel=/home/jengelh/mykernel
+Prerequisites
+=============
 
-   or whereever you put it. If you are using a dedicated kernel build
-   directory, you use:
+	* no kernel-source required
 
-	$ ./configure --with-kbuild=<<where-built>> --with-ksource=<<source>>
+	* but obviously a compiler, glibc-devel and linux-kernel-headers
+	  (/usr/include/linux)
 
-2) Finally, you need to install the binaries and shared libraries:
 
-	# make install
+Configuring and compiling
+=========================
 
-That's it!
-================================================================
-PROBLEMS YOU MAY ENCOUNTER:
+./configure [options]
 
-1) This package requires a 2.4.4 kernel, or above.
+--prefix=
 
-2) If you get the kernel directory wrong, you may get compile failures.
+	The prefix to put all installed files under. It defaults to
+	/usr/local, so the binaries will go into /usr/local/bin, sbin,
+	manpages into /usr/local/share/man, etc.
 
-3) If you want to specify alternate directories for installation
-(instead of /usr/local/ bin lib man), do this:
+--with-xtlibdir=
 
-	$ ./configure --prefix=/usr
-	$ make
-	# make install
+	The path to where Xtables extensions should be installed to. It
+	defaults to ${prefix}/libexec/xtables.
+
+--enable-devel (or --disable-devel)
+
+	This option causes development files to be installed to
+	${includedir}, which is needed for building additional packages,
+	such as Xtables-addons or other 3rd-party extensions.
+
+	It is enabled by default.
+
+--enable-libipq
+
+	This option causes libipq to be installed into ${libdir} and
+	${includedir}.
+
+--enable-static
+
+	Enable building single standalone multipurpose binaries,
+	(iptables-static and ip6tables-static), which contain every
+	extension compiled-in (and does not support additional
+	extensions).
+
+--with-ksource=
+
+	Xtables does not depend on kernel headers anymore, but you can
+	optionally specify a search path to include anyway. This is
+	probably only useful for development.
+
+If you want to enable debugging, use
+
+	./configure CFLAGS="-ggdb3 -O0"
 
-4) The make process will automatically build a multipurpose binary under the
-   names iptables-multi and ip6tables-multi.
+(-O0 is used to turn off instruction reordering, which makes debugging
+much easier.)
 
-5) If you want to build a statically linked version of the iptables binary,
-   without the need for loading the plugins at runtime (e.g. for an embedded
-   device or router-on-a-disk), please use
 
-	$ ./configure --enable-static
+Other notes
+===========
 
-   which will build both a semi-static multi binary (iptables-mtss, uses
-   libc but not plugins) and a fully static multi binary (iptables-static).
+The make process will automatically build multipurpose binaries.
+These have the core (iptables), -save, -restore and -xml code
+compiled into one binary, but extensions remain as modules.
 
-6) If you want to install libipq (old interface), add --enable-devel to
-   ./configure.
+If you want to build a statically linked version of the iptables binary,
+without the need for loading the plugins at runtime (e.g. for an
+embedded device or router-on-a-disk), you can use the --enable-static
+configure flag.
configure.ac +2 -2
index 10d4380..42fb728 100644
@@ -22,9 +22,9 @@ AC_ARG_WITH([ksource],
 	[ksourcedir="$withval"])
 AC_ARG_WITH([xtlibdir],
 	AS_HELP_STRING([--with-xtlibdir=PATH],
-	[Path to iptables modules [[LIBEXECDIR/iptables]]]),
+	[Path where to install Xtables extensions [[LIBEXECDIR/xtables]]]),
 	[xtlibdir="$withval"],
-	[xtlibdir="${libexecdir}/iptables"])
+	[xtlibdir="${libexecdir}/xtables"])
 AC_ARG_ENABLE([devel],
 	AS_HELP_STRING([--enable-devel],
 	[Install Xtables development headers]),
Signature · 1 line
1.5.5.rc3
#10 lore raw

Re: [PATCH 05/10] Update documentation about building the package

Quoted 4 lines · Jan Engelhardt
---
 INSTALL      |   96 ++++++++++++++++++++++++++++++++------------------
 configure.ac |    4 +-
 2 files changed, 64 insertions(+), 36 deletions(-)

Applied.

#11 lore raw

PATCH 6/10 configure.ac: AC_SUBST must be separate

In reply to Jan Engelhardt
---
 configure.ac |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
configure.ac +2 -1
index 42fb728..2d9862e 100644
@@ -51,7 +51,8 @@ if [[ -n "$ksourcedir" ]]; then
 	kinclude_CFLAGS="$kinclude_CFLAGS -I $ksourcedir/include";
 fi;
 
-AC_SUBST([regular_CFLAGS kinclude_CFLAGS])
+AC_SUBST([regular_CFLAGS])
+AC_SUBST([kinclude_CFLAGS])
 AC_SUBST([kbuilddir])
 AC_SUBST([ksourcedir])
 AC_SUBST([xtlibdir])
Signature · 1 line
1.5.5.rc3
#12 lore raw

Re: [PATCH 06/10] configure.ac: AC_SUBST must be separate

Quoted 3 lines · Jan Engelhardt
---
 configure.ac |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Applied.

#13 lore raw

PATCH 7/10 Dynamically create xtables.h.in with version

In reply to Jan Engelhardt
---
 configure.ac         |    2 +-
 include/xtables.h    |  216 -----------------------------------------
 include/xtables.h.in |  218 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 219 insertions(+), 217 deletions(-)
 delete mode 100644 include/xtables.h
 create mode 100644 include/xtables.h.in
configure.ac +1 -1
index 2d9862e..b6afa34 100644
@@ -56,4 +56,4 @@ AC_SUBST([kinclude_CFLAGS])
 AC_SUBST([kbuilddir])
 AC_SUBST([ksourcedir])
 AC_SUBST([xtlibdir])
-AC_OUTPUT([Makefile extensions/GNUmakefile libipq/Makefile])
+AC_OUTPUT([Makefile extensions/GNUmakefile libipq/Makefile include/xtables.h])
include/xtables.h deleted +0 -216

216 lines not on this page · raw message

include/xtables.h.in new file +218 -0

218 lines not on this page · raw message

Signature · 1 line
1.5.5.rc3
#14 lore raw

Re: [PATCH 07/10] Dynamically create xtables.h.in with version

Quoted 8 lines · Jan Engelhardt
---
 configure.ac         |    2 +-
 include/xtables.h    |  216 -----------------------------------------
 include/xtables.h.in |  218 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 219 insertions(+), 217 deletions(-)
 delete mode 100644 include/xtables.h
 create mode 100644 include/xtables.h.in

Applied.

#15 lore raw

PATCH 9/10 Move libipt_recent to libxt_recent

In reply to Jan Engelhardt
---
 extensions/libipt_recent.c                |  228 --------------------
 extensions/libipt_recent.man              |   93 ---------
 extensions/libxt_recent.c                 |  229 +++++++++++++++++++++
 extensions/libxt_recent.man               |   93 +++++++++
 include/linux/netfilter/xt_recent.h       |   26 +++
 include/linux/netfilter_ipv4/ipt_recent.h |   27 ---
 6 files changed, 348 insertions(+), 348 deletions(-)
 delete mode 100644 extensions/libipt_recent.c
 delete mode 100644 extensions/libipt_recent.man
 create mode 100644 extensions/libxt_recent.c
 create mode 100644 extensions/libxt_recent.man
 create mode 100644 include/linux/netfilter/xt_recent.h
 delete mode 100644 include/linux/netfilter_ipv4/ipt_recent.h
extensions/libipt_recent.c deleted +0 -228
deleted file mode 100644
index 51b0d15..0000000
@@ -1,228 +0,0 @@
-/* Shared library add-on to iptables to add recent matching support. */
-#include <stdio.h>
-#include <netdb.h>
-#include <string.h>
-#include <stdlib.h>
-#include <getopt.h>
-
-#include <iptables.h>
-#include <linux/netfilter_ipv4/ipt_recent.h>
-
-/* Need these in order to not fail when compiling against an older kernel. */
-#ifndef RECENT_NAME
-#define RECENT_NAME	"ipt_recent"
-#endif /* RECENT_NAME */
-
-#ifndef RECENT_VER
-#define RECENT_VER	"unknown"
-#endif /* RECENT_VER */
-
-#ifndef IPT_RECENT_NAME_LEN
-#define IPT_RECENT_NAME_LEN	200
-#endif /* IPT_RECENT_NAME_LEN */
-
-/* Options for this module */
-static const struct option recent_opts[] = {
-	{ .name = "set",      .has_arg = 0, .val = 201 }, 
-	{ .name = "rcheck",   .has_arg = 0, .val = 202 }, 
-	{ .name = "update",   .has_arg = 0, .val = 203 },
-	{ .name = "seconds",  .has_arg = 1, .val = 204 }, 
-	{ .name = "hitcount", .has_arg = 1, .val = 205 },
-	{ .name = "remove",   .has_arg = 0, .val = 206 },
-	{ .name = "rttl",     .has_arg = 0, .val = 207 },
-	{ .name = "name",     .has_arg = 1, .val = 208 },
-	{ .name = "rsource",  .has_arg = 0, .val = 209 },
-	{ .name = "rdest",    .has_arg = 0, .val = 210 },
-	{ .name = NULL }
-};
-
-/* Function which prints out usage message. */
-static void recent_help(void)
-{
-	printf(
-"recent match options:\n"
-"[!] --set                       Add source address to list, always matches.\n"
-"[!] --rcheck                    Match if source address in list.\n"
-"[!] --update                    Match if source address in list, also update last-seen time.\n"
-"[!] --remove                    Match if source address in list, also removes that address from list.\n"
-"    --seconds seconds           For check and update commands above.\n"
-"                                Specifies that the match will only occur if source address last seen within\n"
-"                                the last 'seconds' seconds.\n"
-"    --hitcount hits             For check and update commands above.\n"
-"                                Specifies that the match will only occur if source address seen hits times.\n"
-"                                May be used in conjunction with the seconds option.\n"
-"    --rttl                      For check and update commands above.\n"
-"                                Specifies that the match will only occur if the source address and the TTL\n"
-"                                match between this packet and the one which was set.\n"
-"                                Useful if you have problems with people spoofing their source address in order\n"
-"                                to DoS you via this module.\n"
-"    --name name                 Name of the recent list to be used.  DEFAULT used if none given.\n"
-"    --rsource                   Match/Save the source address of each packet in the recent list table (default).\n"
-"    --rdest                     Match/Save the destination address of each packet in the recent list table.\n"
-RECENT_NAME " " RECENT_VER ": Stephen Frost <[email protected]>.  http://snowman.net/projects/ipt_recent/\n");
-}
-  
-/* Initialize the match. */
-static void recent_init(struct xt_entry_match *match)
-{
-	struct ipt_recent_info *info = (struct ipt_recent_info *)(match)->data;
-
-
-	strncpy(info->name,"DEFAULT",IPT_RECENT_NAME_LEN);
-	/* eventhough IPT_RECENT_NAME_LEN is currently defined as 200,
-	 * better be safe, than sorry */
-	info->name[IPT_RECENT_NAME_LEN-1] = '\0';
-	info->side = IPT_RECENT_SOURCE;
-}
-
-/* Function which parses command options; returns true if it
-   ate an option */
-static int recent_parse(int c, char **argv, int invert, unsigned int *flags,
-                        const void *entry, struct xt_entry_match **match)
-{
-	struct ipt_recent_info *info = (struct ipt_recent_info *)(*match)->data;
-	switch (c) {
-		case 201:
-			if (*flags) exit_error(PARAMETER_PROBLEM,
-					"recent: only one of `--set', `--rcheck' "
-					"`--update' or `--remove' may be set");
-			check_inverse(optarg, &invert, &optind, 0);
-			info->check_set |= IPT_RECENT_SET;
-			if (invert) info->invert = 1;
-			*flags = 1;
-			break;
-			
-		case 202:
-			if (*flags) exit_error(PARAMETER_PROBLEM,
-					"recent: only one of `--set', `--rcheck' "
-					"`--update' or `--remove' may be set");
-			check_inverse(optarg, &invert, &optind, 0);
-			info->check_set |= IPT_RECENT_CHECK;
-			if(invert) info->invert = 1;
-			*flags = 1;
-			break;
-
-		case 203:
-			if (*flags) exit_error(PARAMETER_PROBLEM,
-					"recent: only one of `--set', `--rcheck' "
-					"`--update' or `--remove' may be set");
-			check_inverse(optarg, &invert, &optind, 0);
-			info->check_set |= IPT_RECENT_UPDATE;
-			if (invert) info->invert = 1;
-			*flags = 1;
-			break;
-
-		case 206:
-			if (*flags) exit_error(PARAMETER_PROBLEM,
-					"recent: only one of `--set', `--rcheck' "
-					"`--update' or `--remove' may be set");
-			check_inverse(optarg, &invert, &optind, 0);
-			info->check_set |= IPT_RECENT_REMOVE;
-			if (invert) info->invert = 1;
-			*flags = 1;
-			break;
-
-		case 204:
-			info->seconds = atoi(optarg);
-			break;
-
-		case 205:
-			info->hit_count = atoi(optarg);
-			break;
-
-		case 207:
-			info->check_set |= IPT_RECENT_TTL;
-			break;
-
-		case 208:
-			strncpy(info->name,optarg,IPT_RECENT_NAME_LEN);
-			info->name[IPT_RECENT_NAME_LEN-1] = '\0';
-			break;
-
-		case 209:
-			info->side = IPT_RECENT_SOURCE;
-			break;
-
-		case 210:
-			info->side = IPT_RECENT_DEST;
-			break;
-
-		default:
-			return 0;
-	}
-
-	return 1;
-}
-
-/* Final check; must have specified a specific option. */
-static void recent_check(unsigned int flags)
-{
-
-	if (!flags)
-		exit_error(PARAMETER_PROBLEM,
-			"recent: you must specify one of `--set', `--rcheck' "
-			"`--update' or `--remove'");
-}
-
-/* Prints out the matchinfo. */
-static void recent_print(const void *ip, const struct xt_entry_match *match,
-                         int numeric)
-{
-	struct ipt_recent_info *info = (struct ipt_recent_info *)match->data;
-
-	if (info->invert)
-		fputc('!', stdout);
-
-	printf("recent: ");
-	if(info->check_set & IPT_RECENT_SET) printf("SET ");
-	if(info->check_set & IPT_RECENT_CHECK) printf("CHECK ");
-	if(info->check_set & IPT_RECENT_UPDATE) printf("UPDATE ");
-	if(info->check_set & IPT_RECENT_REMOVE) printf("REMOVE ");
-	if(info->seconds) printf("seconds: %d ",info->seconds);
-	if(info->hit_count) printf("hit_count: %d ",info->hit_count);
-	if(info->check_set & IPT_RECENT_TTL) printf("TTL-Match ");
-	if(info->name) printf("name: %s ",info->name);
-	if(info->side == IPT_RECENT_SOURCE) printf("side: source ");
-	if(info->side == IPT_RECENT_DEST) printf("side: dest");
-}
-
-/* Saves the union ipt_matchinfo in parsable form to stdout. */
-static void recent_save(const void *ip, const struct xt_entry_match *match)
-{
-	struct ipt_recent_info *info = (struct ipt_recent_info *)match->data;
-
-	if (info->invert)
-		printf("! ");
-
-	if(info->check_set & IPT_RECENT_SET) printf("--set ");
-	if(info->check_set & IPT_RECENT_CHECK) printf("--rcheck ");
-	if(info->check_set & IPT_RECENT_UPDATE) printf("--update ");
-	if(info->check_set & IPT_RECENT_REMOVE) printf("--remove ");
-	if(info->seconds) printf("--seconds %d ",info->seconds);
-	if(info->hit_count) printf("--hitcount %d ",info->hit_count);
-	if(info->check_set & IPT_RECENT_TTL) printf("--rttl ");
-	if(info->name) printf("--name %s ",info->name);
-	if(info->side == IPT_RECENT_SOURCE) printf("--rsource ");
-	if(info->side == IPT_RECENT_DEST) printf("--rdest ");
-}
-
-/* Structure for iptables to use to communicate with module */
-static struct xtables_match recent_mt_reg = {
-    .name          = "recent",
-    .version       = XTABLES_VERSION,
-    .family        = PF_INET,
-    .size          = XT_ALIGN(sizeof(struct ipt_recent_info)),
-    .userspacesize = XT_ALIGN(sizeof(struct ipt_recent_info)),
-    .help          = recent_help,
-    .init          = recent_init,
-    .parse         = recent_parse,
-    .final_check   = recent_check,
-    .print         = recent_print,
-    .save          = recent_save,
-    .extra_opts    = recent_opts,
-};
-
-void _init(void)
-{
-	xtables_register_match(&recent_mt_reg);
-}
extensions/libipt_recent.man deleted +0 -93

93 lines not on this page · raw message

extensions/libxt_recent.c new file +229 -0

229 lines not on this page · raw message

extensions/libxt_recent.man new file +93 -0

93 lines not on this page · raw message

include/linux/netfilter/xt_recent.h new file +26 -0
new file mode 100644
index 0000000..5cfeb81
@@ -0,0 +1,26 @@
+#ifndef _LINUX_NETFILTER_XT_RECENT_H
+#define _LINUX_NETFILTER_XT_RECENT_H 1
+
+enum {
+	XT_RECENT_CHECK    = 1 << 0,
+	XT_RECENT_SET      = 1 << 1,
+	XT_RECENT_UPDATE   = 1 << 2,
+	XT_RECENT_REMOVE   = 1 << 3,
+	XT_RECENT_TTL      = 1 << 4,
+
+	XT_RECENT_SOURCE   = 0,
+	XT_RECENT_DEST     = 1,
+
+	XT_RECENT_NAME_LEN = 200,
+};
+
+struct xt_recent_mtinfo {
+	u_int32_t seconds;
+	u_int32_t hit_count;
+	u_int8_t check_set;
+	u_int8_t invert;
+	char name[XT_RECENT_NAME_LEN];
+	u_int8_t side;
+};
+
+#endif /* _LINUX_NETFILTER_XT_RECENT_H */
include/linux/netfilter_ipv4/ipt_recent.h deleted +0 -27
deleted file mode 100644
index 6508a45..0000000
@@ -1,27 +0,0 @@
-#ifndef _IPT_RECENT_H
-#define _IPT_RECENT_H
-
-#define RECENT_NAME	"ipt_recent"
-#define RECENT_VER	"v0.3.1"
-
-#define IPT_RECENT_CHECK  1
-#define IPT_RECENT_SET    2
-#define IPT_RECENT_UPDATE 4
-#define IPT_RECENT_REMOVE 8
-#define IPT_RECENT_TTL   16
-
-#define IPT_RECENT_SOURCE 0
-#define IPT_RECENT_DEST   1
-
-#define IPT_RECENT_NAME_LEN 200
-
-struct ipt_recent_info {
-	u_int32_t   seconds;
-	u_int32_t   hit_count;
-	u_int8_t    check_set;
-	u_int8_t    invert;
-	char        name[IPT_RECENT_NAME_LEN];
-	u_int8_t    side;
-};
-
-#endif /*_IPT_RECENT_H*/
Signature · 1 line
1.5.5.rc3
#16 lore raw

PATCH 10/10 libxt_recent: add missing --rsource,--rdest options to manpage

In reply to Jan Engelhardt
---
 extensions/libxt_recent.man |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
extensions/libxt_recent.man +7 -0
index 25be677..f752577 100644
@@ -15,6 +15,13 @@ source address is already in the list, this will update the existing
 entry. This will always return success (or failure if `!' is passed
 in).
 .TP
+\fB--rsource\fP
+Match/save the source address of each packet in the recent list table. This
+is the default.
+.TP
+\fB--rdest\fP
+Match/save the destination address of each packet in the recent list table.
+.TP
 [\fB!\fR] \fB--rcheck\fR
 Check if the source address of the packet is currently in
 the list.
Signature · 1 line
1.5.5.rc3
#17 lore raw

PATCH 1/1 configure.ac: remove already-defined variables

In reply to Jan Engelhardt

commit e1fea6c3f73ce6f376240bd308dea45c88cfb2e1

Author: Jan Engelhardt <[email protected]>
Date:   Tue Apr 15 13:17:47 2008 +0200

configure.ac: remove already-defined variables

This also fixes the inadvertent expansion of ${xtlibdir}.

---
 Makefile.am |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
Makefile.am +1 -3
index bb7dc4f..dc45b66 100644
@@ -2,8 +2,6 @@
 
 AUTOMAKE_OPTIONS = foreign subdir-objects
 
-regular_CFLAGS  := @regular_CFLAGS@
-kinclude_CFLAGS := @kinclude_CFLAGS@
 AM_CFLAGS        = ${regular_CFLAGS} -I${top_builddir}/include -I${top_srcdir}/include ${kinclude_CFLAGS}
 SUBDIRS         := extensions
 if ENABLE_LIBIPQ
@@ -75,7 +73,7 @@ man_MANS         := iptables.8 iptables-restore.8 iptables-save.8 \
 CLEANFILES       := iptables.8 ip6tables.8
 if ENABLE_DEVEL
 include_HEADERS  := include/xtables.h include/iptables.h include/ip6tables.h
-iptcdir          := ${includedir}/libiptc
+iptcdir           = ${includedir}/libiptc
 iptc_HEADERS     := include/libiptc/libxtc.h \
                     include/libiptc/ipt_kernel_headers.h
 endif
#18 lore raw

Re: [PATCH 11] configure.ac: remove already-defined variables

Quoted 7 lines · Jan Engelhardt

commit e1fea6c3f73ce6f376240bd308dea45c88cfb2e1

Author: Jan Engelhardt <[email protected]>
Date:   Tue Apr 15 13:17:47 2008 +0200

configure.ac: remove already-defined variables

This also fixes the inadvertent expansion of ${xtlibdir}.

Applied.

A message that is not in the archive (sent off-list or not yet received): 7c7d0eb43b7b4ca3711ae0dbe17ae7ef66fb02f8.1208255176.git.jengelh@computergmbh.de

#20 lore raw

Re: [PATCH 08/10] Remove old functions, constants

Quoted 6 lines · Jan Engelhardt
(quoted diff) +1 -3
 	printf(
-"LOG v%s options:\n"
+"LOG target options:\n"
 " --log-level level		Level of logging (numeric or see syslog.conf)\n"
-" --log-prefix prefix		Prefix log messages with this prefix.\n\n"
-" --log-tcp-sequence		Log TCP sequence numbers.\n\n"

Review

Quoted 10 lines
(quoted diff) +5 -4
-" --log-tcp-options		Log TCP options.\n\n"
-" --log-ip-options		Log IP options.\n\n"
-" --log-uid			Log UID owning the local socket.\n\n",
-IPTABLES_VERSION);
+" --log-prefix prefix		Prefix log messages with this prefix.\n"
+" --log-tcp-sequence		Log TCP sequence numbers.\n"
+" --log-tcp-options		Log TCP options.\n"
+" --log-ip-options		Log IP options.\n"
+" --log-uid			Log UID owning the local socket.\n");
 }

This doesn't match the patch description. Why are you changing help texts?

#21 lore raw

Re: [PATCH 08/10] Remove old functions, constants

Quoted 22 lines · Patrick McHardy
Quoted 11 lines · Jan Engelhardt
	printf(

-"LOG v%s options:\n"
+"LOG target options:\n"
" --log-level level Level of logging (numeric or see
syslog.conf)\n"
-" --log-prefix prefix Prefix log messages with this
prefix.\n\n"
-" --log-tcp-sequence Log TCP sequence numbers.\n\n"
-" --log-tcp-options Log TCP options.\n\n"
-" --log-ip-options Log IP options.\n\n"
-" --log-uid Log UID owning the local socket.\n\n",

Quoted 8 lines

-IPTABLES_VERSION);
+" --log-prefix prefix Prefix log messages with this
prefix.\n"
+" --log-tcp-sequence Log TCP sequence numbers.\n"
+" --log-tcp-options Log TCP options.\n"
+" --log-ip-options Log IP options.\n"
+" --log-uid Log UID owning the local socket.\n");
}

Quoted 3 lines

This doesn't match the patch description. Why are you changing help texts?

These are just the newlines; to follow the style of the other extensions.

#22 lore raw

Re: [PATCH 08/10] Remove old functions, constants

Quoted 22 lines · Jan Engelhardt
Quoted 21 lines · Patrick McHardy
Quoted 19 lines · Jan Engelhardt
	printf(

-"LOG v%s options:\n"
+"LOG target options:\n"
" --log-level level Level of logging (numeric or see
syslog.conf)\n"
-" --log-prefix prefix Prefix log messages with this
prefix.\n\n"
-" --log-tcp-sequence Log TCP sequence numbers.\n\n"
-" --log-tcp-options Log TCP options.\n\n"
-" --log-ip-options Log IP options.\n\n"
-" --log-uid Log UID owning the local socket.\n\n",
-IPTABLES_VERSION);
+" --log-prefix prefix Prefix log messages with this
prefix.\n"
+" --log-tcp-sequence Log TCP sequence numbers.\n"
+" --log-tcp-options Log TCP options.\n"
+" --log-ip-options Log IP options.\n"
+" --log-uid Log UID owning the local socket.\n");
}

Quoted 5 lines
Quoted 3 lines

This doesn't match the patch description. Why are you changing help texts?

These are just the newlines; to follow the style of the other extensions.

OK, I'll apply it.