]> git.ipfire.org Git - thirdparty/iptables.git/log
thirdparty/iptables.git
12 years agolibxt_osf: fix missing --ttl and --log in save output
Pablo Neira Ayuso [Sun, 24 Mar 2013 09:55:07 +0000 (10:55 +0100)] 
libxt_osf: fix missing --ttl and --log in save output

closes http://bugzilla.netfilter.org/show_bug.cgi?id=805

Reported-by: Bourne Without <blackhole@airpost.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agoip[6]tables: show --protocol instead of --proto in usage
Mart Frauenlob [Wed, 20 Mar 2013 04:14:06 +0000 (04:14 +0000)] 
ip[6]tables: show --protocol instead of --proto in usage

As the man page shows --protocol not --proto, also do so in the usage
text displayed by ip[6]tables -h.

Signed-off-by: Mart Frauenlob <mart.frauenlob@chello.at>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agoRevert "build: resolve link failure for ip6t_NETMAP"
Pablo Neira Ayuso [Sat, 16 Mar 2013 11:15:30 +0000 (12:15 +0100)] 
Revert "build: resolve link failure for ip6t_NETMAP"

This reverts commit 68e77a26111ee6b8f10c735a76891a7de6d57ee6.

The use of libtool was introduced to resolve linking problems
in NETMAP (IPv6 version), but that resulted in RPATH problems
reported from distributors and warnings spotted by libtool at
linking stage.

Since (0ca548b libip6t_NETMAP: Use xtables_ip6mask_to_cidr and
get rid of libip6tc dependency) fixed the NETMAP issue, let's
roll back to our previous stage.

A small conflicts in extensions/GNUmakefile.in has been resolved
in this revert.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agolibip6t_NETMAP: Use xtables_ip6mask_to_cidr and get rid of libip6tc dependency
Pablo Neira Ayuso [Sat, 16 Mar 2013 11:11:07 +0000 (12:11 +0100)] 
libip6t_NETMAP: Use xtables_ip6mask_to_cidr and get rid of libip6tc dependency

This patch changes the NETMAP target extension (IPv6 side) to use
the xtables_ip6mask_to_cidr available in libxtables.

As a side effect, we get rid of the libip6tc dependency.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agobuild: bump version to 1.4.18 v1.4.18
Pablo Neira Ayuso [Sun, 3 Mar 2013 21:40:11 +0000 (22:40 +0100)] 
build: bump version to 1.4.18

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agodoc: rpfilter: invert option should have own paragraph
Florian Westphal [Sun, 17 Feb 2013 22:16:11 +0000 (23:16 +0100)] 
doc: rpfilter: invert option should have own paragraph

Signed-off-by: Florian Westphal <fw@strlen.de>
12 years agodoc: iptables provides up to 5 independent tables
Pablo Neira Ayuso [Sun, 17 Feb 2013 13:05:35 +0000 (14:05 +0100)] 
doc: iptables provides up to 5 independent tables

This closes bugzilla:

http://bugzilla.netfilter.org/show_bug.cgi?id=807

Reported-by: Quentin Armitage <quentin@armitage.org.uk>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agobuild: bump SONAME for libxtables
Jan Engelhardt [Tue, 5 Feb 2013 14:47:02 +0000 (14:47 +0000)] 
build: bump SONAME for libxtables

Commit v1.4.17-16-gefcdba4 updated structs in xtables.h, so age must
become 0 and vcurrent be increased. The latter has already happened in
v1.4.17-6-gd1e7922.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agoMerge branch 'master' of vishnu.netfilter.org:/data/git/iptables
Jozsef Kadlecsik [Thu, 31 Jan 2013 19:36:27 +0000 (20:36 +0100)] 
Merge branch 'master' of vishnu.netfilter.org:/data/git/iptables

12 years agoAdd the "state" alias to the "conntrack" match
Jozsef Kadlecsik [Mon, 28 Jan 2013 20:18:59 +0000 (21:18 +0100)] 
Add the "state" alias to the "conntrack" match

12 years agoIntroduce match/target aliases
Jozsef Kadlecsik [Mon, 28 Jan 2013 20:15:27 +0000 (21:15 +0100)] 
Introduce match/target aliases

The match/target alias allows us to support the syntax of matches, targets
targets merged into other matches/targets.

12 years agodoc: document nat table for IPv6
Pablo Neira Ayuso [Mon, 7 Jan 2013 20:34:39 +0000 (21:34 +0100)] 
doc: document nat table for IPv6

Based on the IPv4 description.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agoMerge branch 'stable' into 'master'
Pablo Neira Ayuso [Mon, 28 Jan 2013 11:35:41 +0000 (12:35 +0100)] 
Merge branch 'stable' into 'master'

12 years agoextensions: S/DNPT: add missing save function
Jan Engelhardt [Thu, 24 Jan 2013 09:37:55 +0000 (09:37 +0000)] 
extensions: S/DNPT: add missing save function

Jean-Michel DILLY reports that `ip6tables -S` exits with

Target `DNPT' is missing save function

when a DNPT rule is invoked. Fix this omission.

References: http://marc.info/?l=netfilter&m=135904831220440&w=2
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agodoc: document the -4 and -6 options
Jan Engelhardt [Tue, 25 Dec 2012 13:11:28 +0000 (13:11 +0000)] 
doc: document the -4 and -6 options

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agodoc: mention -m in the manpage
Jan Engelhardt [Tue, 25 Dec 2012 13:11:27 +0000 (13:11 +0000)] 
doc: mention -m in the manpage

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agodoc: name the supported log levels for ipt_LOG
Jan Engelhardt [Tue, 25 Dec 2012 13:11:23 +0000 (13:11 +0000)] 
doc: name the supported log levels for ipt_LOG

Leonardo Ferreira da Silva Boiko lets it be known that syslogd.conf may
not exist on certain systems. Referencing that manpage is not a good
idea in any case, I believe, since the strings that are accepted are
defined by iptables and not a syslog implementation.

References: http://bugs.debian.org/567564
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agodoc: document iptables-restore's -h option
Jan Engelhardt [Tue, 25 Dec 2012 13:11:22 +0000 (13:11 +0000)] 
doc: document iptables-restore's -h option

References: http://bugs.debian.org/644221
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agodoc: document iptables-restore's -M option
Jan Engelhardt [Tue, 25 Dec 2012 13:11:21 +0000 (13:11 +0000)] 
doc: document iptables-restore's -M option

References: http://bugs.debian.org/644221
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agodoc: document iptables-restore's -v option
Jan Engelhardt [Tue, 25 Dec 2012 13:11:20 +0000 (13:11 +0000)] 
doc: document iptables-restore's -v option

References: http://bugs.debian.org/644221
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agodoc: document iptables-restore's -t option
Jan Engelhardt [Tue, 25 Dec 2012 13:11:19 +0000 (13:11 +0000)] 
doc: document iptables-restore's -t option

References: http://bugs.debian.org/644221
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agodoc: fixup omissions in ip6tables-restore.8
Jan Engelhardt [Tue, 25 Dec 2012 13:11:18 +0000 (13:11 +0000)] 
doc: fixup omissions in ip6tables-restore.8

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agolibxtables: add xtables_print_num
Pablo Neira Ayuso [Mon, 29 Oct 2012 09:49:42 +0000 (10:49 +0100)] 
libxtables: add xtables_print_num

This function is used both by iptables and ip6tables, and
refactorize to avoid longer than 80-chars per column lines
of code.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agolibxtables: add xtables_rule_matches_free
Pablo Neira Ayuso [Fri, 4 Jan 2013 19:27:11 +0000 (20:27 +0100)] 
libxtables: add xtables_rule_matches_free

This function is shared by iptables and ip6tables.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agoiptables: remove unused leftover definitions
Pablo Neira Ayuso [Mon, 29 Oct 2012 09:22:43 +0000 (10:22 +0100)] 
iptables: remove unused leftover definitions

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agoextensions: libip6t_DNAT: set IPv6 DNAT --to-destination
Ulrich Weber [Thu, 3 Jan 2013 00:41:38 +0000 (00:41 +0000)] 
extensions: libip6t_DNAT: set IPv6 DNAT --to-destination

as in IPv4 and fixes DNAT_save

Signed-off-by: Ulrich Weber <ulrich.weber@sophos.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agoextension: libip6t_DNAT: allow port DNAT without address
Ulrich Weber [Thu, 3 Jan 2013 00:39:58 +0000 (00:39 +0000)] 
extension: libip6t_DNAT: allow port DNAT without address

correct parsing of IPv6 port NAT without address NAT,
assume one colon as port information.

Allows:
* address only:
 -j DNAT --to affe::1
 -j DNAT --to [affe::1]

* port only
 -j DNAT --to :80
 -j DNAT --to :80-110
 -j DNAT --to []:80
 -j DNAT --to []:80-110

* address and port
 -j DNAT --to [affe::1]:80
 -j DNAT --to [affe::1]:80-110

Signed-off-by: Ulrich Weber <ulrich.weber@sophos.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agoextensions: libip6t_DNPT: fix wording in DNPT target
Ulrich Weber [Wed, 2 Jan 2013 06:03:49 +0000 (06:03 +0000)] 
extensions: libip6t_DNPT: fix wording in DNPT target

replaces SNPT by DNPT.

This fixes broken help message that points to SNPT.

Signed-off-by: Ulrich Weber <ulrich.weber@sophos.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agobuild: resolve link failure for ip6t_NETMAP
Jan Engelhardt [Tue, 1 Jan 2013 22:47:51 +0000 (22:47 +0000)] 
build: resolve link failure for ip6t_NETMAP

Link stage of libip6t_NETMAP failed since recently.

  CCLD     libip6t_NETMAP.so
/usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld:
cannot find -lip6tc

libip6t_NETMAP.c uses the "ipv6_prefix_length" function from
libip6tc.so; "-lip6tc" is used in the Makefile, but, the directory to
it is not specified.

Why does the link succeed for some people? Because
/usr/lib(64)/libip6tc.so satisfies -lip6tc, but not all environments,
especially those without iptables development files, have that file,
hence this link error can happen.

By suggestion of Mike Frysinger, this patch uses libtool to produce
and link the plugins.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agobump version to 1.4.17 v1.4.17
Pablo Neira Ayuso [Tue, 25 Dec 2012 12:38:36 +0000 (13:38 +0100)] 
bump version to 1.4.17

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agoManpage update: matches are evaluated in the order they are specified.
Jozsef Kadlecsik [Thu, 6 Dec 2012 18:06:28 +0000 (19:06 +0100)] 
Manpage update: matches are evaluated in the order they are specified.

Fixes bugzilla id 797.

12 years agoextensions: libxt_statistic: Fix save output
Tom Eastep [Mon, 19 Nov 2012 10:40:40 +0000 (11:40 +0100)] 
extensions: libxt_statistic: Fix save output

Suppressing '--packet 0' in save output resulted in restore failure.

This patch includes '--packet 0' in save output while continuing to
suppress it in print output.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agoMerge branch 'next' branch that contains new features scheduled for
Pablo Neira Ayuso [Thu, 25 Oct 2012 15:14:26 +0000 (17:14 +0200)] 
Merge branch 'next' branch that contains new features scheduled for
Linux kernel 3.7

12 years agobump iptables to 1.4.16.3 v1.4.16.3
Pablo Neira Ayuso [Thu, 18 Oct 2012 08:50:00 +0000 (10:50 +0200)] 
bump iptables to 1.4.16.3

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agobuild: resolve compile abort in libxt_limit on RHEL5
Jan Engelhardt [Wed, 10 Oct 2012 00:35:14 +0000 (00:35 +0000)] 
build: resolve compile abort in libxt_limit on RHEL5

libxt_limit.c: In function 'print_rate':
libxt_limit.c:124: error: 'INFINITY' undeclared (first use in
this function)

The default mode of glibc-2.15's <features.h> sets
"-D_POSIX_C_SOURCE=200809L", and therefore "-D_ISOC99_SOURCE". However,
on þe olde RHEL 5's glibc-2.5, it only has "-D_POSIX_C_SOURCE=200112L".

Explicitly draw in the definition of INFINITY by always defining
_ISOC99_SOURCE. By doing this, we are moving off of the default set, so
_BSD_SOURCE also needs to be explicitly set to get at IFNAMSIZ that is
used in xt_hashlimit.h.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agobuild: remove symlink-only extensions from static object list
Jan Engelhardt [Mon, 8 Oct 2012 12:04:56 +0000 (12:04 +0000)] 
build: remove symlink-only extensions from static object list

$ ./configure --enable-static --disable-shared --enable-ipv4
  --enable-ipv6 && make
[...]
make[3]: *** No rule to make target "libxt_NOTRACK.o", needed by
"libext.a". Stop.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agobump version to 1.4.16.2 v1.4.16.2
Pablo Neira Ayuso [Mon, 8 Oct 2012 08:09:04 +0000 (10:09 +0200)] 
bump version to 1.4.16.2

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agoiptables: restore NOTRACK functionality, target aliasing
Jan Engelhardt [Sun, 7 Oct 2012 14:32:36 +0000 (14:32 +0000)] 
iptables: restore NOTRACK functionality, target aliasing

Commit v1.4.16-1-g2aaa7ec is testing for real_name (not) being NULL
which was always false (true). real_name was never NULL, so cs->jumpto
would always be used, which rendered -j NOTRACK unusable, since the
chosen real name.revision is for example NOTRACK.1, which does not exist
at the kernel side.

# ./iptables/xtables-multi main4 -t raw -A foo -j NOTRACK
dbg: Using NOTRACK.1
WARNING: The NOTRACK target is obsolete. Use CT instead.
iptables: Protocol wrong type for socket.

To reasonably support the extra-special verdict names, make it so that
real_name remains NULL when an extension defined no alias, which we can
then use to determine whether the user entered an alias name (which
needs to be followed) or not.

[ I have mangled this patch to remove a comment unnecessarily large.
  BTW, this patch gets this very close to the initial target aliasing
  proposal --pablo ]

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agobump version to 1.4.16.1 v1.4.16.1
Pablo Neira Ayuso [Sun, 7 Oct 2012 22:59:40 +0000 (00:59 +0200)] 
bump version to 1.4.16.1

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agoiptables: fix standard target
Pablo Neira Ayuso [Sun, 7 Oct 2012 22:55:43 +0000 (00:55 +0200)] 
iptables: fix standard target

This regression was added by:

commit cd2f9bdbb7f9b737e5d640aafeb78bcd8e3a7adf
Author: Jan Engelhardt <jengelh@inai.de>
Date:   Tue Sep 4 05:24:47 2012 +0200

    iptables: support for target aliase

The result is that:

 iptables -I INPUT -j ACCEPT

says:

 iptables: No chain/target/match by that name.

This also breaks iptables-restore, of course. Jan, you'll have to explain me
how you have tested this.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agobump version to 1.4.16 v1.4.16
Pablo Neira Ayuso [Sun, 7 Oct 2012 21:56:43 +0000 (23:56 +0200)] 
bump version to 1.4.16

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agoMerge branch 'master' of git://git.inai.de/iptables
Jan Engelhardt [Sun, 30 Sep 2012 21:34:04 +0000 (23:34 +0200)] 
Merge branch 'master' of git://git.inai.de/iptables

Conflicts:
extensions/GNUmakefile.in

Resolution: trivial, since this was a fuzz 3.

Reason: Line added from v1.4.15-16-g33710a5 was in vincinity of changes
from v1.4.15-22-g4496801.

12 years agolibxt_time: add support to ignore day transition
Florian Westphal [Mon, 17 Sep 2012 00:23:08 +0000 (00:23 +0000)] 
libxt_time: add support to ignore day transition

Currently, if you want to do something like:
"match Monday, starting 23:00, for two hours"
You need two rules, one for Mon 23:00 to 0:00 and one for Tue 0:00-1:00.
The rule
--weekdays Mo --timestart 23:00  --timestop 01:00
looks correct, but it will first match on monday from midnight to 1 a.m.
and then again for another hour from 23:00 onwards.

This permits userspace to explicitly ignore the day transition and
match for a single, continuous time period instead.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agodoc: mention iptables-apply in the SEE ALSO sections
Jan Engelhardt [Fri, 28 Sep 2012 08:57:45 +0000 (10:57 +0200)] 
doc: mention iptables-apply in the SEE ALSO sections

References: http://bugs.debian.org/660748
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
12 years agodoc: have NOTRACK manpage point to CT instead
Jan Engelhardt [Fri, 28 Sep 2012 08:54:47 +0000 (10:54 +0200)] 
doc: have NOTRACK manpage point to CT instead

The module is obsolete, so point to CT --notrack instead.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
12 years agodoc: trim "state" manpage and reference conntrack instead
Jan Engelhardt [Fri, 28 Sep 2012 08:52:32 +0000 (10:52 +0200)] 
doc: trim "state" manpage and reference conntrack instead

The module is practically obsolete, so just pinpoint to the replacement
in short order.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
12 years agodoc: deduplicate extension descriptions into a new manpage
Jan Engelhardt [Fri, 28 Sep 2012 08:43:06 +0000 (10:43 +0200)] 
doc: deduplicate extension descriptions into a new manpage

iptables.8 and ip6tables.8 had pretty much the same content, with a few
protocol-specific deviations here and there. Not only did that bloat the
manpages, but it also made it harder to spot differences. Separate out
the extension descriptions into a new manpage, which conveniently
features differences next to one another (cf. REJECT).

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
12 years agodoc: clean up interpunction in state list for xt_conntrack
Jan Engelhardt [Fri, 28 Sep 2012 07:57:56 +0000 (09:57 +0200)] 
doc: clean up interpunction in state list for xt_conntrack

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
12 years agoMerge branch 'master' of git://git.inai.de/iptables
Jan Engelhardt [Sun, 30 Sep 2012 09:23:04 +0000 (11:23 +0200)] 
Merge branch 'master' of git://git.inai.de/iptables

12 years agolibxt_state: replace as an alias to xt_conntrack
Jan Engelhardt [Thu, 27 Sep 2012 22:12:42 +0000 (00:12 +0200)] 
libxt_state: replace as an alias to xt_conntrack

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
12 years agoiptables: support for match aliases
Jan Engelhardt [Thu, 27 Sep 2012 21:48:25 +0000 (23:48 +0200)] 
iptables: support for match aliases

This patch allows for match names listed on the command line to be
rewritten to new names and revisions, like we did for targets before.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
12 years agolibxt_NOTRACK: replace as an alias to CT --notrack
Jan Engelhardt [Tue, 4 Sep 2012 03:38:48 +0000 (05:38 +0200)] 
libxt_NOTRACK: replace as an alias to CT --notrack

Note that we do not need any print/save functions for the alias entries,
since the real CT entry will handle this.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
12 years agoiptables: support for target aliases
Jan Engelhardt [Tue, 4 Sep 2012 03:24:47 +0000 (05:24 +0200)] 
iptables: support for target aliases

This patch allows for target names listed on the command line to be
rewritten to new names and revisions.

As before, we will pick a revision that is supported by the kernel - now
including real_name in the search. This gives us the possibility to test
for many action names.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
12 years agolibxtables: consolidate preference logic
Jan Engelhardt [Thu, 27 Sep 2012 19:36:35 +0000 (21:36 +0200)] 
libxtables: consolidate preference logic

Alias support will require testing for more conditions, so move the
revision comparison code into a separate function where it can be
shared between matches and targets.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
12 years agoNew set match revision with --return-nomatch flag support
Jozsef Kadlecsik [Fri, 21 Sep 2012 18:42:15 +0000 (20:42 +0200)] 
New set match revision with --return-nomatch flag support

12 years agobuild: have `make clean` remove dep files too
Jan Engelhardt [Mon, 10 Sep 2012 13:04:49 +0000 (15:04 +0200)] 
build: have `make clean` remove dep files too

While changing branches, one can hit errors like:

make[2]: ***   CC       libipt_CLUSTERIP.oo
No hay ninguna regla para construir el objetivo
`../include/net/netfilter/nf_nat.h', necesario para
`libipt_DNAT.oo'. Alto.

Pablo thinks dep files should be removed on `make clean`, and I
concur. (JFI, Note that native automake would not clear its ".deps"
directory.) Keep the "distclean: clean" line to keep invocations by
automake from the parent directory working.

Reported-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agoextensions: add NPT extension
Patrick McHardy [Wed, 22 Aug 2012 10:27:17 +0000 (12:27 +0200)] 
extensions: add NPT extension

Add extensions for the SNPT and DNPT stateless IPv6-to-IPv6 Network Prefix
Translation targets.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agoextensions: add IPv6 NETMAP extension
Patrick McHardy [Wed, 22 Aug 2012 10:27:16 +0000 (12:27 +0200)] 
extensions: add IPv6 NETMAP extension

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agoextensions: add IPv6 REDIRECT extension
Patrick McHardy [Wed, 22 Aug 2012 10:27:14 +0000 (12:27 +0200)] 
extensions: add IPv6 REDIRECT extension

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agoextensions: add IPv6 DNAT target
Patrick McHardy [Wed, 22 Aug 2012 10:27:12 +0000 (12:27 +0200)] 
extensions: add IPv6 DNAT target

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agoextensions: add IPv6 SNAT extension
Patrick McHardy [Wed, 22 Aug 2012 10:27:11 +0000 (12:27 +0200)] 
extensions: add IPv6 SNAT extension

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agoextensions: add IPv6 MASQUERADE extension
Patrick McHardy [Wed, 22 Aug 2012 10:27:10 +0000 (12:27 +0200)] 
extensions: add IPv6 MASQUERADE extension

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agoConvert the NAT targets to use the kernel supplied nf_nat.h header
Patrick McHardy [Wed, 22 Aug 2012 10:27:08 +0000 (12:27 +0200)] 
Convert the NAT targets to use the kernel supplied nf_nat.h header

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agoextensions: libxt_addrtype: fix type in help message
Pablo Neira Ayuso [Thu, 6 Sep 2012 22:55:19 +0000 (22:55 +0000)] 
extensions: libxt_addrtype: fix type in help message

 --limit-iface-out          Match only on the packet's incoming device

Note that it says "incoming" when it should say "outcoming"

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agoiptables: fix wrong error messages
Pablo Neira Ayuso [Thu, 6 Sep 2012 22:55:18 +0000 (22:55 +0000)] 
iptables: fix wrong error messages

iptables -P INPUT
iptables v1.4.15: -X requires a chain and a policy
Try `iptables -h' or 'iptables --help' for more information.

Note that it says -X when we have used -P.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agobuild: separate AC variable replacements from xtables.h
Jan Engelhardt [Fri, 31 Aug 2012 01:59:07 +0000 (03:59 +0200)] 
build: separate AC variable replacements from xtables.h

It was/is a bit annoying that modifying xtables.h.in causes configure
to rerun. Split the @foo@ things into a separate file to bypass this.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
12 years agobuild: support for automake-1.12
Jan Engelhardt [Fri, 31 Aug 2012 02:06:38 +0000 (04:06 +0200)] 
build: support for automake-1.12

automake-1.12 wants that AM_PROG_AR be used when LT_INIT is.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
12 years agolibxt_tcp: print space before, not after "flags:"
Andreas Schwab [Mon, 20 Aug 2012 06:52:36 +0000 (06:52 +0000)] 
libxt_tcp: print space before, not after "flags:"

tcp dpt:10flags: 0x17/0x02
         ^^

Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agolibip6t_frag: match any frag id by default
Michal Kubeček [Tue, 7 Aug 2012 13:10:05 +0000 (15:10 +0200)] 
libip6t_frag: match any frag id by default

If no --fragid option is given, the frag extension only matches
fragments with a zero-valued "Identification" field. This behavior
deviates from what other extensions do (they match all values in this
case) and is unexpected, and therefore changed by this patch.

Additionally, --fragid 0:4294967295 leads to no output on `iptables
-S` because part of the code thinks that this would be the default,
when it is not.

So, default to match all frag values, such that iptables -S not
outputting anything also becomes correct.

Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
12 years agoMerge remote-tracking branch 'nf/stable'
Jan Engelhardt [Wed, 8 Aug 2012 18:09:17 +0000 (20:09 +0200)] 
Merge remote-tracking branch 'nf/stable'

12 years agoinclude: add missing linux/netfilter_ipv4/ip_queue.h
Pablo Neira Ayuso [Fri, 3 Aug 2012 08:41:40 +0000 (10:41 +0200)] 
include: add missing linux/netfilter_ipv4/ip_queue.h

This patch fixes compilation of libipq with headers from Linux
kernel 3.5:

 In file included from libipq.c:34:0:
 ../include/libipq/libipq.h:33:43: fatal error: linux/netfilter_ipv4/ip_queue.h: No such file or directory

ip_queue is gone since Linux kernel 3.5. However, you can still use
new iptables versions with old Linux kernels. We have to keep libipq
in this tree for a while (1.5-2 years should be OK).

Reported-by: Arkadiusz Miśkiewicz <arekm@maven.pl>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agoip[6]tables-restore: cleanup to reduce one level of indentation
Pablo Neira Ayuso [Fri, 3 Aug 2012 09:12:14 +0000 (11:12 +0200)] 
ip[6]tables-restore: cleanup to reduce one level of indentation

This patch moves the parameter parsing to one function to reduce
one level of indentation. Jan Engelhardt likes this.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agoinclude: add missing linux/netfilter_ipv4/ip_queue.h
Pablo Neira Ayuso [Fri, 3 Aug 2012 08:41:40 +0000 (10:41 +0200)] 
include: add missing linux/netfilter_ipv4/ip_queue.h

This patch fixes compilation of libipq with headers from Linux
kernel 3.5:

 In file included from libipq.c:34:0:
 ../include/libipq/libipq.h:33:43: fatal error: linux/netfilter_ipv4/ip_queue.h: No such file or directory

ip_queue is gone since Linux kernel 3.5. However, you can still use
new iptables versions with old Linux kernels. We have to keep libipq
in this tree for a while (1.5-2 years should be OK).

Reported-by: Arkadiusz Miśkiewicz <arekm@maven.pl>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agolibxt_*limit: avoid division by zero
Jan Engelhardt [Sat, 28 Jul 2012 17:10:08 +0000 (19:10 +0200)] 
libxt_*limit: avoid division by zero

It was possible to specify -A mychain -m hashlimit --hashlimit
600059/minute; this would convert to r->avg=0, which subsequently
causes a division by zero when printing with -S mychain.

1. Avoid division by zero in print_rate by printing infinity
   instead.
2. Rewrite the test in parse_rate to properly reject too high rates.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
12 years agolibxt_LED: guard against negative numbers
Jan Engelhardt [Sun, 15 Jul 2012 20:21:00 +0000 (22:21 +0200)] 
libxt_LED: guard against negative numbers

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
12 years agolibxt_devgroup: guard against negative numbers
Jan Engelhardt [Fri, 13 Jul 2012 22:06:45 +0000 (00:06 +0200)] 
libxt_devgroup: guard against negative numbers

More corrections of the strtoul kind.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
12 years agolibxt_devgroup: consolidate devgroup specification parsing
Jan Engelhardt [Fri, 13 Jul 2012 22:06:45 +0000 (00:06 +0200)] 
libxt_devgroup: consolidate devgroup specification parsing

This is a small cleanup, reducing the two copies of X/Y parsing to
one.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
12 years agolibxt_u32: do bounds checking for @'s operands
Jan Engelhardt [Fri, 13 Jul 2012 21:18:29 +0000 (23:18 +0200)] 
libxt_u32: do bounds checking for @'s operands

Using only strtoul is prone to accept all values, including negative
ones which are not explicitly allowed. Therefore, use xtables_strtoui
with bounds checking.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
12 years agodoc: grammatical updates to libxt_SET
Jan Engelhardt [Fri, 13 Jul 2012 20:45:00 +0000 (22:45 +0200)] 
doc: grammatical updates to libxt_SET

Cherry-picked these from recent patches from Mr Dash Four.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
12 years agoiptables-restore: warn about -t in rule lines
Jan Engelhardt [Sun, 17 Jun 2012 09:49:22 +0000 (11:49 +0200)] 
iptables-restore: warn about -t in rule lines

save-restore syntax uses *table, not -t table.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agobump version to 1.4.15 v1.4.15
Pablo Neira Ayuso [Tue, 31 Jul 2012 10:44:36 +0000 (12:44 +0200)] 
bump version to 1.4.15

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agolibxt_recent: add --mask netmask
Denys Fedoryshchenko [Thu, 17 May 2012 10:08:57 +0000 (10:08 +0000)] 
libxt_recent: add --mask netmask

This new option will be available in the Linux kernel 3.5

[ Pablo fixed coding-style issues and cleaned up this. Added
  manpages as well ]

Signed-off-by: Denys Fedoryshchenko <denys@visp.net.lb>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agoiptables-restore: fix parameter parsing (shows up with gcc-4.7)
Pablo Neira Ayuso [Mon, 30 Jul 2012 01:08:51 +0000 (03:08 +0200)] 
iptables-restore: fix parameter parsing (shows up with gcc-4.7)

This patch fixes parameter parsing in iptables-restore since time ago. The
problem has shown up with gcc-4.7. This version of gcc seem to perform more
agressive memory management than previous.

Peter Lekensteyn provided the following sample code similar to the one
in iptables-restore:

int i = 0;

for (;;) {
char x[5];

x[i] = '0' + i;
if (++i == 4) {
x[i] = '\0'; /* terminate string with null byte */
printf("%s\n", x);
break;
}
}

Many may expect 0123 as output. But GCC 4.7 does not do that when compiling
with optimization enabled (-O1 and higher). It instead puts random data in the
first bytes of the character array, which becomes:

| 0  |  1  |  2  |  3  |  4   |
|     RANDOM     | '3' | '\0' |

Since the array is declared inside the scope of loop's body, you can think of
it as of a new array being allocated in the automatic storage area for each
loop iteration.

The correct code should be:

char x[5];

for (;;) {
x[i] = '0' + i;
if (++i == 4) {
x[i] = '\0'; /* terminate string with null byte */
printf("%s\n", x);
break;
}
}

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agoRevert "iptables-restore: move code to add_param_to_argv, cleanup (fix gcc-4.7)"
Pablo Neira Ayuso [Mon, 30 Jul 2012 00:56:43 +0000 (02:56 +0200)] 
Revert "iptables-restore: move code to add_param_to_argv, cleanup (fix gcc-4.7)"

This reverts commit 44191bdbd71e685fba9eab864b9df25e63905220.

Apply instead a patch that really clarifies the bug in iptables-restore.
This should be good for the record (specifically, for distributors so
they can find the fix by googling).

13 years agoiptables-restore: move code to add_param_to_argv, cleanup (fix gcc-4.7)
Pablo Neira Ayuso [Mon, 23 Jul 2012 10:27:16 +0000 (12:27 +0200)] 
iptables-restore: move code to add_param_to_argv, cleanup (fix gcc-4.7)

This patch seems to be a mere cleanup that moves the parameter parsing
code to add_param_to_argv.

But, in reality, it also fixes iptables when compiled with gcc-4.7.

Moving param_buffer declaration out of the loop seems to resolve the
issue. gcc-4.7 seems to be generating bad code regarding param_buffer.

@@ -380,9 +380,9 @@
                        quote_open = 0;
                        escaped = 0;
                        param_len = 0;
+                       char param_buffer[1024];

                        for (curchar = parsestart; *curchar; curchar++) {
-                               char param_buffer[1024];

                                if (quote_open) {
                                        if (escaped) {

But I have hard time to apply this patch in such a way. Instead, I came
up with the idea of this cleanup, which does not harm after all (and fixes
the issue for us).

Someone in:

https://bugzilla.redhat.com/show_bug.cgi?id=82579

put some light on this:

"Yes, I ran into this too. The issue is that the gcc optimizer is
optimizing out the code that collects quoted strings in
iptables-restore.c at line 396. If inside a quotemark and it hasn't
seen another one yet, it executes

   param_buffer[param_len++] = *curchar;
   continue;

At -O1 or higher, the write to param_buffer[] never happens. It just
increments param_len and continues.

Moving the definition of char param_buffer[1024]; outside the loop
fixes it. Why, I'm not sure. Defining the param_buffer[] inside the
loop should simply restrict its scope to inside the loop."

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
13 years agolibxt_HMARK: correct a number of errors introduced by Pablo's rework
Hans Schillstrom [Tue, 17 Jul 2012 16:27:24 +0000 (18:27 +0200)] 
libxt_HMARK: correct a number of errors introduced by Pablo's rework

* Fix typo in --hmark-rnd description.
* Remove trailing -set from port and spi options.
* Take missing value for ports and spi from command line.
* Fix spi / port validation.
* Remove --hmark-offset as mandatory.

Signed-off-by: Hans Schillstrom <hans@schillstrom.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
13 years agolibxt_HMARK: fix ct case example
Pablo Neira Ayuso [Mon, 16 Jul 2012 12:04:10 +0000 (14:04 +0200)] 
libxt_HMARK: fix ct case example

... -j HMARK --hmark-tuple ct,src,dst --hmark-offset 10000 ...

Note `ct' requires also the tuples.

Reported-by: Hans Schillstrom <hans@schillstrom.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
13 years agolibxt_HMARK: fix output of iptables -L
Hans Schillstrom [Mon, 16 Jul 2012 11:53:42 +0000 (13:53 +0200)] 
libxt_HMARK: fix output of iptables -L

Fix accidental swap of [s|d]port-mask and [s|d]port-port.

Use xtables_ipmask_to_cidr instead of xtables_ipmask_to_numeric.

Signed-off-by: Hans Schillstrom <hans@schillstrom.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
13 years agolibxt_hashlimit: add support for byte-based operation
Florian Westphal [Tue, 8 May 2012 03:16:52 +0000 (03:16 +0000)] 
libxt_hashlimit: add support for byte-based operation

allows --hashlimit-(upto|above) Xb/s [ --hashlimit-burst Yb ]
to make hashlimit match when X bytes/second are exceeded;
optionally, Y bytes will not be matched (i.e. bursted).

[ Pablo fixed minor compilation warning in this patch with gcc-4.6 and x86_64 ]

libxt_hashlimit.c: In function ‘parse_bytes’:
libxt_hashlimit.c:216:6: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘uint64_t’ [-Wformat]

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
13 years agolibxt_recent: remove unused variable
Eldad Zack [Wed, 4 Jul 2012 11:53:54 +0000 (11:53 +0000)] 
libxt_recent: remove unused variable

The info variable is assigned but never read in recent_check().

Signed-off-by: Eldad Zack <eldad@fogrefinery.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
13 years agoextensions: add HMARK target
Hans Schillstrom [Mon, 23 Apr 2012 03:35:28 +0000 (03:35 +0000)] 
extensions: add HMARK target

The target allows you to set mark packets based Jenkins' hash calculation:

h(t, rnd) = x

mark = (x % mod) + offset

where:

* t is a tuple that is used for the hashing:

 t = [ src, dst, proto, sport, dport ]

Note that you can customize the tuple, thus, removing some component
that you don't want to use for the calculation. You can also use spi
instead of sport and dport, btw.

* rnd is the random seed that is explicitly passed via --hmark-rnd
* mod is the modulus, to determine the range of possible marks
* offset determines where the mark starts from

This target only works for the "raw" and "mangle" tables.

This can be used to distribute flows between a cluster of
systems and uplinks.

Initially based on work from Hans Schillingstrom. Pablo took it
over and introduced several improvements.

Signed-off-by: Hans Schillstrom <hans.schillstrom@ericsson.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
13 years agolibxtables: add xtables_ip[6]mask_to_cidr
Pablo Neira Ayuso [Sat, 14 Jul 2012 13:39:20 +0000 (15:39 +0200)] 
libxtables: add xtables_ip[6]mask_to_cidr

This patch adds generic functions to return the mask in CIDR
notation whenever is possible.

This patch also simplifies xtables_ip[6]mask_to_numeric, that
now use these new two functions.

This patch also bumps libxtables_vcurrent and libxtables_vage
since we added a couple new interfaces (thanks to Jan Engelhardt
for his little reminder on this).

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
13 years agolibxt_devgroup: add man page snippet
Florian Westphal [Mon, 2 Jul 2012 11:03:12 +0000 (11:03 +0000)] 
libxt_devgroup: add man page snippet

Signed-off-by: Florian Westphal <fw@strlen.de>
13 years agoBump version to 1.4.14 v1.4.14
Pablo Neira Ayuso [Sat, 26 May 2012 16:44:33 +0000 (18:44 +0200)] 
Bump version to 1.4.14

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
13 years agotests: add rateest match rules
Florian Westphal [Thu, 17 May 2012 01:03:09 +0000 (01:03 +0000)] 
tests: add rateest match rules

also, -p mobility gets us EINVAL from kernel, use -p ipv6-mh instead.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
13 years agoextensions: libxt_rateest: output all options in save hook
Florian Westphal [Thu, 17 May 2012 01:03:08 +0000 (01:03 +0000)] 
extensions: libxt_rateest: output all options in save hook

ipt-restore fails to parse the ipt-save output:
zmatches -m rateest --rateest RE1 --rateest-pps --rateest-lt 5
(should be "--rateest-pps 5 --rateest-lt").  Also, the "delta" option
was never shown in -save output, but twice in some cases when using
"iptables -L".

Also, the "b/pps1" option must be shown when "delta" option is used with
relative mode.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
13 years agoip(6)tables-restore: make sure argv is NULL terminated
Florian Westphal [Thu, 10 May 2012 05:42:47 +0000 (05:42 +0000)] 
ip(6)tables-restore: make sure argv is NULL terminated

Else, argv[argc] may point to free'd memory.

Some extensions, e.g. rateest, may fail to parse valid input
because argv[optind] (with optind == argc) is not NULL.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
13 years agolibipt_ULOG: fix --ulog-cprange
Pablo Neira Ayuso [Tue, 8 May 2012 22:28:41 +0000 (00:28 +0200)] 
libipt_ULOG: fix --ulog-cprange

In 1f2474a libipt_ULOG: use guided option parser.

A bug has been accidentally introduced in --ulog-cprange, limiting
possible values from 1 to 50. However, that limit should be applied
to --ulog-qthreshold.

Reported-by: Gaurav Sinha <vgsinha@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
13 years agolibiptc: fix retry path in TC_INIT
Miguel GAIO [Thu, 19 Apr 2012 00:14:33 +0000 (00:14 +0000)] 
libiptc: fix retry path in TC_INIT

There is an issue on TC_INIT retry path:
In error case, TC_FREE is called and close sockfd.
The retry does not reopen then always fail.

The proposing patch reopens sockfd in retry patch.

Signed-off-by: Miguel GAIO <miguel.gaio@efixo.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
13 years agolibxt_CT: add --timeout option
Pablo Neira Ayuso [Wed, 29 Feb 2012 12:48:36 +0000 (13:48 +0100)] 
libxt_CT: add --timeout option

This patch adds the --timeout option to allow to attach timeout
policy objects to flows, eg.

 iptables -I PREROUTING -t raw -s 1.1.1.1 -p tcp \
  -j CT --timeout custom-tcp-policy

You need the nfct(8) tool which is available at:
http://git.netfilter.org/cgi-bin/gitweb.cgi?p=nfct.git
To define the cttimeout policies.

Example of usage:
 nfct timeout add custom-tcp-policy inet tcp established 1000

The new nfct tool also requires libnetfilter_cttimeout:
http://git.netfilter.org/cgi-bin/gitweb.cgi?p=libnetfilter_cttimeout.git

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>