]> git.ipfire.org Git - thirdparty/iptables.git/log
thirdparty/iptables.git
14 years agolibipt_ULOG: use guided option parser
Jan Engelhardt [Tue, 8 Mar 2011 00:24:26 +0000 (01:24 +0100)] 
libipt_ULOG: use guided option parser

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxt_TPROXY: use guided option parser
Jan Engelhardt [Wed, 9 Feb 2011 01:15:22 +0000 (02:15 +0100)] 
libxt_TPROXY: use guided option parser

I am starting with a simple module here that does not require a
final_check function.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxtables: XTTYPE_PORT support
Jan Engelhardt [Mon, 14 Feb 2011 14:12:50 +0000 (15:12 +0100)] 
libxtables: XTTYPE_PORT support

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxtables: XTTYPE_ONEHOST support
Jan Engelhardt [Mon, 14 Feb 2011 14:10:15 +0000 (15:10 +0100)] 
libxtables: XTTYPE_ONEHOST support

The bonus of the POSIX socket API is that it is almost protocol-agnostic
and that there are ready-made functions to take over the gist of address
parsing and packing.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibip[6]t_LOG: use guided option parser
Jan Engelhardt [Tue, 15 Feb 2011 11:05:12 +0000 (12:05 +0100)] 
libip[6]t_LOG: use guided option parser

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

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

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxtables: pass struct xt_entry_{match,target} to x6 parser
Jan Engelhardt [Sun, 6 Mar 2011 17:11:58 +0000 (18:11 +0100)] 
libxtables: pass struct xt_entry_{match,target} to x6 parser

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

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxt_NFQUEUE: use guided option parser
Jan Engelhardt [Sun, 6 Mar 2011 16:54:50 +0000 (17:54 +0100)] 
libxt_NFQUEUE: use guided option parser

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxt_CT: use guided option parser
Jan Engelhardt [Sun, 6 Mar 2011 16:47:03 +0000 (17:47 +0100)] 
libxt_CT: use guided option parser

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxtables: XTTYPE_UINT16 support
Jan Engelhardt [Sun, 6 Mar 2011 16:42:51 +0000 (17:42 +0100)] 
libxtables: XTTYPE_UINT16 support

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxt_connbytes: use guided option parser
Jan Engelhardt [Sun, 6 Mar 2011 16:19:10 +0000 (17:19 +0100)] 
libxt_connbytes: use guided option parser

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxtables: XTTYPE_UINT64RC support
Jan Engelhardt [Sun, 6 Mar 2011 16:13:54 +0000 (17:13 +0100)] 
libxtables: XTTYPE_UINT64RC support

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxtables: XTTYPE_UINT8RC support
Jan Engelhardt [Sun, 6 Mar 2011 16:09:19 +0000 (17:09 +0100)] 
libxtables: XTTYPE_UINT8RC support

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxt_tcpmss: use guided option parser
Jan Engelhardt [Sun, 6 Mar 2011 16:04:35 +0000 (17:04 +0100)] 
libxt_tcpmss: use guided option parser

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxt_length: use guided option parser
Jan Engelhardt [Sun, 6 Mar 2011 16:00:49 +0000 (17:00 +0100)] 
libxt_length: use guided option parser

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxtables: XTTYPE_UINT16RC support
Jan Engelhardt [Sun, 6 Mar 2011 15:59:23 +0000 (16:59 +0100)] 
libxtables: XTTYPE_UINT16RC support

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibipt_realm: use guided option parser
Jan Engelhardt [Sun, 6 Mar 2011 15:38:51 +0000 (16:38 +0100)] 
libipt_realm: use guided option parser

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxt_devgroup: use guided option parser
Jan Engelhardt [Sun, 6 Mar 2011 15:02:03 +0000 (16:02 +0100)] 
libxt_devgroup: use guided option parser

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxtables: linked-list name<->id map
Jan Engelhardt [Sun, 6 Mar 2011 15:24:43 +0000 (16:24 +0100)] 
libxtables: linked-list name<->id map

This consolidates the maps from libxt_devgroup and libxt_realm.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxt_quota: use guided option parser
Jan Engelhardt [Sun, 6 Mar 2011 15:58:24 +0000 (16:58 +0100)] 
libxt_quota: use guided option parser

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxtables: XTTYPE_UINT64 support
Jan Engelhardt [Sun, 6 Mar 2011 15:56:53 +0000 (16:56 +0100)] 
libxtables: XTTYPE_UINT64 support

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxt_CONNMARK: use guided option parser
Jan Engelhardt [Sun, 6 Mar 2011 14:54:58 +0000 (15:54 +0100)] 
libxt_CONNMARK: use guided option parser

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxt_MARK: use guided option parser
Jan Engelhardt [Sun, 6 Mar 2011 14:21:24 +0000 (15:21 +0100)] 
libxt_MARK: use guided option parser

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agolibxtables: XTTYPE_MARKMASK32 support
Jan Engelhardt [Sun, 6 Mar 2011 13:57:44 +0000 (14:57 +0100)] 
libxtables: XTTYPE_MARKMASK32 support

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 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>