]>
git.ipfire.org Git - thirdparty/iptables.git/log
Tomasz Bursztyka [Wed, 7 Aug 2013 08:31:36 +0000 (11:31 +0300)]
nft: Generalize nft_rule_list() against current family
Now, firewall rule printing is done through nft_family_ops
.print_firewall function. This moves generic part for ipv4 and ipv6 into
nft-shared.c, and enables reusing nft_rule_list() for other family such
as ARP which will be useful for arptables compatibility tool.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Tomasz Bursztyka [Wed, 7 Aug 2013 08:31:35 +0000 (11:31 +0300)]
nft: Remove useless test on rulenum in nft_rule_list()
Rulenum is already handled before the loop, making this test useless.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Tomasz Bursztyka [Thu, 1 Aug 2013 17:44:35 +0000 (20:44 +0300)]
nft: Make internal rule listing callback more generic
This will be useful for reusing nft_rule_list in other tools such as
xtables-arptables.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Tomasz Bursztyka [Thu, 1 Aug 2013 17:44:34 +0000 (20:44 +0300)]
nft: Optimize rule listing when chain and rulenum are provided
Thus, we can save some cycles by not dumping the entire chain list
and looping on it.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Tomasz Bursztyka [Thu, 25 Jul 2013 17:16:21 +0000 (20:16 +0300)]
nft: Remove useless function
Likely to be a leftover from the initial bootstrap.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Tomasz Bursztyka [Wed, 31 Jul 2013 12:18:52 +0000 (15:18 +0300)]
xtables: Do not dump before command parsing has been finished
On xtables-save.c, -d will not output right away but after the full
command line hase been parsed.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Giuseppe Longo [Tue, 30 Jul 2013 11:03:46 +0000 (14:03 +0300)]
nft: load only the tables of the current family
This changes nft_xtables_config_load() permit to load only
the tables of the current family.
[ This patch includes a fix for the configuration parser
that I detected while testing this patch --pablo ]
Signed-off-by: Giuseppe Longo <giuseppelng@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Tue, 30 Jul 2013 18:17:44 +0000 (20:17 +0200)]
etc: add default IPv6 table and chain definitions
Add definition of table and chains to the optional xtables.conf file.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Giuseppe Longo [Fri, 26 Jul 2013 11:05:19 +0000 (13:05 +0200)]
nft: fix family operation lookup
xtables-restore -6 was using the IPv4 family, instead of IPv6
as it should be.
Signed-off-by: Giuseppe Longo <giuseppelng@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Tue, 30 Jul 2013 09:39:59 +0000 (11:39 +0200)]
nft: fix match revision lookup for IPv6
IPT_SO_GET_REVISION_MATCH != IP6T_SO_GET_REVISION_MATCH, thus,
the revision infrastructure was looking for targets instead
matches.
Pablo Neira Ayuso [Tue, 30 Jul 2013 09:28:45 +0000 (11:28 +0200)]
xtables: fix typo in add_entry for the IPv6 case
It should pass zero, instead of the 'append' boolean.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Giuseppe Longo [Fri, 26 Jul 2013 11:05:15 +0000 (13:05 +0200)]
nft: associate table configuration to handle via nft_init
We need family dependent built-in table/chain configuration. This
patch is a step forward making nft family independent in
order to support arptables and ebtables compatibility layers.
Signed-off-by: Giuseppe Longo <giuseppelng@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Wed, 24 Jul 2013 18:11:52 +0000 (20:11 +0200)]
nft: no need for rule lookup if no position specified via -I
Improve (
dc3d8a6 xtables: add -I chain rulenum) to avoid a look
up for the rule if no rule number is specified via -I.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Fri, 19 Jul 2013 16:47:20 +0000 (18:47 +0200)]
xtables: remove bogus comment regarding rule replacement
We support rule replacement since quite some time, remove it.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Fri, 19 Jul 2013 16:42:30 +0000 (18:42 +0200)]
xtables: add -I chain rulenum
This patch adds the nft_rule_insert function, which allows
us to insert rules at a given position.
The function nft_rule_add has been renamed to nft_rule_append.
This is possible thanks to Eric Leblond's (netfilter: nf_tables:
add insert operation) kernel patch.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Wed, 17 Jul 2013 13:04:19 +0000 (15:04 +0200)]
nft: fix selective chain display via -S
Before:
% xtables -S INPUT
-P INPUT ACCEPT
-P FORWARD ACCEPT
-P OUTPUT ACCEPT
-A INPUT -p tcp -j ACCEPT
After:
$ xtables -S INPUT
-P INPUT ACCEPT
-A INPUT -p tcp -j ACCEPT
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Wed, 17 Jul 2013 12:55:01 +0000 (14:55 +0200)]
nft: break chain listing if only one if looked for
Break looping on the chain list if it finds the chain
that the user requested.
Based on patch from Tomasz Bursztyka.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Tue, 16 Jul 2013 20:43:06 +0000 (22:43 +0200)]
src: use nft_*_list_add_tail
Adapt it to the semantic fix that has been applied to libnftable
nft_*_list_add now inserts nodes, instead of appending them.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Tue, 16 Jul 2013 20:18:47 +0000 (22:18 +0200)]
nft: fix built-in chain ordering of the nat table
Should be:
% iptables -L -n -t nat
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
instead of:
% xtables -L -n -t nat
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
Reported-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Pablo Neira Ayuso <pablo@soleta.eu>
Pablo Neira Ayuso [Tue, 16 Jul 2013 20:01:04 +0000 (22:01 +0200)]
xtables-events: fix missing newline in table and chain events
Add missing newline while printing table and chain events.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Tue, 16 Jul 2013 19:55:15 +0000 (21:55 +0200)]
xtables-events: print usage on wrong arguments
Set opterr to zero to skip getopt_long error reporting.
This also fixes the following compilation warning:
xtables-events.c:148:13: warning: ‘print_usage’ defined but not used [-Wunused-function]
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Tomasz Bursztyka [Tue, 16 Jul 2013 12:38:53 +0000 (15:38 +0300)]
nft: Fix small memory leaks
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Tomasz Bursztyka [Tue, 16 Jul 2013 20:07:58 +0000 (22:07 +0200)]
nft: add function to test for a builtin chain
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Tomasz Bursztyka [Tue, 16 Jul 2013 20:07:22 +0000 (22:07 +0200)]
xtables: Remove useless parameter to nft_chain_list_find
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Tomasz Bursztyka [Tue, 16 Jul 2013 12:38:46 +0000 (15:38 +0300)]
nft: Handle error on adding rule expressions
If adding one of match/target/jumpto/verdit/counters fails, adding a rule will
return an error.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Pablo Neira Ayuso <pablo@soleta.eu>
Tomasz Bursztyka [Tue, 16 Jul 2013 12:38:45 +0000 (15:38 +0300)]
nft: Set the rule family when creating a new one
Fixes the debug output from (in case of ipv4 rule):
DEBUG: rule: arp filter INPUT 0
to:
DEBUG: rule: ip filter INPUT 0
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Pablo Neira Ayuso <pablo@soleta.eu>
Pablo Neira Ayuso [Mon, 15 Jul 2013 09:48:48 +0000 (11:48 +0200)]
xtables: nft: display rule number via -S
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Giuseppe Longo [Fri, 12 Jul 2013 11:27:33 +0000 (13:27 +0200)]
xtables: nft: display rule by number via -L
This patch fixes the display of rule by number.
[ Mangled this patch not to display the header, to mimic iptables
--pablo ]
Signed-off-by: Giuseppe Longo <giuseppelng@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Sun, 30 Jun 2013 10:34:36 +0000 (12:34 +0200)]
xtables: fix missing afinfo configuration
I noticed that the iprange match in IPv6 was broken, fix it
by overriding the default family (IPv4) if -6 is passed.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Tue, 25 Jun 2013 09:56:55 +0000 (11:56 +0200)]
xtables: do not proceed if nft_init fails
Fix a crash if nft_init fails, it happens if nfnetlink support
is not available in your Linux kernel.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Giuseppe Longo [Tue, 25 Jun 2013 07:46:17 +0000 (09:46 +0200)]
nft: fix another memleak in nft_rule_list_cb
Signed-off-by: Giuseppe Longo <giuseppelng@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Giuseppe Longo [Tue, 25 Jun 2013 07:46:06 +0000 (09:46 +0200)]
nft: print counter issues
The patch fixes the counter print, missing line,
and delete warnings.
Signed-off-by: Giuseppe Longo <giuseppelng@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Giuseppe Longo [Wed, 19 Jun 2013 11:14:23 +0000 (13:14 +0200)]
nft: break loop after found matching chain
This patch breaks looping in nft_chain_user_del, nft_chain_zero_counters
and nft_rule_flush after the chain is found.
Signed-off-by: Giuseppe Longo <giuseppelng@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Tue, 18 Jun 2013 00:50:48 +0000 (02:50 +0200)]
xtables: nft: remove lots of useless debugging messages
While at it, fix several memleaks of list objects.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Tue, 18 Jun 2013 00:41:34 +0000 (02:41 +0200)]
xtables: remove bogus comment on chain rename
No longer true since Patrick added the chain rename approach back in
September 2012.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Giuseppe Longo [Tue, 18 Jun 2013 00:29:11 +0000 (02:29 +0200)]
xtables: allow to zero chains via -Z
Signed-off-by: Giuseppe Longo <giuseppelng@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Wed, 12 Jun 2013 09:49:52 +0000 (11:49 +0200)]
nft: fix leaks in nft_xtables_config_load
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Giuseppe Longo [Sat, 8 Jun 2013 03:40:04 +0000 (03:40 +0000)]
nft: fix leak of chain iterator in nft_rule_list
Signed-off-by: Giuseppe Longo <giuseppelng@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Giuseppe Longo [Sat, 8 Jun 2013 02:24:35 +0000 (02:24 +0000)]
nft: fix leak of rule and chain iterators
This patch fixes the leak of chain and rule iterators.
Signed-off-by: Giuseppe Longo <giuseppelng@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Sat, 1 Jun 2013 19:14:47 +0000 (21:14 +0200)]
xtables: fix -p protocol
The protocol field in both IPv4 and IPv6 headers are 8 bits long,
so we have to compare 8 bits.
Reported-by: Giuseppe Longo <giuseppelng@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Fri, 31 May 2013 14:21:04 +0000 (16:21 +0200)]
xtables-restore: output the same error message that iptables-restore uses
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Fri, 31 May 2013 12:54:33 +0000 (14:54 +0200)]
nft: don't call nft_init in nft_xtables_config_load
Otherwise we keep initializing the handle over and over again.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Tue, 21 May 2013 22:39:36 +0000 (00:39 +0200)]
xtables: fix compilation due to missing autogenerated header
Fix compilation:
nft.c:51:35: fatal error: xtables-config-parser.h: File or directory doesn't exist
xtables-config-parser.h was generated after compiling nft.c.
Reported-by: Giuseppe Longo <giuseppelng@gmail.com>
Tested-by: Giuseppe Longo <giuseppelng@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Tomasz Bursztyka [Tue, 14 May 2013 00:52:04 +0000 (00:52 +0000)]
xtables: policy can be changed only on builtin chain
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Tomasz Bursztyka [Tue, 14 May 2013 00:52:02 +0000 (00:52 +0000)]
xtables: initialize xtables defaults even on listing rules
Output of the tool should be the same as for iptables.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Sun, 12 May 2013 14:50:31 +0000 (16:50 +0200)]
xtables: remove unused leftover definitions
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Sun, 12 May 2013 14:47:11 +0000 (16:47 +0200)]
xtables: add new nft_ops->post_parse hook
Move specific layer 3 protocol post argument parsing code
to the respective nft-ipv[4|6].c files.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Sun, 12 May 2013 13:33:54 +0000 (15:33 +0200)]
xtables: add new container xtables_args structure
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Mon, 22 Apr 2013 11:48:00 +0000 (13:48 +0200)]
iptables: update .gitignore
Ignore xtables-config-* generated by flex and bison.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Mon, 22 Apr 2013 11:43:07 +0000 (13:43 +0200)]
xtables-config-parser: fix compilation warning
xtables-config-parser.y: In function ‘xtables_config_parse’:
xtables-config-parser.y:216:4: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Sun, 24 Mar 2013 12:15:23 +0000 (13:15 +0100)]
xtables: fix missing protocol and invflags
xtables -I INPUT -p tcp --dport 22 -j ACCEPT
iptables: Target problem. Run `dmesg' for more information
x_tables: ip_tables: tcp match: only valid for protocol
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Nicolas Dichtel [Wed, 6 Mar 2013 05:00:31 +0000 (05:00 +0000)]
iptables: fix compilation when lib[mnl|nftables] are not in standard path
There was several problems:
a typo in the configure option
a typo in CFLAGS addon for libmnl and libnftables
paths to lib were missing on link
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Sun, 10 Mar 2013 15:56:20 +0000 (16:56 +0100)]
xtables-config: fix off by one in parsed strings from /etc/xtables.conf
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Sun, 10 Mar 2013 15:20:27 +0000 (16:20 +0100)]
xtables: support family in /etc/xtables.conf file
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Sun, 10 Mar 2013 15:04:39 +0000 (16:04 +0100)]
nft: load tables and chains based on /etc/xtables.conf
If /etc/xtables.conf is available, use the configuration there to
autoload the xtables built-in table and chain so you can define custom
configurations. Otherwise, rely on default common table/chain
configuration.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Sun, 10 Mar 2013 10:43:32 +0000 (11:43 +0100)]
xtables-config: priority has to be per-chain to support
To support NAT table chain configuration appropriately. Modify example
configuration file as well.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Sat, 9 Mar 2013 00:04:29 +0000 (01:04 +0100)]
xtables-standalone: fix error message
xtables -m tcp -h
(nil) v1.4.15: ...
^^^^^
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Sat, 9 Mar 2013 00:01:11 +0000 (01:01 +0100)]
xtables: fix missing xtables_exit_error definition
iptables_exit_error is defined in iptables/iptables.c, that
symbol cannot be used by iptables/xtables.c
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Sat, 23 Feb 2013 18:36:46 +0000 (19:36 +0100)]
nft: remove license for header file
No tradition in the project to include the header file in .h file.
This one is also internal - not exported.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Sat, 23 Feb 2013 17:30:36 +0000 (18:30 +0100)]
xtables-save: add -4 and -6 support
Now you can specify:
xtables-save -6 > my-ip6tables-ruleset
to dump the IPv6 rule-set.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Sat, 23 Feb 2013 17:27:08 +0000 (18:27 +0100)]
xtables-restore: add -4 and -6 support
Now you can specify:
xtables-restore -6 < my-ip6tables-ruleset
to restore the IPv6 rule-set.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Tomasz Bursztyka [Sat, 23 Feb 2013 16:50:31 +0000 (17:50 +0100)]
nft: Split nft core to become family independant
This makes nft core code independant from the family. Each family needs
to implement and provide a struct nft_family_ops {}.
This split will ease the future support of bridge and arp rules manipulations.
[ updated header files and rebased upon the current tree --pablo ]
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Sat, 9 Feb 2013 17:22:13 +0000 (18:22 +0100)]
add xtables-events
Add new program to listen to rule updates:
shell$ xtables-events
-A INPUT -m state --state ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
-D INPUT -p tcp -m tcp --dport 22 -j ACCEPT
-D INPUT -m state --state ESTABLISHED -j ACCEPT
You can use `-c' option to display counters.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Sat, 9 Feb 2013 17:44:34 +0000 (18:44 +0100)]
xtables: ipv6: fix -D with -p
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Sat, 9 Feb 2013 17:35:48 +0000 (18:35 +0100)]
xtables: ipv6: add missing break in nft_parse_payload_ipv6
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Sat, 9 Feb 2013 17:27:04 +0000 (18:27 +0100)]
xtables: ipv6: fix wrong error if -p is used
shell$ xtables -6 -I INPUT -p tcp --dport 22 -j ACCEPT
xtables v1.4.15: -f is not valid on IPv6
Try `xtables -h' or 'xtables --help' for more information.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Sun, 27 Jan 2013 22:19:49 +0000 (23:19 +0100)]
nft: fix crash if TRACE is used
And any other match and target with no save function defined.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Sun, 20 Jan 2013 22:23:29 +0000 (23:23 +0100)]
xtables-restore: support test option `-t'
You can now test if a rule-set is correct.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Fri, 25 Jan 2013 15:04:36 +0000 (16:04 +0100)]
xtables: nft: add protocol and flags for xtables over nf_tables
Add protocol and flags for the compatibility layer.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Sun, 20 Jan 2013 19:19:20 +0000 (20:19 +0100)]
xtables-restore: support atomic commit
Use new services in nf_tables to support atomic commit.
Commit per table, although we support global commit at once,
call commit for each table to emulate iptables-restore
behaviour by now.
Keep table dormant/wake up code in iptables/nft.c as it can
be used in the future.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Sun, 20 Jan 2013 21:32:43 +0000 (22:32 +0100)]
xtables: purge out user-define chains from the kernel
xtables-restore has to purge out user-defined chains that are
not defined in the configuration file.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Sun, 20 Jan 2013 19:24:36 +0000 (20:24 +0100)]
xtables: fix compilation warning
xtables-standalone.c: In function ‘xtables_main’:
xtables-standalone.c:64:2: warning: implicit declaration of function ‘do_commandx’ [-Wimplicit-function-declaration]
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Sun, 20 Jan 2013 19:18:02 +0000 (20:18 +0100)]
xtables-restore: fix custom user chain restoration
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Tomasz Bursztyka [Sun, 13 Jan 2013 15:42:11 +0000 (16:42 +0100)]
xtables: add IPv6 support
Summary of changes to add IPv6 support to the xtables utility:
* modify all commands (add, delete, replace, check and listing) to
support IPv6 addresses.
And for the internal nft library:
* add family to struct nft_handle and modify all caller to use this
family instead of the hardcoded AF_INET.
* move code that we can re-use for IPv4 and IPv6 into helper functions.
* add IPv6 rule printing support.
* add support to parse IPv6 address.
Pablo added several improvements to this patch:
* added basic xtables-save and xtables-restore support (so it defaults
to IPv4)
* fixed a couple of bugs found while testing
* added reference when -f is used to point to -m frag (until we can make
this consistent with IPv4).
Note that we use one single xtables binary utility for IPv4 and IPv6.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Sun, 30 Dec 2012 00:45:44 +0000 (01:45 +0100)]
xtables: fix crash due to using wrong globals
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Sat, 29 Dec 2012 19:05:55 +0000 (20:05 +0100)]
nft: adapt chain rename to recent Patrick's updates
This patch gets existing code in sync with Patrick's chain
renaming new approach.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Mon, 19 Nov 2012 14:32:18 +0000 (15:32 +0100)]
xtables-restore: add support for dormant tables
This patch adds support for dormant tables for xtables-restore.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Sat, 3 Nov 2012 12:43:22 +0000 (13:43 +0100)]
iptables: nft: use chain types
We use the new special chain types defined in the kernel.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Sat, 3 Nov 2012 11:20:07 +0000 (12:20 +0100)]
iptables: nft: use 64-bits handle
Now that we use that in kernel space and in libnftables.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Sat, 3 Nov 2012 11:16:54 +0000 (12:16 +0100)]
iptables: nft: remove __nft_check_rule
Rework code to remove __nft_check_rule and split it into
logical fragments.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Sat, 3 Nov 2012 10:12:45 +0000 (11:12 +0100)]
iptables: nft: move priority to chain instead of table
NAT table uses different chain priorities, adapt the existing
code to allow this.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Sat, 3 Nov 2012 10:09:30 +0000 (11:09 +0100)]
headers: remove unused compatibility definitions
They belong to nf_tables_compat.h
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Thu, 1 Nov 2012 15:26:46 +0000 (16:26 +0100)]
nft: fix missing rule listing in custom chains with -L
Reported-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Tomasz Bursztyka [Tue, 30 Oct 2012 23:31:08 +0000 (23:31 +0000)]
iptables: nft: Add support for -R option
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Tomasz Bursztyka [Tue, 30 Oct 2012 23:31:07 +0000 (23:31 +0000)]
iptables: nft: Refactor __nft_rule_check to return rule handle when relevant
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Tomasz Bursztyka [Tue, 30 Oct 2012 23:31:06 +0000 (23:31 +0000)]
iptables: nft: Fix -D chain rulenum option
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Tomasz Bursztyka [Tue, 30 Oct 2012 23:31:05 +0000 (23:31 +0000)]
nft: Add support for chain rename options (-E)
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Tomasz Bursztyka [Tue, 30 Oct 2012 23:31:04 +0000 (23:31 +0000)]
headers: Make nf_tables.h up to date
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Pablo Neira Ayuso [Mon, 29 Oct 2012 21:52:50 +0000 (22:52 +0100)]
iptables: nft: add -f support
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Mon, 29 Oct 2012 10:39:46 +0000 (11:39 +0100)]
rework automatic creation of built-in table and chains
This patch reworks the automatic creation of built-in table and
chains. Now it initializes all built-in chains belonging a table
at once.
This happens with commands: -P, -A, -I, -N
Note that xtables skips chain initialization if it notices that
the table already exists in the kernel.
Thanks to Tomasz Bursztyka for spotting problems with -N.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Wed, 24 Oct 2012 11:40:12 +0000 (13:40 +0200)]
automatic creation of built-in table and chains
In order to emulate the iptables behaviour, this patch changes
the current behaviour to:
1st) check if the table and chains are built-in.
2nd) If they don't exists, create them. If they exists, don't touch
them.
The automatic creation happens in the -I and -P paths.
We should provide a new command to allow to delete (unregister)
built-in tables and chains. It would be similar to unloading
the iptable_X module that registers the custom table.
This is not done for other commands like -C or -D since they
will fail while trying to find the rule in the kernel if such
combination of chain and table does not exists.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Thu, 27 Sep 2012 17:12:53 +0000 (19:12 +0200)]
use nf_tables and nf_tables compatibility interface
This patch adds the following utilities:
* xtables
* xtables-restore
* xtables-save
* xtables-config
They all use Patrick's nf_tables infrastructure plus my compatibility
layer.
xtables, xtables-restore and xtables-save are syntax compatible with
ip[6]tables, ip[6]tables-restore and ip[6]tables-save.
Semantics aims to be similar, still the main exception is that there
is no commit operation. Thus, we incrementally add/delete rules without
entire table locking.
The following options are also not yet implemented:
-Z (this requires adding expr->ops->reset(...) so nft_counters can reset
internal state of expressions while dumping it)
-R and -E (this requires adding this feature to nf_tables)
-f (can be implemented with expressions: payload 6 (2-bytes) + bitwise a&b^!b + cmp neq 0)
-IPv6 support.
But those are a matter of time to get them done.
A new utility, xtables-config, is available to register tables and
chains. By default there is a configuration file that adds backward
compatible tables and chains under iptables/etc/xtables.conf. You have
to call this utility first to register tables and chains.
However, it would be possible to automagically register tables and
chains while using xtables and xtables-restore to get similar operation
than with iptables.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Gustavo Zacarias [Wed, 27 Nov 2013 13:21:12 +0000 (10:21 -0300)]
iptables-save: remove dlfcn.h include
It's not required and breaks on static-only uClibc builds which don't
have the header file.
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Signed-off-by: Florian Westphal <fw@strlen.de>
Florian Westphal [Sat, 23 Nov 2013 22:50:17 +0000 (23:50 +0100)]
Merge branch 'stable-1.4.20'
... to get
76e230e ('iptables: link against libnetfilter_conntrack'),
else static build doesn't work.
Conflicts:
extensions/GNUmakefile.in
[ CPPFLAGS was added in master, so keep it ]
Reported-By: Gustavo Zacarias <gustavo@zacarias.com.ar>
Pablo Neira Ayuso [Fri, 22 Nov 2013 11:17:58 +0000 (12:17 +0100)]
iptables 1.4.21 release
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Pablo Neira Ayuso [Mon, 18 Nov 2013 18:06:06 +0000 (19:06 +0100)]
utils: nfsynproxy: fix error while compiling the BPF filter
Fix the following error while running nfsynproxy here:
pcap_compile: not-yet-activated pcap_t passed to pcap_compile
According to what I have read, we have to compile the filter
once the pcap_t handle has been activated.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Jozsef Kadlecsik [Wed, 4 Sep 2013 15:43:49 +0000 (17:43 +0200)]
extensions: libxt_set, libxt_SET: check the set family too
Do not accept silently sets with wrong protocol family but reject
them with an error message. It makes straightforward to catch user
errors.
[ Use afinfo instead to avoid a binary interface update --pablo ]
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Patrick McHardy [Wed, 28 Aug 2013 07:32:44 +0000 (09:32 +0200)]
utils: add nfsynproxy tool
[ Originally synconf, but Jesper D. Brouer suggested to change
the name to avoid a possible filename clash. I also include
nfsynproxy in the final configure report --pablo ]
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Patrick McHardy [Wed, 28 Aug 2013 06:44:42 +0000 (08:44 +0200)]
extensions: add SYNPROXY extension
Signed-off-by: Patrick McHardy <kaber@trash.net>
Pablo Neira Ayuso [Mon, 4 Nov 2013 10:35:01 +0000 (11:35 +0100)]
extensions: libxt_cluster: add note on arptables-jf
Gao feng reported problems while getting the cluster match working with
arptables. This patch adds a note in the manpage to warn about the arptables-jf
syntax, which is different from mainstream arptables.
Reported-by: Gao feng <gaofeng@cn.fujitsu.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>