]> git.ipfire.org Git - thirdparty/iptables.git/log
thirdparty/iptables.git
16 years agoiptables: accept multiple IP address specifications for -s, -d
Michael Granzow [Thu, 9 Apr 2009 17:24:36 +0000 (18:24 +0100)] 
iptables: accept multiple IP address specifications for -s, -d

libiptc already supports adding and deleting multiple rules with
different addresses, so it only needs to be wired up to the options.

# ip6tables -I INPUT -s 2001:db8::d,2001:db8::e -j DROP

References: http://marc.info/?l=netfilter-devel&m=123929790719202&w=2

Adjustments made: syntax, removal of unneeded variables, manpage
adjustment, soversion bump.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agoBump version v1.4.4
Patrick McHardy [Tue, 16 Jun 2009 14:37:44 +0000 (16:37 +0200)] 
Bump version

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agoMerge branch 'stable' of git://dev.medozas.de/iptables
Patrick McHardy [Thu, 11 Jun 2009 15:56:24 +0000 (17:56 +0200)] 
Merge branch 'stable' of git://dev.medozas.de/iptables

16 years agoUpdated set/SET match and target to support multiple ipset protocols.
Jozsef Kadlecsik [Thu, 11 Jun 2009 10:27:09 +0000 (12:27 +0200)] 
Updated set/SET match and target to support multiple ipset protocols.

By checking the protocol version of the kernel part, the sockopt type
of ipset protocols are all supported. Forward compatibility with the
netlink based protocol is missing.

The --set option of the set match is replaced by --match-set to avoid
clashing with the recent match, but the old option is also kept.

Manpages are updated, references to bindings removed.

16 years agomanpages: markup corrections
Jan Engelhardt [Wed, 10 Jun 2009 18:18:43 +0000 (20:18 +0200)] 
manpages: markup corrections

The manpage of xt_cluster and xt_recent had some unclosed tags.
Backslashes in commands are also not wanted because manpages are a
freeform, automatically-wrapped text.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agoiptables: close open file descriptors
Jan Engelhardt [Wed, 10 Jun 2009 11:52:58 +0000 (13:52 +0200)] 
iptables: close open file descriptors

Just for correctness, close some file descriptors that were opened.
(E.g. ip6tables-save reading from procfs files.)

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agolibxt_connlimit: initialize v6_mask
kd6lvw [Sun, 7 Jun 2009 12:23:00 +0000 (14:23 +0200)] 
libxt_connlimit: initialize v6_mask

When converting "--connlimit-mask $bits" to a 128-bit v6 mask, the
code uses a left shift on v6_mask[n]. This requires v6_mask to be
filled with all one-bits beforehand, but this initialization was not
done.

References: http://bugzilla.netfilter.org/show_bug.cgi?id=597
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agolibxt_tcp: manpage corrections and suggestions
Ian Bruce [Sat, 6 Jun 2009 04:04:24 +0000 (06:04 +0200)] 
libxt_tcp: manpage corrections and suggestions

From: Ian Bruce <ian_bruce@fastmail.net>

The commit corrects some minor errors in the iptables(8) man page,
related to port ranges in the "tcp" module.

Reference: http://bugs.debian.org/531677
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agolibxt_tcp: fix a manpage syntax typo
Frank Tobin [Thu, 21 May 2009 03:09:00 +0000 (05:09 +0200)] 
libxt_tcp: fix a manpage syntax typo

Reference: http://bugzilla.netfilter.org/show_bug.cgi?id=596
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agoextensions: remove redundant casts
Jan Engelhardt [Mon, 8 Jun 2009 13:46:52 +0000 (15:46 +0200)] 
extensions: remove redundant casts

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agoDNAT/SNAT: add manpage documentation for --persistent flag
Jan Engelhardt [Mon, 8 Jun 2009 13:46:19 +0000 (15:46 +0200)] 
DNAT/SNAT: add manpage documentation for --persistent flag

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agoextensions: use NFPROTO_UNSPEC for .family field
Jan Engelhardt [Mon, 1 Jun 2009 09:56:23 +0000 (11:56 +0200)] 
extensions: use NFPROTO_UNSPEC for .family field

This constant would be the designated one for the .family field; it
also, given recent changes, makes grep for NFPROTO_UNSPEC work to
finally recollect all manpages.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agobuild: fix manpage collection
Jan Engelhardt [Mon, 1 Jun 2009 09:52:07 +0000 (11:52 +0200)] 
build: fix manpage collection

Florian Westphal points out that v1.4.3.2-9-gc304d77 greps for the
keyword in the wrong file, and that files with NFPROTO_UNSPEC are
skipped.

This patch corrects that part, and makes `make` now output the
manpages it collected.

Reported-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agopolicy: merge ipv6 and ipv4 variant
Jan Engelhardt [Mon, 1 Jun 2009 09:46:12 +0000 (11:46 +0200)] 
policy: merge ipv6 and ipv4 variant

The files duplicate most of their code, and struct ipt_policy_info
being defined to xt_policy_info makes them actually have even more in
common.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agopolicy: use direct xt_policy_info instead of ipt/ip6t
Jan Engelhardt [Sun, 31 May 2009 20:43:12 +0000 (22:43 +0200)] 
policy: use direct xt_policy_info instead of ipt/ip6t

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agolibip6t_policy: remove redundant functions
Jan Engelhardt [Sun, 31 May 2009 20:34:54 +0000 (22:34 +0200)] 
libip6t_policy: remove redundant functions

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agomanpages: do not include v4-only modules in ip6tables manpage
Jan Engelhardt [Tue, 26 May 2009 11:21:55 +0000 (13:21 +0200)] 
manpages: do not include v4-only modules in ip6tables manpage

References: http://bugs.debian.org/529954
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agoaddrtype: fix one manpage type
Jan Engelhardt [Wed, 13 May 2009 15:40:05 +0000 (17:40 +0200)] 
addrtype: fix one manpage type

References: http://bugs.debian.org/528457
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agoiptables: replace open-coded sizeof by ARRAY_SIZE
Jan Engelhardt [Thu, 30 Apr 2009 17:32:02 +0000 (19:32 +0200)] 
iptables: replace open-coded sizeof by ARRAY_SIZE

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agoextensions: add const qualifiers in print/save functions
Jan Engelhardt [Tue, 26 May 2009 11:14:06 +0000 (13:14 +0200)] 
extensions: add const qualifiers in print/save functions

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agoxtables: use extern "C"
Jan Engelhardt [Fri, 22 May 2009 09:46:55 +0000 (11:46 +0200)] 
xtables: use extern "C"

This fixes linking errors for 3rd-party C++ code.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agoAdd new COMMIT_NOTES document
Jan Engelhardt [Mon, 25 May 2009 14:57:52 +0000 (16:57 +0200)] 
Add new COMMIT_NOTES document

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agoxtables: fix segfault if incorrect protocol name is used
Pablo Neira Ayuso [Tue, 12 May 2009 07:51:26 +0000 (09:51 +0200)] 
xtables: fix segfault if incorrect protocol name is used

This patch fixes a segfault that can be triggered if you use an
incorrect protocol, e.g.

# iptables -I PREROUTING -t nat -p lalala --dport 21 -j DNAT --to 192.168.1.2:21
Segmentation fault

With this patch:

# iptables -I PREROUTING -t nat -p lalala --dport 21 -j DNAT --to 192.168.1.2:21
iptables v1.4.3.2: unknown protocol `lala' specified
Try `iptables -h' or 'iptables --help' for more information

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
16 years agoextensions: add `cluster' match support
Pablo Neira Ayuso [Wed, 6 May 2009 11:01:20 +0000 (13:01 +0200)] 
extensions: add `cluster' match support

This patch adds support for the cluster match to iptables.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
16 years agoSNAT/DNAT: add support for persistent multi-range NAT mappings
Patrick McHardy [Fri, 17 Apr 2009 16:11:09 +0000 (18:11 +0200)] 
SNAT/DNAT: add support for persistent multi-range NAT mappings

Add support for persistent mappings (2.6.29-rc2+) as replacement for the
removed SAME target.

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agobuild: bump version to 1.4.3.2 v1.4.3.2
Pablo Neira Ayuso [Mon, 6 Apr 2009 11:09:17 +0000 (13:09 +0200)] 
build: bump version to 1.4.3.2

This patch bumps iptables version to 1.4.3.2

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
16 years agolibxt_conntrack: properly output negation symbol
Jan Engelhardt [Sat, 4 Apr 2009 22:05:30 +0000 (00:05 +0200)] 
libxt_conntrack: properly output negation symbol

Because the wrong flag was checked, the "!" was either wrongly
printed, or not printed at all.
This was broken since v1.4.0-29-ga8ad34c.

Reported-by: Steven Jan Springl <steven@springl.ukfsn.org>
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agoCLASSIFY: document non-standard interpretation behavior
Jan Engelhardt [Sat, 4 Apr 2009 16:43:15 +0000 (18:43 +0200)] 
CLASSIFY: document non-standard interpretation behavior

Most other extensions use strtoul (by means of xtables_strtoui)
and would abide by the standard convention of hex/octal prefixes
0x/0, and decimal otherwise, but CLASSIFY is an exception.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agoMerge branch 'plus'
Jan Engelhardt [Sat, 4 Apr 2009 12:10:49 +0000 (14:10 +0200)] 
Merge branch 'plus'

16 years agoMerge commit 'v1.4.3'
Jan Engelhardt [Sat, 4 Apr 2009 12:03:50 +0000 (14:03 +0200)] 
Merge commit 'v1.4.3'

Connect history to the tag.

16 years agoiptables: print negation extrapositioned
Jan Engelhardt [Sat, 4 Apr 2009 11:28:40 +0000 (13:28 +0200)] 
iptables: print negation extrapositioned

This patch combines the two referenced ones by Peter. I did a quick
extra audit to spot and fix the missing ip6tables parts. (People like
to forget ip6tables it seems.) Extension modules were, to the best of
my knowledge, already audited in v1.4.3-rc1-10-gcea9f71.

Reported-by: Yar Odin <yarodin@gmail.com>
References: http://bugs.gentoo.org/264089
Reported-by: Peter Volkov <pva@gentoo.org>
References: http://marc.info/?l=netfilter-devel&m=123883867907935&w=2
References: http://marc.info/?l=netfilter-devel&m=123883992508943&w=2
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agolibxtables: provide IPv6 zero address variable
Jan Engelhardt [Fri, 3 Apr 2009 20:40:35 +0000 (22:40 +0200)] 
libxtables: provide IPv6 zero address variable

µClibc may not provide the in6addr_any variable when IPv6 is
disabled. So just provide it ourselves.

Reference: http://bugzilla.netfilter.org/show_bug.cgi?id=569
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agobuild: add configure option to disable ipv4 iptables
Jan Engelhardt [Fri, 3 Apr 2009 20:37:49 +0000 (22:37 +0200)] 
build: add configure option to disable ipv4 iptables

This patch complements the previous one.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agobuild: add configure option to disable ip6tables
Jan Engelhardt [Fri, 3 Apr 2009 20:28:34 +0000 (22:28 +0200)] 
build: add configure option to disable ip6tables

This also skips building the IPv6 extensions. It does not #ifdef out
all code however, I think that would make it too ugly.

Inspired-by: http://bugzilla.netfilter.org/show_bug.cgi?id=560
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agobuild: do not run ldconfig for DESTDIR installations
Jan Engelhardt [Sun, 29 Mar 2009 23:28:44 +0000 (01:28 +0200)] 
build: do not run ldconfig for DESTDIR installations

Reference: http://bugzilla.netfilter.org/show_bug.cgi?id=560
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agolibxtables: reorder .version member
Jan Engelhardt [Sun, 29 Mar 2009 22:44:46 +0000 (00:44 +0200)] 
libxtables: reorder .version member

When the structure's layout changes, as it did between v1.4.1 and
v1.4.2, trying to compare the version string makes iptables segfault
while it tries to determine whether the module is compatible in the
first place.

By moving the member to a known offset in the struct and keeping it
there, objects (both iptables and 3rd party) compiled from this
commit onwards will avoid the segfault.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agoiptables-multi: support "iptables-static" as a callable name
Jan Engelhardt [Tue, 24 Mar 2009 21:35:10 +0000 (22:35 +0100)] 
iptables-multi: support "iptables-static" as a callable name

iptables multi-purpose version: unknown applet name iptables-static

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agolibxt_tcpmss: fix an inversion while parsing --mss
Jan Engelhardt [Tue, 24 Mar 2009 21:26:25 +0000 (22:26 +0100)] 
libxt_tcpmss: fix an inversion while parsing --mss

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agoiptables: refer to dmesg if we hit EINVAL v1.4.3.1
Pablo Neira Ayuso [Tue, 24 Mar 2009 12:08:24 +0000 (13:08 +0100)] 
iptables: refer to dmesg if we hit EINVAL

With this patch, iptables refers to dmesg for further
troubleshooting if we hit EINVAL.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
16 years agobuild: bump version to 1.4.3.1
Pablo Neira Ayuso [Tue, 24 Mar 2009 11:54:31 +0000 (12:54 +0100)] 
build: bump version to 1.4.3.1

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
16 years agobuild: fix linker issue when LDFLAGS contains --as-needed
Peter Volkov [Tue, 24 Mar 2009 08:09:16 +0000 (11:09 +0300)] 
build: fix linker issue when LDFLAGS contains --as-needed

The link of iptables-save fails on:

$ make LDFLAGS="-Wl,--as-needed"
[...]
extensions/libext4.a(libxt_RATEEST.o): In function `RATEEST_final_check':
extensions/libxt_RATEEST.c:164: undefined reference to `log'

Helpful Reference: http://www.gentoo.org/proj/en/qa/asneeded.xml
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agolibxt_hashlimit: add missing space for iptables-save output
Jan Engelhardt [Tue, 24 Mar 2009 11:13:53 +0000 (12:13 +0100)] 
libxt_hashlimit: add missing space for iptables-save output

Reference: http://bugzilla.netfilter.org/show_bug.cgi?id=568
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agolibxtables: fix compile error due to incomplete change
Peter Volkov [Tue, 24 Mar 2009 08:09:16 +0000 (11:09 +0300)] 
libxtables: fix compile error due to incomplete change

Commit 2338efd8f799d8373dc196c797bda9690283b698 forgot to update
the constant in one place, and the compile error triggered only
when -DNO_SHARED_LIBS (configure --disable-shared) was in effect.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agoiptables-save: minor corrections to the manpage markup
Jan Engelhardt [Thu, 19 Mar 2009 16:14:49 +0000 (17:14 +0100)] 
iptables-save: minor corrections to the manpage markup

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agoBump version to 1.4.3 v1.4.3
Patrick McHardy [Mon, 23 Mar 2009 13:39:16 +0000 (14:39 +0100)] 
Bump version to 1.4.3

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agolibiptc: give credits to my self
Jesper Dangaard Brouer [Mon, 23 Mar 2009 13:27:44 +0000 (14:27 +0100)] 
libiptc: give credits to my self

Add notes about my scalability work on the library libiptc.
This should make in more obvious who to complain to.

Signed-off-by: Jesper Dangaard Brouer <hawk@comx.dk>
Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agolibiptc: fix whitespaces and typos
Jesper Dangaard Brouer [Mon, 23 Mar 2009 13:26:56 +0000 (14:26 +0100)] 
libiptc: fix whitespaces and typos

Cleanup whitespaces while going through the code.

Signed-off-by: Jesper Dangaard Brouer <hawk@comx.dk>
Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agolibiptc: fix chain rename bug in libiptc
Jesper Dangaard Brouer [Mon, 23 Mar 2009 13:25:49 +0000 (14:25 +0100)] 
libiptc: fix chain rename bug in libiptc

Chain renaming (TC_RENAME_CHAIN) can result in an unsorted
chain list.  That breaks the requirement of the binary search
done in iptcc_bsearch_chain_index().

Signed-off-by: Jesper Dangaard Brouer <hawk@comx.dk>
Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agolibiptc: avoid compile warnings for iptc_insert_chain
Christoph Paasch [Mon, 23 Mar 2009 12:50:11 +0000 (13:50 +0100)] 
libiptc: avoid compile warnings for iptc_insert_chain

iptc_insert_chain is too big to get inlined and so it generates
a warning while compiling.

Signed-off-by: Christoph Paasch <christoph.paasch@gmail.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agoiptables-save: module loading corrections
Jan Engelhardt [Thu, 19 Mar 2009 15:57:35 +0000 (16:57 +0100)] 
iptables-save: module loading corrections

1. Ignore the absence of /proc/net/ip_tables_names, which happens
when x_tables.ko is not loaded. This is equivalent to having
x_tables.ko, but no tabe modules, loaded. As such, success should
be returned.

2. Load table when explicitly requested by the -t option. Users might
expect "*foo" etc. to be output when `iptables-save -t foo` is
executed. So do autoload x_tables.ko and the table in this case.

*. Do this for both iptables-save and ip6tables-save, and adjust
the manpages for the new -M (modprobe program location) option that
is introduced.

Based upon a patch by Soren Hansen.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agolibxt_comment: output quotes must be escaped in
Jan Engelhardt [Thu, 19 Mar 2009 10:57:10 +0000 (11:57 +0100)] 
libxt_comment: output quotes must be escaped in

Reference: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=519584
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agolibxtables: add -I/-L flags to pkgconfig files
Jan Engelhardt [Thu, 19 Mar 2009 09:38:41 +0000 (10:38 +0100)] 
libxtables: add -I/-L flags to pkgconfig files

These are needed in case iptables gets installed into a non-standard
path. It also enables automatic detection of these locations from 3rd
party programs via pkgconfig.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agolibxt_connbytes: document nf_ct_acct behavior
Jan Engelhardt [Tue, 17 Mar 2009 15:37:47 +0000 (16:37 +0100)] 
libxt_connbytes: document nf_ct_acct behavior

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agolibxt_connbytes: minor manpage adustments
Jan Engelhardt [Tue, 17 Mar 2009 15:32:49 +0000 (16:32 +0100)] 
libxt_connbytes: minor manpage adustments

Use explicit paragraph separator and conntrack(8).

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agoMerge commit 'nf/master'
Jan Engelhardt [Sun, 15 Mar 2009 20:26:53 +0000 (21:26 +0100)] 
Merge commit 'nf/master'

16 years agoiptables: turn deprecation warning into enforcing mode
Jan Engelhardt [Sun, 15 Mar 2009 20:22:49 +0000 (21:22 +0100)] 
iptables: turn deprecation warning into enforcing mode

The deprecation warning was added 7 months ago in v1.4.2-rc1-13-g1eada72
with a warning "next release". Next release is coming up, so enforce it.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agoiptables: fix broken options-merging during libxtables rework
Pablo Neira Ayuso [Tue, 3 Mar 2009 16:46:17 +0000 (17:46 +0100)] 
iptables: fix broken options-merging during libxtables rework

This patch fixes options-merging that was broken somewhere
during the libxtables rework. Before this patch, two pointers
were used to keep the current options, however, the options field
in xt_params was not appropritely updated. Thus, xtables_free_opts()
was not restoring the original options.

This patch fixes iptables-restore and ip6tables-restore that
stopped working in my personal firewall.

% iptables-restore
*filter
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables-restore v1.4.3-rc1: Unknown arg `ESTABLISHED,RELATED'
Error occurred at line: 4
Try `iptables-restore -h' or 'iptables-restore --help' for more information.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
16 years agostring: fix wrong pattern length calculation
Pablo Neira Ayuso [Mon, 2 Mar 2009 10:46:55 +0000 (11:46 +0100)] 
string: fix wrong pattern length calculation

This fixes a problem introduced in 37b4bde745698bf140d74e59a2561f34deeb8726
that leads to the wrong calculation of the pattern length in the
string match.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
16 years agoiptables: Add limits.h to get INT_MIN, INT_MAX, ...
Stephen Hemminger [Wed, 25 Feb 2009 07:25:17 +0000 (08:25 +0100)] 
iptables: Add limits.h to get INT_MIN, INT_MAX, ...

Fix build failure of iptables utilities on debian/ubuntu, maybe other distros.
The values INT_MIN and INT_MAX are used by many filters and these
are defined in limits.h
---
  patch against current iptables.git

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agoextensions: add missing limits.h include
Jan Engelhardt [Sat, 21 Feb 2009 02:46:37 +0000 (03:46 +0100)] 
extensions: add missing limits.h include

Thanks to Stephen Hemminger for noticing.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agoinclude: resynchronize headers with 2.6.29-rc5
Jan Engelhardt [Sat, 21 Feb 2009 03:42:32 +0000 (04:42 +0100)] 
include: resynchronize headers with 2.6.29-rc5

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agolibxt_policy: use bounded strtoui
Jan Engelhardt [Sat, 21 Feb 2009 03:00:21 +0000 (04:00 +0100)] 
libxt_policy: use bounded strtoui

reqid and SPI can only have a value in the range 0..UINT32_MAX, not
the entire range of the "long" type. Also throw an error if the
incoming string does not look like a pure number.

"Replaces" commit 6db2ded2f22a7e78743c86af523b8430876582e9.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agoextensions: remove unwanted/add needed includes for IPv4 exts
Jan Engelhardt [Sat, 21 Feb 2009 02:44:36 +0000 (03:44 +0100)] 
extensions: remove unwanted/add needed includes for IPv4 exts

Most touched files do not use anything from ip_tables.h, so
remove that #include. multiport instead, does need it (ipt_entry).

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agoextensions: remove unwanted/add needed includes for IPv6 exts
Jan Engelhardt [Sat, 21 Feb 2009 02:40:27 +0000 (03:40 +0100)] 
extensions: remove unwanted/add needed includes for IPv6 exts

Most touched files do not use anything from ip6_tables.h, so
remove that #include. multiport instead, does need it (ip6t_entry).

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agolibxtables: prefix exit_error to xtables_error
Jan Engelhardt [Sat, 21 Feb 2009 02:29:44 +0000 (03:29 +0100)] 
libxtables: prefix exit_error to xtables_error

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agolibxtables: inline and remove unused OPTION_OFFSET macro
Jan Engelhardt [Sat, 21 Feb 2009 01:48:11 +0000 (02:48 +0100)] 
libxtables: inline and remove unused OPTION_OFFSET macro

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agodoc: resynchronize manpage with in-code help
Jan Engelhardt [Fri, 20 Feb 2009 15:39:54 +0000 (16:39 +0100)] 
doc: resynchronize manpage with in-code help

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agolibxt_policy: cannot set spi/reqid numbers higher than 0x7fffffff
Christian Perle [Tue, 17 Feb 2009 16:31:52 +0000 (17:31 +0100)] 
libxt_policy: cannot set spi/reqid numbers higher than 0x7fffffff

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

When using the -m policy match, the option argument for --spi is converted
using strtol(), which returns a signed 32 bit value, so the highest
positive value is 0x7fffffff. Instead strtoul() should be used.
The same applies for the --reqid option argument.

Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agodoc: do not put IPv4 doc into ip6tables.8
Jan Engelhardt [Tue, 17 Feb 2009 14:05:29 +0000 (15:05 +0100)] 
doc: do not put IPv4 doc into ip6tables.8

Reference: http://bugs.debian.org/515752
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agobuild: trigger reconfigure when extensions/GNUmakefile.in changes
Jan Engelhardt [Tue, 17 Feb 2009 14:04:57 +0000 (15:04 +0100)] 
build: trigger reconfigure when extensions/GNUmakefile.in changes

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agolibiptc: make library available as a shared library
Jan Engelhardt [Wed, 11 Feb 2009 15:40:29 +0000 (16:40 +0100)] 
libiptc: make library available as a shared library

Tested-by: Jesper Dangaard Brouer <hawk@comx.dk>
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agolibxtables: general follow-up cleanup
Jamal Hadi Salim [Fri, 13 Feb 2009 15:42:24 +0000 (10:42 -0500)] 
libxtables: general follow-up cleanup

Kill program_name, program_version and xtables_program_name.

Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>
16 years agolibxtables: consolidate init calls into one function
Jamal Hadi Salim [Fri, 13 Feb 2009 14:14:17 +0000 (09:14 -0500)] 
libxtables: consolidate init calls into one function

Introduce xtables_init_all() which hides three calls xtables_init(),
xtables_set_nfproto(), and xtables_set_params(). Make
ip[6]tables-restore, ip[6]tables-save and ip[6]tables-standalone use
it.

I moved xtables_set_params around for readability reasons.

Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>
16 years agolibxtables: consolidate merge_options into xtables_merge_options
Jamal Hadi Salim [Fri, 13 Feb 2009 13:36:44 +0000 (08:36 -0500)] 
libxtables: consolidate merge_options into xtables_merge_options

Introduce xtables_merge_options() for re-use reasons. Apps can use it
instead of each defining their own merge_options(). Made iptables and
ip6tables use the new shared interface.

Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>
16 years agobuild: remove unneeded -ldl from iptables_xml_LDADD
Jan Engelhardt [Thu, 12 Feb 2009 18:27:49 +0000 (19:27 +0100)] 
build: remove unneeded -ldl from iptables_xml_LDADD

Addendum to commit 5c3e0767764bb7fa1db61ac326e8359161380e21.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agolibxtables: make iptables and ip6tables use xtables_free_opts
Jamal Hadi Salim [Thu, 12 Feb 2009 16:43:01 +0000 (11:43 -0500)] 
libxtables: make iptables and ip6tables use xtables_free_opts

The patch modifies xtables_globals to introduce orig_opts and
xtables_free_opts() to emulate what free_opts used to do. We also get
rid of the copies of free_opts() that iptables and ip6tables keep.

Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>
16 years agolibxtables: add xtables_set_revision
Jamal Hadi Salim [Thu, 12 Feb 2009 14:33:59 +0000 (09:33 -0500)] 
libxtables: add xtables_set_revision

Introduce xtables_set_revision() and make iptables and ip6tables use it.

Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>
16 years agolibxtables: set names of programs
Jamal Hadi Salim [Wed, 11 Feb 2009 21:28:31 +0000 (16:28 -0500)] 
libxtables: set names of programs

Set proper name of application.

Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>
16 years agolibipq: fix compile error
Jan Engelhardt [Thu, 12 Feb 2009 14:07:15 +0000 (15:07 +0100)] 
libipq: fix compile error

libipq.c: In function `ipq_create_handle':
libipq.c:220: error: `NFPROTO_IPV4' undeclared (first use in this function)
libipq.c:220: error: (Each undeclared identifier is reported only once
libipq.c:220: error: for each function it appears in.)
libipq.c:222: error: `NFPROTO_IPV6' undeclared (first use in this function)

Add the required includes.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agobuild: restructure Makefile for include/ directory
Jan Engelhardt [Thu, 12 Feb 2009 14:01:37 +0000 (15:01 +0100)] 
build: restructure Makefile for include/ directory

This patch will support adding libiptc to the headers list in future.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agodoc: fix one layout issue in iptables-restore.8
Shaul Karl [Mon, 19 Jan 2009 10:09:36 +0000 (02:09 -0800)] 
doc: fix one layout issue in iptables-restore.8

Reference: http://bugs.debian.org/512281
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agodoc: fix option typo in libxt_multiport
Marc Fournier [Thu, 15 Jan 2009 12:57:53 +0000 (13:57 +0100)] 
doc: fix option typo in libxt_multiport

Reference: http://bugs.debian.org/511891
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agolibipq: add missing doc for NF_ values
Jan Engelhardt [Thu, 12 Feb 2009 13:48:59 +0000 (14:48 +0100)] 
libipq: add missing doc for NF_ values

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agolibxtables: flush before fork
Jan Engelhardt [Thu, 12 Feb 2009 00:28:35 +0000 (01:28 +0100)] 
libxtables: flush before fork

Reference: http://bugs.debian.org/514869
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agolibxt_string: fix undefined behavior/incorrect patlen calculation
Jan Engelhardt [Thu, 12 Feb 2009 00:18:35 +0000 (01:18 +0100)] 
libxt_string: fix undefined behavior/incorrect patlen calculation

strlen ran over the end of the string. Use strnlen to bound it.

Reference: http://bugs.debian.org/513516
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agolibxtables: use const for vars holding literals
Jan Engelhardt [Wed, 11 Feb 2009 15:13:47 +0000 (16:13 +0100)] 
libxtables: use const for vars holding literals

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agoMerge branch 'master' of git://dev.medozas.de/iptables
Patrick McHardy [Thu, 12 Feb 2009 06:09:55 +0000 (07:09 +0100)] 
Merge branch 'master' of git://dev.medozas.de/iptables

16 years agolibxtables: simple aliasing macro for exit_error
Jamal Hadi Salim [Wed, 11 Feb 2009 12:05:43 +0000 (13:05 +0100)] 
libxtables: simple aliasing macro for exit_error

Rename xtables_globals exit_error cb to exit_err and introduce
a very simple aliasing macro to point to it.
convert iptables, ip6tables and iptables_xml to use it.
Note iptables_xml does not have to define its own exit_error()
since it can use the basic one provided.

Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>
Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agolibxtables: Replace direct exit_error() calls inside libxtables
Jamal Hadi Salim [Wed, 11 Feb 2009 12:04:26 +0000 (13:04 +0100)] 
libxtables: Replace direct exit_error() calls inside libxtables

Replace direct exit_error() calls inside libxtables with
xt_params->exit_error().

With this change; i can now compile the useless app:
-----
 #include <xtables.h>
 int main(int argc, char **argv) {

        return 0;
 }
----

with "gcc useless.c -lxtables -ldl"

Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>
Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agolibxtables: Make ip6tables, iptables and iptables-xml use xtables_globals
Jamal Hadi Salim [Wed, 11 Feb 2009 12:03:34 +0000 (13:03 +0100)] 
libxtables: Make ip6tables, iptables and iptables-xml use xtables_globals

convert ip6tables, iptables and iptables-xml to use
xtables_globals/xtables_set_params()

Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>
Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agolibxtables: Add exit_error cb to xtables_globals
Jamal Hadi Salim [Wed, 11 Feb 2009 12:02:21 +0000 (13:02 +0100)] 
libxtables: Add exit_error cb to xtables_globals

Introduce exit_error() as part of xtables_globals structure.
When an application registers its xtables_globals definition
and does not specify its exit_error() it gets assigned a
basic version

Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>
Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agolibxtables: define xtables_free_opts()
Jamal Hadi Salim [Wed, 11 Feb 2009 12:00:02 +0000 (13:00 +0100)] 
libxtables: define xtables_free_opts()

Introduce xtables_free_opts() an xtables variant of
free_opts() which uses xtables_globals already set
by xtables_set_params(). The end goal is to have all internal
references in xtables.c use xtables_free_opts() instead of
depending on external defined free_opts()

Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>
Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agolibxtables: Introduce global params structuring
Jamal Hadi Salim [Wed, 11 Feb 2009 11:58:54 +0000 (12:58 +0100)] 
libxtables: Introduce global params structuring

introduce a new struct,xtables_globals, so as to
localize the globals used and help in symbol renames.
The applications must invoke xtables_set_params() before starting
to use any iptables APIs.
xtables_set_params() is intended to free xtables from depending
(as it does right now) on existence of such externally definitions
(from iptables/iptables6 etc). At the moment, xtables wont even
compile without presence of at least one of {iptables/iptables6 etc}

Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>
Signed-off-by: Patrick McHardy <kaber@trash.net>
16 years agosrc: consolidate duplicate code in iptables/internal.h
Jan Engelhardt [Tue, 10 Feb 2009 09:51:25 +0000 (10:51 +0100)] 
src: consolidate duplicate code in iptables/internal.h

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agolibxtables: move compat defines to xtables.c
Jan Engelhardt [Tue, 10 Feb 2009 09:48:28 +0000 (10:48 +0100)] 
libxtables: move compat defines to xtables.c

Addendum to commit v1.4.3-rc1-41-g77f48c2 where the macro users
got moved.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agosrc: remove unused ipt_tryload macro
Jan Engelhardt [Tue, 10 Feb 2009 09:43:42 +0000 (10:43 +0100)] 
src: remove unused ipt_tryload macro

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agosrc: remove iptables_rule_match indirection macro
Jan Engelhardt [Tue, 10 Feb 2009 09:43:08 +0000 (10:43 +0100)] 
src: remove iptables_rule_match indirection macro

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agolibxtables: decouple non-xtables parts from header
Jan Engelhardt [Tue, 10 Feb 2009 09:40:15 +0000 (10:40 +0100)] 
libxtables: decouple non-xtables parts from header

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agolibxtables: remove unused XT_LIB_DIR macro
Jan Engelhardt [Tue, 10 Feb 2009 09:25:08 +0000 (10:25 +0100)] 
libxtables: remove unused XT_LIB_DIR macro

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
16 years agobuild: move -ldl to proper LDADD
Jan Engelhardt [Tue, 10 Feb 2009 09:20:19 +0000 (10:20 +0100)] 
build: move -ldl to proper LDADD

libxtables uses dlopen, so *it* has to use -ldl, not the main program.

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