]> git.ipfire.org Git - thirdparty/iptables.git/log
thirdparty/iptables.git
14 years agoSET target revision 2 added
Jozsef Kadlecsik [Sun, 17 Apr 2011 09:38:18 +0000 (11:38 +0200)] 
SET target revision 2 added

The new revision of the SET target supports the following new operations

- specifying the timeout value of the entry to be added
- flag to instruct the kernel that if the entry already
  exists then reset the timeout value to the specified one (or
  to the default from the set definition)

14 years agoMerge branch 'opts' of git://dev.medozas.de/iptables
Patrick McHardy [Wed, 13 Apr 2011 11:38:20 +0000 (13:38 +0200)] 
Merge branch 'opts' of git://dev.medozas.de/iptables

14 years agoMerge branch 'opts' of git://dev.medozas.de/iptables
Patrick McHardy [Tue, 12 Apr 2011 14:05:39 +0000 (16:05 +0200)] 
Merge branch 'opts' of git://dev.medozas.de/iptables

14 years agoMerge branch 'master' of vishnu.netfilter.org:/data/git/iptables
Patrick McHardy [Tue, 12 Apr 2011 14:05:28 +0000 (16:05 +0200)] 
Merge branch 'master' of vishnu.netfilter.org:/data/git/iptables

14 years agoFix set match/target direction parser
Jozsef Kadlecsik [Sat, 9 Apr 2011 19:29:08 +0000 (21:29 +0200)] 
Fix set match/target direction parser

The direction parser did not catch when more src/dst direction
parameters were supplied than allowed.

14 years agodoc: avoid duplicate entries in manpage
Jan Engelhardt [Wed, 6 Apr 2011 11:21:54 +0000 (13:21 +0200)] 
doc: avoid duplicate entries in manpage

Commit v1.4.9-35-gd4105ad changed from [A-Z] and [a-z] to use
[[:alnum:]], which unfortunately drew matches into the target section,
and targets into the match section. [[:upper:]] and [[:lower:]] should
have been used instead, of course.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxt_u32: use guided option parser
Jan Engelhardt [Wed, 2 Mar 2011 22:06:59 +0000 (23:06 +0100)] 
libxt_u32: use guided option parser

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxt_time: use guided option parser
Jan Engelhardt [Wed, 2 Mar 2011 22:03:36 +0000 (23:03 +0100)] 
libxt_time: use guided option parser

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxt_state: use guided option parser
Jan Engelhardt [Wed, 2 Mar 2011 21:52:04 +0000 (22:52 +0100)] 
libxt_state: use guided option parser

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxt_pkttype: use guided option parser
Jan Engelhardt [Wed, 2 Mar 2011 18:19:16 +0000 (19:19 +0100)] 
libxt_pkttype: use guided option parser

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxt_physdev: use guided option parser
Jan Engelhardt [Wed, 2 Mar 2011 18:09:38 +0000 (19:09 +0100)] 
libxt_physdev: use guided option parser

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxt_helper: use guided option parser
Jan Engelhardt [Wed, 2 Mar 2011 17:55:32 +0000 (18:55 +0100)] 
libxt_helper: use guided option parser

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxt_comment: use guided option parser
Jan Engelhardt [Tue, 1 Mar 2011 19:16:22 +0000 (20:16 +0100)] 
libxt_comment: use guided option parser

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxt_TCPOPTSTRIP: use guided option parser
Jan Engelhardt [Wed, 2 Mar 2011 21:57:52 +0000 (22:57 +0100)] 
libxt_TCPOPTSTRIP: use guided option parser

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxt_SECMARK: use guided option parser
Jan Engelhardt [Wed, 2 Mar 2011 21:50:13 +0000 (22:50 +0100)] 
libxt_SECMARK: use guided option parser

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxt_LED: use guided option parser
Jan Engelhardt [Sun, 6 Mar 2011 17:21:42 +0000 (18:21 +0100)] 
libxt_LED: use guided option parser

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxt_DSCP: use guided option parser
Jan Engelhardt [Tue, 1 Mar 2011 19:28:24 +0000 (20:28 +0100)] 
libxt_DSCP: use guided option parser

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxt_CLASSIFY: use guided option parser
Jan Engelhardt [Tue, 1 Mar 2011 19:14:16 +0000 (20:14 +0100)] 
libxt_CLASSIFY: use guided option parser

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxt_AUDIT: use guided option parser
Jan Engelhardt [Tue, 1 Mar 2011 19:11:01 +0000 (20:11 +0100)] 
libxt_AUDIT: use guided option parser

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibipt_addrtype: use guided option parser
Jan Engelhardt [Tue, 1 Mar 2011 19:02:35 +0000 (20:02 +0100)] 
libipt_addrtype: use guided option parser

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibipt_ECN: use guided option parser
Jan Engelhardt [Wed, 2 Mar 2011 23:51:16 +0000 (00:51 +0100)] 
libipt_ECN: use guided option parser

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibip6t_ipv6header: use guided option parser
Jan Engelhardt [Tue, 1 Mar 2011 18:51:16 +0000 (19:51 +0100)] 
libip6t_ipv6header: use guided option parser

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibip[6]t_icmp: use guided option parser
Jan Engelhardt [Tue, 1 Mar 2011 17:36:15 +0000 (18:36 +0100)] 
libip[6]t_icmp: use guided option parser

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibip6t_hbh: use guided option parser
Jan Engelhardt [Wed, 2 Mar 2011 23:40:43 +0000 (00:40 +0100)] 
libip6t_hbh: use guided option parser

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibip6t_dst: use guided option parser
Jan Engelhardt [Fri, 18 Feb 2011 01:11:31 +0000 (02:11 +0100)] 
libip6t_dst: use guided option parser

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibip[6]t_REJECT: use guided option parser
Jan Engelhardt [Wed, 16 Feb 2011 00:16:39 +0000 (01:16 +0100)] 
libip[6]t_REJECT: use guided option parser

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxtables: XTTYPE_STRING support
Jan Engelhardt [Tue, 15 Feb 2011 21:09:21 +0000 (22:09 +0100)] 
libxtables: XTTYPE_STRING support

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxt_esp: use guided option parser
Jan Engelhardt [Sun, 27 Feb 2011 22:56:28 +0000 (23:56 +0100)] 
libxt_esp: use guided option parser

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibip6t_frag: use guided option parser
Jan Engelhardt [Fri, 18 Feb 2011 01:17:54 +0000 (02:17 +0100)] 
libip6t_frag: use guided option parser

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibip[6]t_ah: use guided option parser
Jan Engelhardt [Wed, 16 Feb 2011 00:59:18 +0000 (01:59 +0100)] 
libip[6]t_ah: use guided option parser

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxtables: XTTYPE_UINT32RC support
Jan Engelhardt [Sun, 27 Feb 2011 22:41:10 +0000 (23:41 +0100)] 
libxtables: XTTYPE_UINT32RC support

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibip[6]t_hl: use guided option parser
Jan Engelhardt [Fri, 18 Feb 2011 02:20:56 +0000 (03:20 +0100)] 
libip[6]t_hl: use guided option parser

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibip[6]t_HL: use guided option parser
Jan Engelhardt [Sun, 13 Feb 2011 02:31:54 +0000 (03:31 +0100)] 
libip[6]t_HL: use guided option parser

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxtables: XTTYPE_UINT8 support
Jan Engelhardt [Sun, 27 Feb 2011 18:03:28 +0000 (19:03 +0100)] 
libxtables: XTTYPE_UINT8 support

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxt_cluster: use guided option parser
Jan Engelhardt [Sun, 27 Feb 2011 16:52:23 +0000 (17:52 +0100)] 
libxt_cluster: use guided option parser

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxtables: min-max option support
Jan Engelhardt [Sun, 27 Feb 2011 16:38:34 +0000 (17:38 +0100)] 
libxtables: min-max option support

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxt_cpu: use guided option parser
Jan Engelhardt [Fri, 18 Feb 2011 02:41:18 +0000 (03:41 +0100)] 
libxt_cpu: use guided option parser

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxtables: XTTYPE_UINT32 support
Jan Engelhardt [Wed, 16 Feb 2011 00:22:25 +0000 (01:22 +0100)] 
libxtables: XTTYPE_UINT32 support

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxt_CONNSECMARK: use guided option parser
Jan Engelhardt [Sun, 27 Feb 2011 15:50:22 +0000 (16:50 +0100)] 
libxt_CONNSECMARK: use guided option parser

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxtables: provide better final_check
Jan Engelhardt [Thu, 10 Feb 2011 15:57:37 +0000 (16:57 +0100)] 
libxtables: provide better final_check

This passes the per-extension data block to the new x6_fcheck function
pointer, which can then do last alterations without using hacks
like global variables (think libxt_statistic).

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxt_socket: use guided option parser
Jan Engelhardt [Fri, 18 Feb 2011 02:22:52 +0000 (03:22 +0100)] 
libxt_socket: use guided option parser

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxt_CHECKSUM: use guided option parser
Jan Engelhardt [Sun, 27 Feb 2011 15:54:27 +0000 (16:54 +0100)] 
libxt_CHECKSUM: use guided option parser

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxtables: guided option parser
Jan Engelhardt [Mon, 7 Feb 2011 03:00:50 +0000 (04:00 +0100)] 
libxtables: guided option parser

This patchset seeks to drastically reduce the code in the individual
extensions by centralizing their argument parsing (breakdown of
strings), validation, and in part, assignment.

As a secondary goal, this reduces the number of static storage duration
variables in flight.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agoextensions: add missing checks for specific flags (2)
Jan Engelhardt [Tue, 1 Mar 2011 18:48:10 +0000 (19:48 +0100)] 
extensions: add missing checks for specific flags (2)

Addendum to v1.4.10-75-g4e5d4bf. It does not make sense to use
ipv6header's --soft without specifying any options.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agoconvert ip6?tables-multi to actually use their own header files
Maciej Zenczykowski [Tue, 5 Apr 2011 10:43:26 +0000 (12:43 +0200)] 
convert ip6?tables-multi to actually use their own header files

Signed-off-by: Maciej Zenczykowski <maze@google.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agomove 'int line' definition from ip6?tables.c into xtables.c
Maciej Zenczykowski [Tue, 5 Apr 2011 10:42:37 +0000 (12:42 +0200)] 
move 'int line' definition from ip6?tables.c into xtables.c

Signed-off-by: Maciej Zenczykowski <maze@google.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agov6: rename do_command() to do_command6()
Maciej Zenczykowski [Mon, 4 Apr 2011 13:38:44 +0000 (15:38 +0200)] 
v6: rename do_command() to do_command6()

(actually only applies to two comments, since the
function has long been called do_command6)

Signed-off-by: Maciej Zenczykowski <maze@google.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agov4: rename do_command() to do_command4()
Maciej Zenczykowski [Mon, 4 Apr 2011 13:38:11 +0000 (15:38 +0200)] 
v4: rename do_command() to do_command4()

Signed-off-by: Maciej Zenczykowski <maze@google.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agov6: rename print_rule() to print_rule6()
Maciej Zenczykowski [Mon, 4 Apr 2011 13:37:43 +0000 (15:37 +0200)] 
v6: rename print_rule() to print_rule6()

Signed-off-by: Maciej Zenczykowski <maze@google.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agov4: rename print_rule() to print_rule4()
Maciej Zenczykowski [Mon, 4 Apr 2011 13:37:13 +0000 (15:37 +0200)] 
v4: rename print_rule() to print_rule4()

Signed-off-by: Maciej Zenczykowski <maze@google.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agov6: rename delete_chain() to delete_chain6()
Maciej Zenczykowski [Mon, 4 Apr 2011 13:36:45 +0000 (15:36 +0200)] 
v6: rename delete_chain() to delete_chain6()

Signed-off-by: Maciej Zenczykowski <maze@google.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agov4: rename delete_chain() to delete_chain4()
Maciej Zenczykowski [Mon, 4 Apr 2011 13:36:14 +0000 (15:36 +0200)] 
v4: rename delete_chain() to delete_chain4()

Signed-off-by: Maciej Zenczykowski <maze@google.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agov6: rename flush_entries() to flush_entries6()
Maciej Zenczykowski [Mon, 4 Apr 2011 13:35:47 +0000 (15:35 +0200)] 
v6: rename flush_entries() to flush_entries6()

Signed-off-by: Maciej Zenczykowski <maze@google.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agov4: rename flush_entries() to flush_entries4()
Maciej Zenczykowski [Mon, 4 Apr 2011 13:35:20 +0000 (15:35 +0200)] 
v4: rename flush_entries() to flush_entries4()

Signed-off-by: Maciej Zenczykowski <maze@google.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agov6: rename for_each_chain() to for_each_chain6()
Maciej Zenczykowski [Mon, 4 Apr 2011 13:34:54 +0000 (15:34 +0200)] 
v6: rename for_each_chain() to for_each_chain6()

Signed-off-by: Maciej Zenczykowski <maze@google.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agov4: rename for_each_chain() to for_each_chain4()
Maciej Zenczykowski [Mon, 4 Apr 2011 13:34:28 +0000 (15:34 +0200)] 
v4: rename for_each_chain() to for_each_chain4()

Signed-off-by: Maciej Zenczykowski <maze@google.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agoxtables.h: init_extensions() no longer exists
Maciej Zenczykowski [Mon, 4 Apr 2011 13:33:58 +0000 (15:33 +0200)] 
xtables.h: init_extensions() no longer exists

Signed-off-by: Maciej Zenczykowski <maze@google.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agov6: rename init_extensions() to init_extensions6()
Maciej Zenczykowski [Mon, 4 Apr 2011 13:33:25 +0000 (15:33 +0200)] 
v6: rename init_extensions() to init_extensions6()

Signed-off-by: Maciej Zenczykowski <maze@google.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agov4: rename init_extensions() to init_extensions4()
Maciej Zenczykowski [Mon, 4 Apr 2011 13:32:39 +0000 (15:32 +0200)] 
v4: rename init_extensions() to init_extensions4()

Signed-off-by: Maciej Zenczykowski <maze@google.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agoxtables: delay (statically built) match/target initialization
Maciej Zenczykowski [Mon, 4 Apr 2011 13:31:43 +0000 (15:31 +0200)] 
xtables: delay (statically built) match/target initialization

Matches and targets built into the iptables static binary will always
be registered as the binary starts up, this may potentially (as a result
of kernel version support checking) result in modules being autoloaded.

This is undesirable (for example it may cause CONNMARK target to load
and thus cause the kernel to load the conntrack module, which isn't a
no-op).

Transition to a system where matches and targets are registered into
a pending list, from whence they get fully registered only when
required.

Signed-off-by: Maciej Zenczykowski <maze@google.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agoxtables_ip6addr_to_numeric: fix typo in comment
Maciej Zenczykowski [Mon, 4 Apr 2011 13:31:09 +0000 (15:31 +0200)] 
xtables_ip6addr_to_numeric: fix typo in comment

An IPv6 address consists of eight hexadecimal 16-bit values seperated
by colons, or alternatively, six (not five) of these followed by a colon
and an IPv4 address in standard dotted decimal quad notation
(for IPv4 mapped addresses and the like).

Signed-off-by: Maciej Zenczykowski <maze@google.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agomark newly opened fds as FD_CLOEXEC (close on exec)
Maciej Zenczykowski [Mon, 4 Apr 2011 13:30:32 +0000 (15:30 +0200)] 
mark newly opened fds as FD_CLOEXEC (close on exec)

(This is iptables-1.4.3.1-cloexec.patch from RedHat iptables.src.rpm)

Signed-off-by: Maciej Zenczykowski <maze@google.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agoman pages: allow underscores in match and target names
Maciej Zenczykowski [Mon, 4 Apr 2011 13:29:40 +0000 (15:29 +0200)] 
man pages: allow underscores in match and target names

Signed-off-by: Maciej Zenczykowski <maze@google.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agoiptables: documentation for iptables and ip6tables "security" tables
Mark Montague [Mon, 4 Apr 2011 12:54:52 +0000 (14:54 +0200)] 
iptables: documentation for iptables and ip6tables "security" tables

Add documentation for the iptables and ip6tables "security" tables.
Based on http://lwn.net/Articles/267140/ and kernel source.

Signed-off-by: Mark Montague <mark@catseye.org>
Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agoiptables: add manual page section for AUDIT target
Thomas Graf [Wed, 16 Mar 2011 15:30:09 +0000 (16:30 +0100)] 
iptables: add manual page section for AUDIT target

Signed-off-by: Thomas Graf <tgraf@redhat.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agoiptables: add -C to check for existing rules
Stefan Tomanek [Tue, 8 Mar 2011 21:42:51 +0000 (22:42 +0100)] 
iptables: add -C to check for existing rules

It is often useful to check whether a specific rule is already present
in a chain without actually modifying the iptables config.

Services like fail2ban usually employ techniques like grepping through
the output of "iptables -L" which is quite error prone.

This patch adds a new operation -C to the iptables command which
mostly works like -D; it can detect and indicate the existence of the
specified rule by modifying the exit code. The new operation
TC_CHECK_ENTRY uses the same code as the -D operation, whose functions
got a dry-run parameter appended.

Signed-off-by: Stefan Tomanek <stefan.tomanek@wertarbyte.de>
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agoip(6)tables-multi: unify subcommand handling
Stefan Tomanek [Mon, 7 Mar 2011 17:30:27 +0000 (18:30 +0100)] 
ip(6)tables-multi: unify subcommand handling

I found the subcommand handling and naming done by iptables-multi and
ip6tables-multi very confusing and complicated; this patch
reorganizes the subcommands in a single table, allowing both variants
of them to be used (iptables/main) and also prints a list of the
allowed commands if an unknown command is entered by the user.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agodoc: add VERSION section to manpages
Jan Engelhardt [Tue, 1 Mar 2011 11:51:21 +0000 (12:51 +0100)] 
doc: add VERSION section to manpages

This shall make it easier to identify outdated HTML renditions on the
interwebs, since many of them do not display the .TH header like man(1)
does.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agoiptables: fix an inversion
Jan Engelhardt [Tue, 1 Mar 2011 01:45:34 +0000 (02:45 +0100)] 
iptables: fix an inversion

Revisiting the original condition (viewable in git log -1 -p
v1.4.10-57-gacef604), one can notice an unforuntate inversion. This
commit corrects this.

Testcase: -A INPUT -p tcp --dport 1

Reported-by: Florian Westphal
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agoxtables: use all IPv6 addresses resolved from a hostname
Wes Campaigne [Tue, 22 Feb 2011 00:10:10 +0000 (19:10 -0500)] 
xtables: use all IPv6 addresses resolved from a hostname

Fixes a long-standing issue where host_to_ip6addr would only ever
examine/return the first item of the address chain returned by
getaddrinfo, instead of traversing the chain and copying each of them.

This has always been how host_to_ip6addr behaves, and all of the other
related IPv6 code is already written to handle multiple possible
addresses.

[Style fixups. Removal of redundant i<*naddrs check. -j.eng]

Signed-off-by: Wes Campaigne <westacular@gmail.com>
14 years agoxtables: fix the broken detection/removal of redundant addresses
Wes Campaigne [Tue, 22 Feb 2011 00:10:12 +0000 (19:10 -0500)] 
xtables: fix the broken detection/removal of redundant addresses

[To observe this issue, populate a hostname (DNS or local db)
with multiple adresses across multiple subnets (cf. prefixlen
below)

# e.g. /etc/hosts
127.0.0.2       lo-x
127.0.0.3       lo-x
127.0.1.4       lo-x
127.0.1.5       lo-x
127.0.2.6       lo-x

Then invoke xtables_ipparse_any by e.g. `-m conntrack
--ctorigsrc lo-x/24`. -j.eng]

This same block of code, apparently to detect if addresses are
identical after applying the mask, and to skip the duplicates and the
ones made redundant by the mask, has been present and unchanged from
as far back as I could find (circa iptables 1.2).

By inspection, it was wrong, and always has been: once the code finds
a duplicate, it will drop the rest of the array one by one as it
re-detects the same duplicate over and over. When the addresses came
from a single hostname lookup, and their order was random, then this
created unpredictable behaviour by iptables, which seem to ignore some
of those addresses at random times.

I suspect the original idea also involved a swap between the duplicate
and the address from the (current) end of the array, but a line of
code to do that seems to have never existed. I have finally added it.
(Well, as much as is needed: there does not need to be a full swap,
because we are just going to ignore the duplicate, pretend the array
is one shorter, and never look at the contents of the end again. So,
we can get away with just copying from the end.)

[Reword comment about shuffle: replace by mentioning tail copy to
replace dup. -j.eng]

Signed-off-by: Wes Campaigne <westacular@gmail.com>
14 years agoxtables: fix excessive memory allocation in host_to_ipaddr
Wes Campaigne [Tue, 22 Feb 2011 00:10:11 +0000 (19:10 -0500)] 
xtables: fix excessive memory allocation in host_to_ipaddr

host_to_ipaddr was unnecessarily asking for an array of length n^2 to
store just n addresses.

Signed-off-by: Wes Campaigne <westacular@gmail.com>
14 years agolibxtables: avoid confusing use of ai_protocol=IPPROTO_IPV6
Wes Campaigne [Tue, 22 Feb 2011 00:10:10 +0000 (19:10 -0500)] 
libxtables: avoid confusing use of ai_protocol=IPPROTO_IPV6

[Split hunk from Wes's submission. Added commit message. -j.eng]

ai_protocol normally specifies the L4 protocol one wants to
specifically inquire about when a service (2nd parameter to
getaddrinfo) is specified. Such a service lookup would potentially
yield nothing, because there just is not any "mytunnel 2222/ipv6" in
/etc/services, since IPPROTO_IPV6 itself is not a protocol with a
concept of (port-based) services to begin with.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxtables: fix memory scribble beyond end of array
Jan Engelhardt [Mon, 21 Feb 2011 02:21:18 +0000 (03:21 +0100)] 
libxtables: fix memory scribble beyond end of array

When using -s "", the "n" variable in the code remains uninitialized
and usually scribbes beyond the end of the array.

Furthermore, "n" is just as big as entries in the last host lookup.
When specifying more than one item to -s, e.g. "-s host,host", "n" is
less than "count", and we are not masking the addresses at all
(leaving them at addr/32 resp. addr/128).

The issue goes back to the initial code from v1.4.5~21.

References: http://bugs.debian.org/611990
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agodoc: rateest options can be optional
Jan Engelhardt [Mon, 21 Feb 2011 01:59:50 +0000 (02:59 +0100)] 
doc: rateest options can be optional

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxt_quota: require --quota to be specified
Jan Engelhardt [Sun, 20 Feb 2011 19:30:56 +0000 (20:30 +0100)] 
libxt_quota: require --quota to be specified

It is pretty pointless to use -m quota without specifying --quota.
There would be nothing left to count down on.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agodoc: fix odd partial sentence in libipt_TTL
Jan Engelhardt [Sun, 20 Feb 2011 16:15:14 +0000 (17:15 +0100)] 
doc: fix odd partial sentence in libipt_TTL

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agodoc: mention other possible nf_loggers for TRACE
Jan Engelhardt [Sun, 20 Feb 2011 16:13:03 +0000 (17:13 +0100)] 
doc: mention other possible nf_loggers for TRACE

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibipt_ECN: set proper option flags
Jan Engelhardt [Sat, 19 Feb 2011 19:00:06 +0000 (20:00 +0100)] 
libipt_ECN: set proper option flags

When specifying --ecn-tcp-remove, *flags will be wrongly set to denote
that --ecn-ip-ect had been specified.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agoextensions: add missing checks for specific flags
Jan Engelhardt [Sat, 19 Feb 2011 18:37:53 +0000 (19:37 +0100)] 
extensions: add missing checks for specific flags

With "!flags", any option will be accepted. The extensions however
want one very specific option to be used (or wrong help text).

Commits: DNAT: v1.3.8~23, osf: v1.4.6~3

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibip6t_hbh: remove unimplemented --hbh-not-strict
Jan Engelhardt [Sat, 19 Feb 2011 14:29:21 +0000 (15:29 +0100)] 
libip6t_hbh: remove unimplemented --hbh-not-strict

Same as with ip6t_dst.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibip6t_dst: remove unimplemented --dst-not-strict
Jan Engelhardt [Fri, 18 Feb 2011 00:48:33 +0000 (01:48 +0100)] 
libip6t_dst: remove unimplemented --dst-not-strict

This was never ever implemented in the kernel, so just remove it.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agoRemove unused CVS expanded keywords
Jan Engelhardt [Fri, 18 Feb 2011 01:29:14 +0000 (02:29 +0100)] 
Remove unused CVS expanded keywords

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agoextensions: remove redundant init functions
Jan Engelhardt [Fri, 18 Feb 2011 01:00:33 +0000 (02:00 +0100)] 
extensions: remove redundant init functions

The main program already zeroes the per-extension data block.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agodoc: fix misspelling of "field"
Jan Engelhardt [Fri, 18 Feb 2011 00:45:05 +0000 (01:45 +0100)] 
doc: fix misspelling of "field"

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agodoc: fix wrong sentence about negation in xt_limit
Jan Engelhardt [Thu, 17 Feb 2011 13:56:05 +0000 (14:56 +0100)] 
doc: fix wrong sentence about negation in xt_limit

This is an update to commit v1.4.7~6.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agoxtables: use strspn() to check if string needs to be quoted
Max Kellerman [Thu, 17 Feb 2011 10:57:19 +0000 (11:57 +0100)] 
xtables: use strspn() to check if string needs to be quoted

Problem: the call xtables_save_string("'") prints just a single quote,
not enclosed in double quoted and not escaped.

Steps to reproduce:

 $ iptables -A foo -m comment --comment "'" -j ACCEPT
 $ iptables-multi save|grep foo
 -A foo -m comment --comment ' -j ACCEPT

The cause was the use of strcspn() to locate the first character which
justified quoting the string in double quotes.  That however was
wrong, because the way strcspn() was called, it returned a pointer to
the first character that was not to be escaped, which did the right
thing most of the time, but not for strings consisting only of quote
characters.  This patch changes strcspn() to strspn().

Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agoextensions: fix indent of vtable
Jan Engelhardt [Tue, 15 Feb 2011 11:02:51 +0000 (12:02 +0100)] 
extensions: fix indent of vtable

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxt_devgroup: option whitespace update following v1.4.10-49-g7386635
Jan Engelhardt [Wed, 16 Feb 2011 01:42:21 +0000 (02:42 +0100)] 
libxt_devgroup: option whitespace update following v1.4.10-49-g7386635

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agoip6tables: spacing fixes for -o argument
Jan Engelhardt [Wed, 16 Feb 2011 01:41:22 +0000 (02:41 +0100)] 
ip6tables: spacing fixes for -o argument

For aesthetic consistency, put a space after -o.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agoiptables: fix segfault target option parsing
Jan Engelhardt [Fri, 11 Feb 2011 00:45:26 +0000 (01:45 +0100)] 
iptables: fix segfault target option parsing

With v1.4.10-58-g94e247b, target option parsing started to happen in the
wrong case.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agoMerge branch 'master' of git://dev.medozas.de/iptables
Patrick McHardy [Wed, 9 Feb 2011 07:13:23 +0000 (08:13 +0100)] 
Merge branch 'master' of git://dev.medozas.de/iptables

14 years agoiptables: fix error message for unknown options
Jan Engelhardt [Mon, 7 Feb 2011 02:45:26 +0000 (03:45 +0100)] 
iptables: fix error message for unknown options

-From: iptables v1.4.10: option "-q" requires an argument
+To:   iptables v1.4.10: unknown option "-q"

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agosrc: move match option handling from do_command6 into its own functions
Jan Engelhardt [Mon, 7 Feb 2011 02:42:47 +0000 (03:42 +0100)] 
src: move match option handling from do_command6 into its own functions

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
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>