]> git.ipfire.org Git - thirdparty/iptables.git/log
thirdparty/iptables.git
14 years agosrc: move jump option handling from do_command6 into its own function
Jan Engelhardt [Mon, 7 Feb 2011 02:39:36 +0000 (03:39 +0100)] 
src: move jump option handling from do_command6 into its own function

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agosrc: unclutter command_default function
Jan Engelhardt [Mon, 7 Feb 2011 02:20:02 +0000 (03:20 +0100)] 
src: unclutter command_default function

(Essentially, 5 levels of indentation have been stripped compared to the
original layout, and this is surely a result that looks a lot better
than it did before.)

Things to note:

1. If the m->parse call succeeded, we can return from the function and
do not need to go through the other code. As such, "m" is guaranteed to
be useless at the end of the match loop, and so, conditions can be
removed.

2. Since the per-extension parse function only ever get their own option
codes (since v1.4.10-26-gd09b6d5), their return value no longer has a
meaning and can be ignored.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agosrc: deduplicate and simplify implicit protocol extension loading
Jan Engelhardt [Mon, 7 Feb 2011 02:18:53 +0000 (03:18 +0100)] 
src: deduplicate and simplify implicit protocol extension loading

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agosrc: put shared option flags into xshared
Jan Engelhardt [Mon, 7 Feb 2011 02:16:14 +0000 (03:16 +0100)] 
src: put shared option flags into xshared

This will be needed for the find_proto function.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agosrc: move OPT_FRAGMENT to the end so the list can be shared
Jan Engelhardt [Mon, 7 Feb 2011 02:13:43 +0000 (03:13 +0100)] 
src: move OPT_FRAGMENT to the end so the list can be shared

14 years agosrc: deduplicate find_proto function
Jan Engelhardt [Mon, 7 Feb 2011 02:05:49 +0000 (03:05 +0100)] 
src: deduplicate find_proto function

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agosrc: share iptables_command_state across the two programs
Jan Engelhardt [Sun, 6 Feb 2011 23:00:42 +0000 (00:00 +0100)] 
src: share iptables_command_state across the two programs

struct iptables_command_state and quite a bit of the code looks worthy
of deduplication.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agosrc: move large default: block from do_command6 into its own function
Jan Engelhardt [Sun, 6 Feb 2011 16:14:48 +0000 (17:14 +0100)] 
src: move large default: block from do_command6 into its own function

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agosrc: collect do_command variables in a struct
Jan Engelhardt [Sun, 6 Feb 2011 14:52:11 +0000 (15:52 +0100)] 
src: collect do_command variables in a struct

This will make it easier to put the code for the cases into separate
functions.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agoextensions: add extension for devgroup match
Patrick McHardy [Thu, 3 Feb 2011 05:10:41 +0000 (06:10 +0100)] 
extensions: add extension for devgroup match

Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agoiptables: do not print trailing whitespaces
Jan Engelhardt [Sat, 18 Dec 2010 01:04:59 +0000 (02:04 +0100)] 
iptables: do not print trailing whitespaces

Due to the use of printf("foobar "), iptables emits spaces at the
end-of-line, which looks odd to some users because it causes the
terminal to wrap even if there is seemingly nothing to print.

It may also have other points of annoyance, such as mailers
interpreting a trailing space as an indicator that the paragraph
continues when format=flowed is also on.
And git highlights trailing spaces in red, so let's avoid :)

Preexisting inconsistencies in outputting spaces in the right
spot are also addressed right away.

References: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=429579
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agoiptables: remove more redundant casts
Jan Engelhardt [Mon, 31 Jan 2011 01:41:23 +0000 (02:41 +0100)] 
iptables: remove more redundant casts

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agoiptables: remove bogus address-of
Jan Engelhardt [Mon, 31 Jan 2011 01:39:46 +0000 (02:39 +0100)] 
iptables: remove bogus address-of

Casts are bad. &curtable is actually of type char (*)[], which is
quite different from what add_argv expects.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agoiptables: warn when parameter limit is exceeded
Jan Engelhardt [Mon, 31 Jan 2011 01:34:49 +0000 (02:34 +0100)] 
iptables: warn when parameter limit is exceeded

While testing many match extensions in a single rule, I ran into this
error not warned about. Arguments were just ignored, causing
surprising "Need to specify an argument to --whatever" when the
argument was in fact given on the command line.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agoxtables: set custom opts to NULL on free
Jan Engelhardt [Mon, 31 Jan 2011 01:33:43 +0000 (02:33 +0100)] 
xtables: set custom opts to NULL on free

When inside ip6tables-restore, xtables_free_opts can be called
multiple times, especially when trying to exit with an error message
from outside do_command. So set it to NULL so that we do not attempt
to free a dangling pointer.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxt_u32: enclose argument in quotes
Jan Engelhardt [Mon, 31 Jan 2011 00:43:20 +0000 (01:43 +0100)] 
libxt_u32: enclose argument in quotes

Otherwise ip6tables-save piped to ip6tables-restore can cause a parse
error when the expression list is empty.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agoiptables: improve error reporting with extension loading troubles
Jan Engelhardt [Sun, 30 Jan 2011 13:18:17 +0000 (14:18 +0100)] 
iptables: improve error reporting with extension loading troubles

ip6tables v1.4.8: Could not load match "osf":
/usr/lib/xtables/libip6t_osf.so: cannot open shared object file: No
such file or directory

Given that libxt_osf.so exists, a better error is now emitted.

References: http://bugzilla.netfilter.org/show_bug.cgi?id=637
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxt_quota: clarifications on matching
Jan Engelhardt [Tue, 25 Jan 2011 17:31:16 +0000 (18:31 +0100)] 
libxt_quota: clarifications on matching

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agoFix listing/saving the new revision of the SET target
Jozsef Kadlecsik [Fri, 21 Jan 2011 20:55:05 +0000 (21:55 +0100)] 
Fix listing/saving the new revision of the SET target

Instead of the dimension of the set, the max dimension was used at
listing/saving the src,dst parameters, which produced broken output.

14 years agolibxt_connlimit: remove duplicate member that caused size change
Jan Engelhardt [Thu, 20 Jan 2011 13:14:46 +0000 (14:14 +0100)] 
libxt_connlimit: remove duplicate member that caused size change

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agoextensions: libxt_conntrack: add support for specifying port ranges
Patrick McHardy [Thu, 20 Jan 2011 10:45:12 +0000 (11:45 +0100)] 
extensions: libxt_conntrack: add support for specifying port ranges

Add support for revision 3 of the conntrack match, which allows to
specify port ranges for origsrc/origdst/replsrc/repldst.

Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agoextensions: libxt_NFQUEUE: add v2 revision with --queue-bypass option
Florian Westphal [Thu, 20 Jan 2011 10:27:42 +0000 (11:27 +0100)] 
extensions: libxt_NFQUEUE: add v2 revision with --queue-bypass option

--queue-bypass: if no userpace program is listening on the queue, then
allow packets to continue through the ruleset instead of dropping them.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agolibxt_AUDIT: add AUDIT target
Thomas Graf [Thu, 20 Jan 2011 10:24:13 +0000 (11:24 +0100)] 
libxt_AUDIT: add AUDIT target

libxt module for the AUDIT target.

-j AUDIT --type (accept|reject|drop)

Signed-off-by: Thomas Graf <tgraf@redhat.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agolibxt_connlimit: support for dstaddr-supporting revision 1
Jan Engelhardt [Wed, 19 Jan 2011 01:09:39 +0000 (02:09 +0100)] 
libxt_connlimit: support for dstaddr-supporting revision 1

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxt_connlimit: add a --connlimit-upto option
Jan Engelhardt [Tue, 18 Jan 2011 17:04:57 +0000 (18:04 +0100)] 
libxt_connlimit: add a --connlimit-upto option

Direct specifications like "upto" are easier to grasp than "not
above". This patch adds such an upto variant similar to what
libxt_hashlimit already has.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxt_connlimit: reword help text to say prefix length
Jan Engelhardt [Tue, 18 Jan 2011 16:17:00 +0000 (17:17 +0100)] 
libxt_connlimit: reword help text to say prefix length

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxt_quota: print negation when it has been selected
Jan Engelhardt [Tue, 18 Jan 2011 10:02:04 +0000 (11:02 +0100)] 
libxt_quota: print negation when it has been selected

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agoxtables: fix typo in error message of xtables_register_match()
Li Yewang [Sun, 9 Jan 2011 21:26:58 +0000 (22:26 +0100)] 
xtables: fix typo in error message of xtables_register_match()

Signed-off-by: Li Yewang <lyw@cn.fujitsu.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
14 years agolibxt_time: fix random --datestart skips
Florian Westphal [Sun, 9 Jan 2011 21:00:31 +0000 (22:00 +0100)] 
libxt_time: fix random --datestart skips

Frank Lichtenheld points out that -m time --datestart ...
sometimes messes up --datestart:

$ iptables -A INPUT -m time --datestart 2010-11-24T16:50:00 -j ACCEPT
$ iptables-save | grep 11
-A INPUT -m time --datestart 2010-11-24T16:50:00 -j ACCEPT
$ iptables-save | iptables-restore
$ iptables-save | grep 11
-A INPUT -m time --datestart 2010-11-24T15:50:00 -j ACCEPT

--datestart moved by one hour.

As the --timestart option does not care about DST, always set
dst=0 when parsing --starttime input.

Reported-by: Frank Lichtenheld <flichtenheld@astaro.com>
Signed-off-by: Florian Westphal <fwestphal@astaro.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
14 years agolibipt_REDIRECT: avoid dereference of uninitialized pointer
Stephen Beahm [Thu, 9 Dec 2010 11:15:50 +0000 (06:15 -0500)] 
libipt_REDIRECT: avoid dereference of uninitialized pointer

When using --to-ports with a port name instead of a numerical
specification, a segfault occurs.

References: http://bugzilla.netfilter.org/show_bug.cgi?id=691
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxtables: do some option structure checking
Jan Engelhardt [Sat, 8 Jan 2011 02:31:04 +0000 (03:31 +0100)] 
libxtables: do some option structure checking

libxt_recent's use of numeric values >200 always looked worrisome. Now
here is a validation routine for such.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibipt_CLUSTERIP: const annotations
Jan Engelhardt [Sat, 8 Jan 2011 02:16:51 +0000 (03:16 +0100)] 
libipt_CLUSTERIP: const annotations

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxt_sctp: fix a typo
Jan Engelhardt [Sat, 8 Jan 2011 02:16:14 +0000 (03:16 +0100)] 
libxt_sctp: fix a typo

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agoextensions: remove no longer necessary default: cases
Jan Engelhardt [Sat, 8 Jan 2011 02:02:37 +0000 (03:02 +0100)] 
extensions: remove no longer necessary default: cases

Match and target parse functions now only get option characters they
have defined themselves.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agoip[6]tables: only call target's parse function when option char is in range
Jan Engelhardt [Sat, 8 Jan 2011 01:47:02 +0000 (02:47 +0100)] 
ip[6]tables: only call target's parse function when option char is in range

Same as previous commit. Doing this actually allows to remove code
that is no longer needed.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agoip[6]tables: only call match's parse function when option char is in range
Jan Engelhardt [Sat, 8 Jan 2011 01:25:28 +0000 (02:25 +0100)] 
ip[6]tables: only call match's parse function when option char is in range

Normally, extensions use a "default:" case in switch(c) to just return
if they do not handle c. Apparently, libip6t_hl does that too late and
checks for hl-specific parsing state before it has established that c
refers to one of its own options.

Also affected: libipt_ttl, libxt_ipvs, libxt_policy, libxt_statistic.

One way to fix this is to move the flags checks into case '2', '3',
'4'. Doing this replication feels bad, so as an alternative, let's
just free extensions from having to deal with other extension's
options passing thru.

References: http://marc.info/?l=netfilter-devel&m=129444759532377&w=2
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agoxtables: reorder num_old substraction for clarity
Jan Engelhardt [Sat, 8 Jan 2011 01:10:52 +0000 (02:10 +0100)] 
xtables: reorder num_old substraction for clarity

When going over this again, I noticed we happen to malloc too much.
That is no problem, but I felt moving the num_old adjustment upwards
makes things more clear, and also addresses the allocation.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agoiptables: abort on empty interface specification
Jan Engelhardt [Fri, 7 Jan 2011 11:26:59 +0000 (12:26 +0100)] 
iptables: abort on empty interface specification

Fiedler Roman brings to attention that if, in a faulty script,
"$some_variable" expands to an empty string, iptables should probably
catch this most likely undesired invocation. If no/all interfaces were
really desired, one can either omit -i completely, or use -i +.

References: http://marc.info/?l=netfilter&m=129439862903487&w=2
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agosrc: use C99/POSIX types
Jan Engelhardt [Fri, 7 Jan 2011 11:34:04 +0000 (12:34 +0100)] 
src: use C99/POSIX types

"u_int" was a non-standardized extension predating C99 on some platforms.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agoxt_comment: remove redundant cast
Jan Engelhardt [Sun, 26 Dec 2010 09:31:03 +0000 (10:31 +0100)] 
xt_comment: remove redundant cast

14 years agosrc: const annotations
Jan Engelhardt [Sat, 18 Dec 2010 00:40:04 +0000 (01:40 +0100)] 
src: const annotations

Also one int -> uint here on the way through.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agoiptables-restore: resolve confusing policy error message
Rob Leslie [Tue, 28 Sep 2010 07:43:00 +0000 (00:43 -0700)] 
iptables-restore: resolve confusing policy error message

When iptables-restore (and ip6tables-restore) is unable to set a
chain's policy, it responds with a confusing message, e.g.:

iptables-restore v1.4.9: Can't set policy "PREROUTING" on "ACCEPT"
line 16: Bad built-in chain name

This is due to the chain and policy arguments being used in the wrong
order. The attached patch corrects this problem.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agoMerge branch 'master' of git://dev.medozas.de/iptables
Patrick McHardy [Wed, 15 Dec 2010 22:36:19 +0000 (23:36 +0100)] 
Merge branch 'master' of git://dev.medozas.de/iptables

14 years agobuild: stop on error in subcommand
Jan Engelhardt [Sat, 11 Dec 2010 02:35:48 +0000 (03:35 +0100)] 
build: stop on error in subcommand

make only evaluates $? of an entire shell invocation. As such, if any
command in the chain can fail, $? needs to be thrown, and early so.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agoMerge commit 'v1.4.10'
Jan Engelhardt [Mon, 6 Dec 2010 12:44:03 +0000 (13:44 +0100)] 
Merge commit 'v1.4.10'

14 years agolibxt_owner: output numeric IDs when save is requested
Jan Engelhardt [Mon, 6 Dec 2010 12:32:58 +0000 (13:32 +0100)] 
libxt_owner: output numeric IDs when save is requested

References: http://bugzilla.netfilter.org/show_bug.cgi?id=683
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agobuild: fix globbing of extensions in other locales
Jan Engelhardt [Sat, 4 Dec 2010 01:53:20 +0000 (02:53 +0100)] 
build: fix globbing of extensions in other locales

In the fi_FI locale, [a-z] would not include 'w', for example. Rectify
this by using [[:alnum:]] (to counter against different ordering) and
forcing the POSIX locale (so that the alphabet has at least the 26
base characters).

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agosocket: add support for revision 1
Jan Engelhardt [Fri, 3 Dec 2010 21:55:34 +0000 (22:55 +0100)] 
socket: add support for revision 1

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agoTPROXY: add support for revision 1
Jan Engelhardt [Fri, 3 Dec 2010 21:08:32 +0000 (22:08 +0100)] 
TPROXY: add support for revision 1

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agoinclude: update files with headers from Linux 2.6.37-rc1
Jan Engelhardt [Fri, 3 Dec 2010 19:15:35 +0000 (20:15 +0100)] 
include: update files with headers from Linux 2.6.37-rc1

Also includes the type change to __u{8,16,32} kernel types already.

14 years agoiptables: do not emit orig_opts twice
Jan Engelhardt [Sun, 28 Nov 2010 14:42:00 +0000 (15:42 +0100)] 
iptables: do not emit orig_opts twice

This just happened to cross my eye; there was no error, but fixing
this up saves a pitfall, and some memory.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agoiptables: reset options at the start of each command
Jan Engelhardt [Sun, 28 Nov 2010 14:35:06 +0000 (15:35 +0100)] 
iptables: reset options at the start of each command

For each new command, iptables is supposed to start afresh with a
blank option set (opts) that only contains the program-specific
options (orig_opts), without any extension options. We failed to
restore this pointer (in function do_command) after the previous free
call in xtables_free_opts.

Reported-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxt_conntrack: fix --ctdir save/dump output format
Florian Westphal [Wed, 17 Nov 2010 14:54:18 +0000 (15:54 +0100)] 
libxt_conntrack: fix --ctdir save/dump output format

$ iptables-save | iptables-restore
iptables-restore v1.4.6: conntrack: Bad value for "--ctdir" option: "ORIGINAL-j"

Signed-off-by: Florian Westphal <fwestphal@astaro.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agoMerge branch 'master' of git://dev.medozas.de/iptables into m2
Jan Engelhardt [Mon, 15 Nov 2010 13:39:50 +0000 (14:39 +0100)] 
Merge branch 'master' of git://dev.medozas.de/iptables into m2

14 years agoRevert "Revert "libxtables: change option precedence order to be intuitive""
Jan Engelhardt [Mon, 15 Nov 2010 13:39:35 +0000 (14:39 +0100)] 
Revert "Revert "libxtables: change option precedence order to be intuitive""

This reverts commit e84f131b5f992577119bd3679241f69ec394e0a7.
Solution follows.

14 years agoiptables: fix longopt reecognition and workaround getopt(3) behavior
Jan Engelhardt [Mon, 15 Nov 2010 12:19:48 +0000 (13:19 +0100)] 
iptables: fix longopt reecognition and workaround getopt(3) behavior

* On the first call to getopt, opts was NULL, so long options would
not be recognized until a match/target was loaded.

Whacky getopt behavior:

* If the longopts parameter is NULL, getopt fails to recognize unknown
options, such that `iptables-multi main --append` will print a garbage
help message ("main needs an argument").

* If the longopts parameter is NULL on the first call, but not on
subsequent calls, it completely screws up option parsing, taking
the --dport in `iptables-multi main -A INPUT -p tcp --dport 1000`
as --destination instead, but not accepting "--destination 1.2.3.4"
either.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agoRevert "libxtables: change option precedence order to be intuitive"
Patrick McHardy [Mon, 15 Nov 2010 10:39:55 +0000 (11:39 +0100)] 
Revert "libxtables: change option precedence order to be intuitive"

This reverts commit 600f38db82548a683775fd89b6e136673e924097.

The commit breaks option parsing:

iptables v1.4.9: host/network `port' not found
Try `iptables -h' or 'iptables --help' for more information.

Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agolibxt_TOS: avoid an undesired overflowing computation
Jan Engelhardt [Tue, 2 Nov 2010 08:10:34 +0000 (09:10 +0100)] 
libxt_TOS: avoid an undesired overflowing computation

The @bits parameter was wrongly labeled and should have been @max
already. This makes the - overflowing - 1<<bits redundant of course.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxtables: change option precedence order to be intuitive
Jan Engelhardt [Fri, 29 Oct 2010 16:57:42 +0000 (18:57 +0200)] 
libxtables: change option precedence order to be intuitive

When using `-m mark --mark 2 -m connmark --mark 2`, the user currently
gets an error about the (libxt_mark) --mark option being used twice.
This is because libxt_connmark's option table does not override any
previous options. This patch changes this behavior, since the current
behavior does not allow connmark's option to be used at all, which is
illogical.

Cc: Florian Westphal <fw@strlen.de>
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agoBump version to 1.4.10 v1.4.10
Patrick McHardy [Fri, 29 Oct 2010 14:37:22 +0000 (16:37 +0200)] 
Bump version to 1.4.10

Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agolibiptc: add Libs.private to pkgconfig files
Jan Engelhardt [Mon, 13 Sep 2010 13:56:25 +0000 (15:56 +0200)] 
libiptc: add Libs.private to pkgconfig files

This is needed when doing static linking.
(pkg-config --static --libs libiptc)

References: http://bugzilla.netfilter.org/show_bug.cgi?id=675
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibiptc: build with -Wl,--no-as-needed
Jan Engelhardt [Mon, 13 Sep 2010 14:06:50 +0000 (16:06 +0200)] 
libiptc: build with -Wl,--no-as-needed

Since libiptc does not reference any symbols in libip(4|6)tc, the linker
may ignore the dependencies. Use --no-as-needed to explicitly force a
DT_NEEDED entry.

References: http://bugzilla.netfilter.org/show_bug.cgi?id=674
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agoiptables: limit chain name length to be consistent with targets
Jan Engelhardt [Mon, 13 Sep 2010 13:45:15 +0000 (15:45 +0200)] 
iptables: limit chain name length to be consistent with targets

Creationg of chain names longer than the ones being able to jump to
should be inhibited for consistency.

References: http://marc.info/?l=netfilter-devel&m=128397022618316&w=2
Cc: Stig Thormodsrud <stig@vyatta.com>
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agoiptables-xml: resolve compiler warnings
Jan Engelhardt [Mon, 13 Sep 2010 13:35:18 +0000 (15:35 +0200)] 
iptables-xml: resolve compiler warnings

iptables-xml.c: In function "parse_counters":
iptables-xml.c:70:8: warning: assignment from incompatible pointer type
iptables-xml.c:71:8: warning: assignment from incompatible pointer type

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agobuild: fix static linking
Jan Engelhardt [Tue, 3 Aug 2010 17:58:38 +0000 (19:58 +0200)] 
build: fix static linking

Gabor Z. Papp noted this link-time error when configuring with
--enable-static:

extensions/libext4.a(initext4.o): In function "init_extensions":
extensions/initext4.c:144: undefined reference to "libxt_IDLETIMER_init"
extensions/initext4.c:145: undefined reference to "libxt_TEE_init"

Indeed, since the two modules did not use our special macro "_init"
(which expands to libxt_foo_init), initext4.c could not find them by
that name. Correct this.

References: http://marc.info/?l=netfilter&m=128085480927924&w=2
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agoxtables: remove unnecessary cast
Jan Engelhardt [Sun, 25 Jul 2010 21:36:17 +0000 (23:36 +0200)] 
xtables: remove unnecessary cast

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agoMerge branch 'iptables-next'
Patrick McHardy [Tue, 3 Aug 2010 15:21:18 +0000 (17:21 +0200)] 
Merge branch 'iptables-next'

14 years agoBump version to 1.4.9 v1.4.9
Patrick McHardy [Tue, 3 Aug 2010 14:54:25 +0000 (16:54 +0200)] 
Bump version to 1.4.9

Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agolibxt_quota: don't ignore the quota value on deletion
Changli Gao [Mon, 2 Aug 2010 16:03:20 +0000 (18:03 +0200)] 
libxt_quota: don't ignore the quota value on deletion

Don't ignore the quota value on deletion, then we can remove a special
rule everytime.

Signed-off-by: Changli Gao <xiaosuo@gmail.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agodoc: consistent use of markup
Jan Engelhardt [Fri, 23 Jul 2010 19:23:05 +0000 (21:23 +0200)] 
doc: consistent use of markup

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agoall: consistent syntax use in struct option
Jan Engelhardt [Fri, 23 Jul 2010 19:16:14 +0000 (21:16 +0200)] 
all: consistent syntax use in struct option

Try to inhibit copypasting old stuff.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agodoc: minimal spelling updates to xt_cpu
Jan Engelhardt [Fri, 23 Jul 2010 17:38:46 +0000 (19:38 +0200)] 
doc: minimal spelling updates to xt_cpu

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agodoc: remove extra empty line from xt_cpu
Jan Engelhardt [Fri, 23 Jul 2010 17:38:30 +0000 (19:38 +0200)] 
doc: remove extra empty line from xt_cpu

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agodoc: let man(1) autoalign the text in xt_cpu
Jan Engelhardt [Fri, 23 Jul 2010 17:38:04 +0000 (19:38 +0200)] 
doc: let man(1) autoalign the text in xt_cpu

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agoMerge branch 'master' into iptables-next
Patrick McHardy [Fri, 23 Jul 2010 14:16:11 +0000 (16:16 +0200)] 
Merge branch 'master' into iptables-next

14 years agoextension: add xt_cpu match
Eric Dumazet [Fri, 23 Jul 2010 14:15:14 +0000 (16:15 +0200)] 
extension: add xt_cpu match

Kernel 2.6.36 supports xt_cpu match

In some situations a CPU match permits a better spreading of
connections, or select targets only for a given cpu.

With Remote Packet Steering or multiqueue NIC and appropriate IRQ
affinities, we can distribute trafic on available cpus, per session.
(all RX packets for a given flow are handled by a given cpu)

Some legacy applications being not SMP friendly, one way to scale a
server is to run multiple copies of them.

Instead of randomly choosing an instance, we can use the cpu number as a
key so that softirq handler for a whole instance is running on a single
cpu, maximizing cache effects in TCP/UDP stacks.

Using NAT for example, a four ways machine might run four copies of
server application, using a separate listening port for each instance,
but still presenting an unique external port :

iptables -t nat -A PREROUTING -p tcp --dport 80 -m cpu --cpu 0 \
        -j REDIRECT --to-port 8080

iptables -t nat -A PREROUTING -p tcp --dport 80 -m cpu --cpu 1 \
        -j REDIRECT --to-port 8081

iptables -t nat -A PREROUTING -p tcp --dport 80 -m cpu --cpu 2 \
        -j REDIRECT --to-port 8082

iptables -t nat -A PREROUTING -p tcp --dport 80 -m cpu --cpu 3 \
        -j REDIRECT --to-port 8083

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agoextensions: REDIRECT: add random help
Eric Dumazet [Fri, 23 Jul 2010 10:54:37 +0000 (12:54 +0200)] 
extensions: REDIRECT: add random help

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agoextensions: REDIRECT: add random help
Eric Dumazet [Fri, 23 Jul 2010 10:54:05 +0000 (12:54 +0200)] 
extensions: REDIRECT: add random help

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agolibxt_ipvs: user-space lib for netfilter matcher xt_ipvs
Hannes Eder [Fri, 23 Jul 2010 10:51:26 +0000 (12:51 +0200)] 
libxt_ipvs: user-space lib for netfilter matcher xt_ipvs

The user-space library for the netfilter matcher xt_ipvs.

[ trivial up-port by Simon Horman <horms@verge.net.au> ]
Signed-off-by: Hannes Eder <heder@google.com>
Acked-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agoMerge branch 'master' into iptables-next
Patrick McHardy [Thu, 15 Jul 2010 16:15:03 +0000 (18:15 +0200)] 
Merge branch 'master' into iptables-next

14 years agoextensions: fix compilation of the new CHECKSUM target
Patrick McHardy [Thu, 15 Jul 2010 16:12:49 +0000 (18:12 +0200)] 
extensions: fix compilation of the new CHECKSUM target

Add missing header file.

Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agoextensions: libxt_rateest: fix bps options for iptables-save
Luciano Coelho [Thu, 15 Jul 2010 16:09:54 +0000 (18:09 +0200)] 
extensions: libxt_rateest: fix bps options for iptables-save

The output generated by the libxt_rateest extension for bps matches
was wrong and could not be restored properly.  This patch fixes this
problem by using the correct options in the right order when saving
the table.

Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agoextensions: libxt_CHECKSUM extension
Michael S. Tsirkin [Thu, 15 Jul 2010 15:23:24 +0000 (17:23 +0200)] 
extensions: libxt_CHECKSUM extension

This adds a `CHECKSUM' target, which can be used in the iptables mangle
table.

You can use this target to compute and fill in the checksum in
a packet that lacks a checksum.  This is particularly useful,
if you need to work around old applications such as dhcp clients,
that do not work well with checksum offloads, but don't want to disable
checksum offload in your device.

The problem happens in the field with virtualized applications.
For reference, see Red Hat bz 605555, as well as
http://www.spinics.net/lists/kvm/msg37660.html

Typical expected use (helps old dhclient binary running in a VM):
iptables -A POSTROUTING -t mangle -p udp --dport bootpc \
-j CHECKSUM --checksum-fill

Includes fixes by Jan Engelhardt <jengelh@medozas.de>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agoextensions: libxt_IDLETIMER: use xtables_param_act when checking options
Luciano Coelho [Thu, 15 Jul 2010 15:12:56 +0000 (17:12 +0200)] 
extensions: libxt_IDLETIMER: use xtables_param_act when checking options

This patch changes custom error messages for illegal options into the
default iptables messages, by using xtables_param_act().

Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
15 years agoxt_quota: also document negation
Jan Engelhardt [Fri, 2 Jul 2010 10:19:18 +0000 (12:19 +0200)] 
xt_quota: also document negation

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Signed-off-by: Patrick McHardy <kaber@trash.net>
15 years agoextensions: libxt_quota.c: Support option negation
Samuel Ortiz [Fri, 2 Jul 2010 07:57:09 +0000 (09:57 +0200)] 
extensions: libxt_quota.c: Support option negation

The xt_quota_info flags should be set properly for the --quota option negation
support.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
15 years agoextensions: libxt_rateest: fix typo in the man page
Luciano Coelho [Fri, 2 Jul 2010 07:36:37 +0000 (09:36 +0200)] 
extensions: libxt_rateest: fix typo in the man page

There were a few typos in some options in the rateest match section of the
man page: --rateest1-bps should be --rateest-bps1 and so on.

Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
15 years agoextensions: libipt_LOG/libip6t_LOG: support macdecode option
Patrick McHardy [Mon, 28 Jun 2010 12:51:35 +0000 (14:51 +0200)] 
extensions: libipt_LOG/libip6t_LOG: support macdecode option

Signed-off-by: Patrick McHardy <kaber@trash.net>
15 years agoMerge branch 'master' of vishnu.netfilter.org:/data/git/iptables
Patrick McHardy [Fri, 25 Jun 2010 12:50:53 +0000 (14:50 +0200)] 
Merge branch 'master' of vishnu.netfilter.org:/data/git/iptables

15 years agoMerge branch 'master' of git://dev.medozas.de/iptables
Patrick McHardy [Fri, 25 Jun 2010 12:50:03 +0000 (14:50 +0200)] 
Merge branch 'master' of git://dev.medozas.de/iptables

15 years agolibxt_conntrack: do print netmask
Jan Engelhardt [Thu, 24 Jun 2010 19:23:44 +0000 (21:23 +0200)] 
libxt_conntrack: do print netmask

References: http://bugzilla.netfilter.org/show_bug.cgi?id=659
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
15 years agolibxt_hashlimit: always print burst value
Jan Engelhardt [Thu, 24 Jun 2010 19:13:47 +0000 (21:13 +0200)] 
libxt_hashlimit: always print burst value

iptables -L lists the burst value, and so should iptables -S. I was
certainly surprised to see it gone even when explicitly specifying
--hashlimit-burst 5 on the command line.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
15 years agoMerge branch 'master' of git://dev.medozas.de/iptables
Patrick McHardy [Thu, 24 Jun 2010 15:00:23 +0000 (17:00 +0200)] 
Merge branch 'master' of git://dev.medozas.de/iptables

15 years agolibxt_set: new revision added
Jozsef Kadlecsik [Wed, 16 Jun 2010 10:45:33 +0000 (12:45 +0200)] 
libxt_set: new revision added

libipt_set renamed to libxt_set and the support for the forthcoming
ipset release added. I have tested backward (IPv4) and forward
compatibility (IPv4/IPv6):

ipset -N test iphash
ipset -A test test-address
iptables -N test-set
iptables -A test-set -j LOG --log-prefix "match "
iptables -A test-set -j DROP
iptables -A OUTPUT -m set --match-set test dst -j test-set
ping test-address

15 years agoextensions: add idletimer xt target extension
Luciano Coelho [Tue, 15 Jun 2010 14:54:50 +0000 (16:54 +0200)] 
extensions: add idletimer xt target extension

Add the extension plugin for the IDLETIMER x_tables target.

Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
15 years agoxt_sctp: support FORWARD_TSN chunk type
Shan Wei [Tue, 8 Jun 2010 12:16:57 +0000 (14:16 +0200)] 
xt_sctp: support FORWARD_TSN chunk type

The latest kernel has implemented Partial Reliability Extension
that defined in RFC3758.

This patch adds FORWARD_TSN chunk for tracing.

Signed-off-by: Shan Wei<shanwei@cn.fujitsu.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
15 years agoxt_sctp: Trace DATA chunk that supports SACK-IMMEDIATELY extension
Shan Wei [Tue, 8 Jun 2010 12:15:39 +0000 (14:15 +0200)] 
xt_sctp: Trace DATA chunk that supports SACK-IMMEDIATELY extension

SACK-IMMEDIATELY extension has defined in:
http://tools.ietf.org/html/draft-tuexen-tsvwg-sctp-sack-immediately-03.

And the latest kernel has added a I flag in DATA chunk to support this extension.
So let iptables/netfilter can trace it.

Signed-off-by: Shan Wei<shanwei@cn.fujitsu.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
15 years agoxtables: remove xtables_set_revision function
Jan Engelhardt [Mon, 7 Jun 2010 10:00:24 +0000 (12:00 +0200)] 
xtables: remove xtables_set_revision function

Since iptables uses its own copies of the header files anyway where the
revision field is exposed, there is no reach to access name[] beyond its
size.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
15 years agoxtables: another try at chain name length checking
Jan Engelhardt [Mon, 7 Jun 2010 09:50:25 +0000 (11:50 +0200)] 
xtables: another try at chain name length checking

Since XT_EXTENSION_MAXNAMELEN is now available, make use of it
and clear the confusion.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
15 years agoincludes: sync header files from Linux 2.6.35-rc1
Jan Engelhardt [Mon, 7 Jun 2010 08:59:03 +0000 (10:59 +0200)] 
includes: sync header files from Linux 2.6.35-rc1

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>