[PATCH xtables 1/2] ebtables-save: add -c option, using xtables-style counters

2018-11-12 Thread Florian Westphal
The 'original' ebtables-save was a perl script that supported no option. Add minimal options, like ip(6)tables save. Retain the old way of formatiing counters via environment variable, but allow overriding this using the -c option. Signed-off-by: Florian Westphal --- iptables/nft-bridge.c |

[PATCH iptables] nft: replace nft_chain_dump() by nft_chain_get_list()

2018-11-12 Thread Pablo Neira Ayuso
So we can remove nft_chain_dump() and replace nftnl_chain_get_list(). Signed-off-by: Pablo Neira Ayuso --- iptables/nft.c | 27 +++ iptables/nft.h | 2 +- iptables/xtables-restore.c | 2 +- iptables/xtables-save.c| 6 +++--- 4 files

Re: [PATCH] netfilter: ctnetlink: always honor CTA_MARK_MASK

2018-11-12 Thread Pablo Neira Ayuso
On Mon, Nov 12, 2018 at 10:19:56AM +0100, Pablo Neira Ayuso wrote: > On Thu, Nov 01, 2018 at 06:50:33AM +0100, Andreas Jaggi wrote: > > Useful to only set a particular range of the conntrack mark while > > leaving existing parts of the value alone, e.g. when updating > > conntrack marks via

Re: [PATCH] netfilter: ctnetlink: always honor CTA_MARK_MASK

2018-11-12 Thread Pablo Neira Ayuso
On Thu, Nov 01, 2018 at 06:50:33AM +0100, Andreas Jaggi wrote: > Useful to only set a particular range of the conntrack mark while > leaving existing parts of the value alone, e.g. when updating > conntrack marks via netlink from userspace. > > For NFQUEUE it was already implemented in commit >

Re: [PATCH 0/3] ipset patches for nf-next

2018-11-12 Thread Pablo Neira Ayuso
On Sat, Oct 27, 2018 at 06:07:39PM +0200, Jozsef Kadlecsik wrote: > Hi Pablo, > > Please consider to pull the next patches for nf-next: > > - Introduction of new commands and thus protocol version 7. The > new commands makes possible to eliminate the getsockopt interface > of ipset and use

Re: [PATCH libnftnl 4/4] src: Use memcpy() to handle potentially unaligned data

2018-11-11 Thread Matt Turner
On Thu, Nov 1, 2018 at 4:29 PM Pablo Neira Ayuso wrote: > > On Wed, Oct 31, 2018 at 07:18:04PM -0700, Matt Turner wrote: > > On Fri, Oct 19, 2018 at 11:09 AM Matt Turner wrote: > > > If you wouldn't mind, now might be a good time to make a 1.1.2 > > > release. In the four months since 1.1.1

Price enquiry

2018-11-11 Thread Daniel Murray
Hi,friend, This is Daniel Murray and i am from Sinara Group Co.Ltd Group Co.,LTD in Russia. We are glad to know about your company from the web and we are interested in your products. Could you kindly send us your Latest catalog and price list for our trial order. Best Regards, Daniel

[PATCH] netfilter: conntrack: fix cloned unconfirmed skb->_nfct race in __nf_conntrack_confirm

2018-11-09 Thread Chieh-Min Wang
For bridge(br_flood) or broadcast/multicast packets, they could clone skb with unconfirmed conntrack which break the rule that unconfirmed skb->_nfct is never shared. With nfqueue running on my system, the race can be easily reproduced with following warning calltrace: [13257.707525] CPU: 0

Re: [PATCH] netfilter: conntrack: fix cloned unconfirmed skb->_nfct race in __nf_conntrack_confirm

2018-11-09 Thread Pablo Neira Ayuso
Hi! On Wed, Oct 31, 2018 at 02:02:07PM +0800, Chieh-Min Wang wrote: > From: Chieh-Min Wang > > For bridge(br_flood) or broadcast/multicast packets, they could clone skb with > unconfirmed conntrack which break the rule that unconfirmed skb->_nfct is > never shared. > With nfqueue running on my

Re: [PATCH] netfilter: Only call ftp alg when needed

2018-11-07 Thread Jason Rippon
The data connection with the FTP alg does not seem to respect the masquerade --to-ports option. e.g echo 1 > /proc/sys/net/netfilter/nf_conntrack_helper iptables -t nat -I POSTROUTING -o enp0 -j MASQUERADE -p tcp --to-ports 2-21000 Send ftp (EPSV) query The control connection is changed

Re: [PATCH] netfilter: Only call ftp alg when needed

2018-11-06 Thread Florian Westphal
Felix Jia wrote: > From: Jason Rippon > > This ensures that port range masquerade rules work with the ftp alg. > Previously the tfp data flow was not following the iptables rules. The data connections are supposed to inherit the NAT transformation of the master connection (connection created

[PATCH] netfilter: Only call ftp alg when needed

2018-11-06 Thread Felix Jia
From: Jason Rippon This ensures that port range masquerade rules work with the ftp alg. Previously the tfp data flow was not following the iptables rules. Signed-off-by: Jason Rippon Signed-off-by: Felix Jia --- net/netfilter/nf_conntrack_ftp.c | 3 ++- 1 file changed, 2 insertions(+), 1

[PATCH nf-next 2/2] netfilter: nf_flow_table: simplify nf_flow_offload_gc_step()

2018-11-06 Thread Taehee Yoo
nf_flow_offload_gc_step() and nf_flow_table_iterate() are very similar. so that many duplicate code can be removed. After this patch, nf_flow_offload_gc_step() is simple callback function of nf_flow_table_iterate() like nf_flow_table_do_cleanup(). Signed-off-by: Taehee Yoo ---

[PATCH nf-next 1/2] netfilter: nf_flow_table: make nf_flow_table_iterate() static

2018-11-06 Thread Taehee Yoo
nf_flow_table_iterate() is local function. It can be static function. Signed-off-by: Taehee Yoo --- include/net/netfilter/nf_flow_table.h | 4 net/netfilter/nf_flow_table_core.c| 8 2 files changed, 4 insertions(+), 8 deletions(-) diff --git

[PATCH nf-next 0/2] netfilter: nf_flow_table: remove duplicate code in nf_flow_table_core.c

2018-11-06 Thread Taehee Yoo
In this patch series, duplicate code in nf_flow_table_core.c are removed. First patch makes nf_flow_table_iterate() static because that is local function. Second patch makes nf_flow_offfload_gc_step() simplier. Both nf_flow_offload_gc_step() and nf_flow_table_iterate() have same rhashtable

[PATCH nftables 2/2] xt: always build with a minimal support for xt match/target decode

2018-11-06 Thread Florian Westphal
When building without libxtables, nft would just silently omit any presence of nft_compat in the output. This adds ifdef-ry to at least print name of target/match involved when libxtables isn't available for decoding. Signed-off-by: Florian Westphal --- include/xt.h| 13 +

[PATCH nftables 1/2] xt: pass octx to translate function

2018-11-06 Thread Florian Westphal
We can't use it when no translation is available as libxtables will use plain printf(), but when translation is available we can. Signed-off-by: Florian Westphal --- include/xt.h| 5 +++-- src/statement.c | 2 +- src/xt.c| 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-)

[PATCH nftables 0/2] add minimal x_tables output support

2018-11-06 Thread Florian Westphal
Currently when building nftables without xtables support, then any nft_compat expression is silently skipped. This adds minimal support so we will at least be able to print out that an xtables match is in use in a rule. Example: oifname "eth0" # xt_policy counter packets 0 bytes 0 accept for a

Re: [PATCH] doc: libnftables.adoc misc cleanups

2018-11-05 Thread Duncan Roe
On Mon, Nov 05, 2018 at 10:37:52AM +0100, Pablo Neira Ayuso wrote: > Applied, thanks Duncan. > [...] > > Hm, nft_ctx_output_get_flags() and nft_ctx_output_set_flags() should > be actually at the end, after the list of flags. I fixed this here > with this patch too, I hope you don't mind. > No

[PATCH] netfilter: nf_nat_sip: fix RTP/RTCP source port translations

2018-11-05 Thread Alin Nastac
Perform the same SNAT translation on RTP/RTCP conntracks regardless of who sends the first datagram. Prior to this change, RTP packets send by the peer who required source port translation were forwarded with unmodified source port when this peer started its voice/video stream first. ---

Re: [PATCH nft] documentation: try to clarify iif vs. iifname.

2018-11-05 Thread Pablo Neira Ayuso
On Sun, Nov 04, 2018 at 08:05:20PM +0100, Florian Westphal wrote: [...] > diff --git a/doc/primary-expression.txt b/doc/primary-expression.txt > index 761f50bc1392..5846898e170e 100644 > --- a/doc/primary-expression.txt > +++ b/doc/primary-expression.txt > @@ -15,6 +15,29 @@ directly or as

Re: [PATCH xtables] xtables-nft: make -Z option work

2018-11-05 Thread Pablo Neira Ayuso
On Mon, Nov 05, 2018 at 11:15:32AM +0100, Florian Westphal wrote: > Florian Westphal wrote: > > Argh. I'll see about that. > > This already works, it uses a different code path > (INPUT 42 is CMD_ZERO_NUM, not CMD_ZERO, and that was > implemented already). > > So only thing that did not work

[PATCH xtables] extensions: libebt_ip: fix tos negation

2018-11-05 Thread Florian Westphal
passing ->tos as uintmax_t will clear adjacent fields in the structure, including invflags. Fixes: 49479aa12a15 ("ebtables-compat: add 'ip' match extension") Signed-off-by: Florian Westphal --- extensions/libebt_ip.c | 9 ++--- extensions/libebt_ip.t | 1 + 2 files changed, 7 insertions(+),

[PATCH xtables] extensions: libebt_ip6: fix ip6-dport negation

2018-11-05 Thread Florian Westphal
Fixes: 5c8ce9c6aede0 ("ebtables-compat: add 'ip6' match extension") Signed-off-by: Florian Westphal --- extensions/libebt_ip6.c | 2 +- extensions/libebt_ip6.t | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/extensions/libebt_ip6.c b/extensions/libebt_ip6.c index

Re: [PATCH xtables] xtables-nft: make -Z option work

2018-11-05 Thread Florian Westphal
Florian Westphal wrote: > Argh. I'll see about that. This already works, it uses a different code path (INPUT 42 is CMD_ZERO_NUM, not CMD_ZERO, and that was implemented already). So only thing that did not work correctly was -Z FOO, and that is corrected here.

Re: [PATCH xtables] xtables-nft: make -Z option work

2018-11-05 Thread Jan Engelhardt
On Monday 2018-11-05 10:55, Pablo Neira Ayuso wrote: >On Mon, Nov 05, 2018 at 10:44:20AM +0100, Florian Westphal wrote: >> -Z doesn't just zero base counters, it zeroes out all rule >> counters, or, optionally, all counters of a chain (-Z FOO). > >Looks good. > >But I think we need to extend this

Re: [PATCH xtables] xtables-nft: make -Z option work

2018-11-05 Thread Florian Westphal
Pablo Neira Ayuso wrote: > On Mon, Nov 05, 2018 at 10:44:20AM +0100, Florian Westphal wrote: > > -Z doesn't just zero base counters, it zeroes out all rule > > counters, or, optionally, all counters of a chain (-Z FOO). > > Looks good. > > But I think we need to extend this to support zeroing

Re: [PATCH xtables] xtables-nft: make -Z option work

2018-11-05 Thread Pablo Neira Ayuso
On Mon, Nov 05, 2018 at 10:44:20AM +0100, Florian Westphal wrote: > -Z doesn't just zero base counters, it zeroes out all rule > counters, or, optionally, all counters of a chain (-Z FOO). Looks good. But I think we need to extend this to support zeroing of: * specific chain. * specific rule

[PATCH xtables] xtables-nft: make -Z option work

2018-11-05 Thread Florian Westphal
-Z doesn't just zero base counters, it zeroes out all rule counters, or, optionally, all counters of a chain (-Z FOO). Closes: https://bugzilla.netfilter.org/show_bug.cgi?id=1286 Signed-off-by: Florian Westphal --- iptables/nft.c | 81 -- 1 file

[PATCH nf v3 4/4] netfilter: ipt_CLUSTERIP: check MAC address when duplicate config is set

2018-11-05 Thread Taehee Yoo
If same destination IP address config is already existing, that config is just used. MAC address also should be same. However, there is no MAC address checking routine. So that MAC address checking routine is added. test commands: %iptables -A INPUT -p tcp -i lo -d 192.168.0.5 --dport 80 \

[PATCH nf v3 3/4] netfilter: ipt_CLUSTERIP: fix sleep-in-atomic bug in clusterip_config_entry_put()

2018-11-05 Thread Taehee Yoo
A proc_remove() can sleep. so that it can't be inside of spin_lock. Hence proc_remove() is moved to outside of spin_lock. and it also adds mutex to sync create and remove of proc entry(config->pde). test commands: SHELL#1 %while :; do iptables -A INPUT -p udp -i enp2s0 -d 192.168.1.100 \

[PATCH nf v3 2/4] netfilter: ipt_CLUSTERIP: remove wrong WARN_ON_ONCE in netns exit routine

2018-11-05 Thread Taehee Yoo
When network namespace is destroyed, both clusterip_tg_destroy() and clusterip_net_exit() are called. and clusterip_net_exit() is called before clusterip_tg_destroy(). Hence cleanup check code in clusterip_net_exit() doesn't make sense. test commands: %ip netns add vm1 %ip netns exec vm1

[PATCH nf v3 1/4] netfilter: ipt_CLUSTERIP: fix deadlock in netns exit routine

2018-11-05 Thread Taehee Yoo
When network namespace is destroyed, cleanup_net() is called. cleanup_net() holds pernet_ops_rwsem then calls each ->exit callback. So that clusterip_tg_destroy() is called by cleanup_net(). And clusterip_tg_destroy() calls unregister_netdevice_notifier(). But both cleanup_net() and

[PATCH nf v3 0/4] netfilter: ipt_CLUSTERIP: fix bugs in ipt_CLUSTERIP

2018-11-05 Thread Taehee Yoo
This patchset fixes bugs in ipt_CLUSTERIP. First patch fixes deadlock when netns is destroyed. When netns is destroyed cleanup_net() is called. That function calls ->exit callback of pernet_ops. ->exit callback of ipt_CLUSTERIP hold same lock with cleanup_net(). so that deadlock will occurred.

[PATCH nft] documentation: try to clarify iif vs. iifname.

2018-11-04 Thread Florian Westphal
Signed-off-by: Florian Westphal --- doc/primary-expression.txt | 25 - 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/doc/primary-expression.txt b/doc/primary-expression.txt index 761f50bc1392..5846898e170e 100644 --- a/doc/primary-expression.txt +++

[PATCH nf v2 3/3] netfilter: nf_conncount: fix unexpected permanent node of list.

2018-11-04 Thread Taehee Yoo
When list->count is 0, the list is deleted by GC. But list->count is never reached 0. because Initial count value is 1 and it is increased when node is inserted. So that initial value of list->count should be 0. Originally GC always finds zero count list through deleting node and decreasing

[PATCH nf v2 2/3] netfilter: nf_conncount: fix list_del corruption in conn_free

2018-11-04 Thread Taehee Yoo
nf_conncount_tuple is an element of nft_connlimit and that is deleted by conn_free(). elements can be deleted by both GC routine and data path functions(nf_conncount_lookup, nf_conncount_add) and they calls conn_free() to free elements. But conn_free() only protects lists, not each element. So

[PATCH nf v2 1/3] netfilter: nf_conncount: use spin_lock_bh instead of spin_lock

2018-11-04 Thread Taehee Yoo
conn_free() holds lock with spin_lock(). and it is called by both nf_conncount_lookup() and nf_conncount_gc_list(). nf_conncount_lookup() is bottom-half context and nf_conncount_gc_list() is process context. so that spin_lock() is not safe. Hence conn_free() should use spin_lock_bh() instead of

[PATCH nf v2 0/3] netfilter: nf_conncount: fix bugs in conn_free

2018-11-04 Thread Taehee Yoo
Three bugs in nf_conncount are fixed by this patch series. First patch fixes inconsistent lock state in conn_free(). conn_free() is called both BH and process context. so that spin_lock_bh() should be used. Second patch fixes unsafe locking scenario of list element. conn_free() can't protect

[PATCH nf] netfilter: nf_tables: don't use position attribute on rule replacement

2018-11-04 Thread Florian Westphal
Its possible to set both HANDLE and POSITION when replacing a rule. In this case, the rule at POSITION gets replaced using the userspace-provided handle. Rule handles are supposed to be generated by the kernel only. Duplicate handles should be harmless, however better disable this "feature" by

[PATCH] doc: libnftables.adoc misc cleanups

2018-11-03 Thread Duncan Roe
Ensure split-off fragments of long lines start with if the original long line did. Split 1 remaining long line at sentence boundary. Insert blank line with before NFT_CTX_OUTPUT_NUMERIC_PROTO:: line to stop all 4 NFT_CTX_OUTPUT_NUMERIC_* lines running together. Fix spelling of "eg." to "e.g."

[PATCH xtables] libxtables: add and use mac print helpers

2018-11-03 Thread Florian Westphal
This changes ebtables-nft to consistently print mac address with two characters, i.e. 00:01:02:03:04:0a, not 0:1:2:3:4:a. Will require another bump of vcurrent/vage. Suggested-by: Pablo Neira Ayuso Signed-off-by: Florian Westphal --- extensions/libebt_arp.c | 13 ++---

Re: [PATCH nft 4/5,v2] src: add nft_ctx_output_{get,set}_json() to nft_ctx_output_{get,set}_flags

2018-11-03 Thread Pablo Neira Ayuso
On Sun, Nov 04, 2018 at 01:33:43AM +1100, Duncan Roe wrote: > On Mon, Oct 29, 2018 at 12:33:39PM +0100, Pablo Neira Ayuso wrote: [...] > > @@ -105,6 +103,8 @@ NFT_CTX_OUTPUT_STATELESS:: > > If stateless output has been requested then stateful data is not > > printed. Stateful data refers to

[PATCH iptables] iptables-tests: add % to run iptables commands

2018-11-03 Thread Pablo Neira Ayuso
Lines starting by % allows you to run iptables commands, use it for rateest test. Signed-off-by: Pablo Neira Ayuso --- extensions/libxt_rateest.t | 8 iptables-test.py | 8 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/extensions/libxt_rateest.t

Re: [PATCH nf] netfilter: xt_RATEEST: remove netns exit routine

2018-11-03 Thread Taehee Yoo
On Sat, 3 Nov 2018 at 22:47, Pablo Neira Ayuso wrote: > > Hi Taehee! > > On Wed, Oct 31, 2018 at 03:22:22AM +0900, Taehee Yoo wrote: > > On Tue, 30 Oct 2018 at 08:00, Pablo Neira Ayuso wrote: > > > > > > > Hi Pablo, > > Thank you for review! > > > > > On Fri, Oct 19, 2018 at 12:27:57AM +0900,

Re: [PATCH nft 4/5,v2] src: add nft_ctx_output_{get,set}_json() to nft_ctx_output_{get,set}_flags

2018-11-03 Thread Duncan Roe
On Mon, Oct 29, 2018 at 12:33:39PM +0100, Pablo Neira Ayuso wrote: > Add NFT_CTX_OUTPUT_JSON flag and display output in json format. > > Signed-off-by: Pablo Neira Ayuso > --- > v2: Add nft_output_json() > Fix missing conversion to use NFT_CTX_OUTPUT_JSON. > Remove json field from struct

Re: [PATCH nf] netfilter: xt_RATEEST: remove netns exit routine

2018-11-03 Thread Pablo Neira Ayuso
Hi Taehee! On Wed, Oct 31, 2018 at 03:22:22AM +0900, Taehee Yoo wrote: > On Tue, 30 Oct 2018 at 08:00, Pablo Neira Ayuso wrote: > > > > Hi Pablo, > Thank you for review! > > > On Fri, Oct 19, 2018 at 12:27:57AM +0900, Taehee Yoo wrote: > > > xt_rateest_net_exit() was added to check whether

Re: [PATCH iptables] iptables-tests: do not append xtables-multi to external commands

2018-11-03 Thread Pablo Neira Ayuso
On Sat, Nov 03, 2018 at 02:42:47PM +0100, Pablo Neira Ayuso wrote: > Lines starting by @ can be used to invoke an external command of any > kind. Do not add xtables-multi here since we may want to execute a > non-iptables command. Hm, main problem here with this is rateest, that is used @ to

[PATCH iptables] iptables-tests: do not append xtables-multi to external commands

2018-11-03 Thread Pablo Neira Ayuso
Lines starting by @ can be used to invoke an external command of any kind. Do not add xtables-multi here since we may want to execute a non-iptables command. Signed-off-by: Pablo Neira Ayuso --- iptables-test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

Re: [nft PATCH] evaluate: Convert ranges of N-N to N

2018-11-03 Thread Pablo Neira Ayuso
Hi Phil, On Wed, Oct 24, 2018 at 12:42:09PM +0200, Phil Sutter wrote: > Trying to add a range of size 1 was previously not allowed: > > | # nft add element ip t s '{ 40-40 }' > | Error: Range has zero or negative size > | add element ip t s { 40-40 } > | ^ > > The error

Re: [PATCH iptables 0/6] misc. ebtables-nft improvements

2018-11-03 Thread Pablo Neira Ayuso
On Fri, Nov 02, 2018 at 06:14:11PM +0100, Florian Westphal wrote: > This series fixes a few smaller bugs in ebtables-nft, > adds the 'arpreply' target and adds initial testcases for > all ebtables extensions ebtables-nft is supposed to support. > > It also adds the 'arpreply' target to

Rebasing nf.git ahead

2018-11-03 Thread Pablo Neira Ayuso
Hi everyone, Just a heads up, I'm rebasing nf.git to get this v2 fix for the recent ipset pull request: [PATCH v2] netfilter: ipset: Fix calling ip_set() macro at Sorry for the inconvenience.

Re: [PATCH nf] netfilter: nft_compat: ebtables 'nat' table is normal chain type

2018-11-03 Thread Pablo Neira Ayuso
On Fri, Nov 02, 2018 at 11:33:37AM +0100, Florian Westphal wrote: > Unlike ip(6)tables, the ebtables nat table has no special properties. > This bug causes 'ebtables -A' to fail when using a target such as > 'snat' (ebt_snat target sets ".table = "nat"'). Targets that have > no table restrictions

Re: [PATCH v2] netfilter: ipset: Fix calling ip_set() macro at dumping

2018-11-03 Thread Pablo Neira Ayuso
On Tue, Oct 30, 2018 at 10:43:42PM +0100, Jozsef Kadlecsik wrote: > The ip_set() macro is called when either ip_set_ref_lock held only > or no lock/nfnl mutex is held at dumping. Take this into account > properly. Also, use Pablo's suggestion to use rcu_dereference_raw(), > the ref_netlink

[PATCH iptables 2/6] ebtables: fix -j CONTINUE handling for add/delete

2018-11-02 Thread Florian Westphal
-j CONTINUE can be added, but it can't be removed: extensions/libebt_standard.t: ERROR: line 5 (cannot find: ebtables -I INPUT -d de:ad:be:ef:00:00 -j CONTINUE) This problem stems from silly ambiguity in ebtables-nft vs. iptables. In iptables, you can do iptables -A INPUT (no -j) in ebtables,

[PATCH iptables 5/6] ebtables: add redirect test case

2018-11-02 Thread Florian Westphal
Signed-off-by: Florian Westphal --- extensions/libebt_redirect.c | 2 +- extensions/libebt_redirect.t | 4 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 extensions/libebt_redirect.t diff --git a/extensions/libebt_redirect.c b/extensions/libebt_redirect.c index

[PATCH iptables 4/6] ebtables: add test cases

2018-11-02 Thread Florian Westphal
Signed-off-by: Florian Westphal --- extensions/libebt_802_3.t | 3 +++ extensions/libebt_arp.t | 11 +++ extensions/libebt_ip.t | 10 ++ extensions/libebt_ip6.t | 12 extensions/libebt_log.t | 6 ++ extensions/libebt_mark.t| 5 +

[PATCH iptables 1/6] tests: add basic ebtables test support

2018-11-02 Thread Florian Westphal
now that we have ebtables-save, lets add test cases for ebtables-nft as well. Signed-off-by: Florian Westphal --- extensions/libebt_standard.t | 6 ++ iptables-test.py | 13 ++--- 2 files changed, 16 insertions(+), 3 deletions(-) create mode 100644

[PATCH iptables 0/6] misc. ebtables-nft improvements

2018-11-02 Thread Florian Westphal
This series fixes a few smaller bugs in ebtables-nft, adds the 'arpreply' target and adds initial testcases for all ebtables extensions ebtables-nft is supposed to support. It also adds the 'arpreply' target to ebtables-nft. Florian Westphal (6): tests: add basic ebtables test support

[PATCH nf,v2 2/2] netfilter: nfnetlink_cttimeout: pass default timeout policy to obj_to_nlattr

2018-11-02 Thread Pablo Neira Ayuso
Otherwise, we hit a NULL pointer deference since handlers always assume default timeout policy is passed. netlink: 24 bytes leftover after parsing attributes in process `syz-executor2'. kasan: CONFIG_KASAN_INLINE enabled kasan: GPF could be caused by NULL-ptr deref or user memory access

[PATCH nf,v2 1/2] netfilter: conntrack: add nf_{tcp,udp,sctp,icmp,dccp,icmpv6,generic}_pernet()

2018-11-02 Thread Pablo Neira Ayuso
Expose these functions to access conntrack protocol tracker netns area, nfnetlink_cttimeout needs this. Signed-off-by: Pablo Neira Ayuso --- v2: Place these functions in nf_conntrack_l4proto.h. Wrap nf_dccp_pernet() and nf_sctp_pernet() around ifdef -kbuild robot.

[PATCH nf] netfilter: nft_compat: ebtables 'nat' table is normal chain type

2018-11-02 Thread Florian Westphal
Unlike ip(6)tables, the ebtables nat table has no special properties. This bug causes 'ebtables -A' to fail when using a target such as 'snat' (ebt_snat target sets ".table = "nat"'). Targets that have no table restrictions work fine. Signed-off-by: Florian Westphal ---

[PATCH xtables] iptables-nft: fix bogus handling of zero saddr/daddr

2018-11-02 Thread Florian Westphal
rule for 0.0.0.0/8 is added as 0.0.0.0/0, because we did not check mask (or negation, for that matter). Fix this and add test cases too. This also revealed an ip6tables-nft-save bug, it would print ' !-d', not '! -d'. Closes: https://bugzilla.netfilter.org/show_bug.cgi?id=1287 Signed-off-by:

Re: [PATCH nf 2/2] netfilter: nfnetlink_cttimeout: pass default timeout policy to obj_to_nlattr

2018-11-02 Thread kbuild test robot
Hi Pablo, I love your patch! Yet something to improve: [auto build test ERROR on nf/master] url: https://github.com/0day-ci/linux/commits/Pablo-Neira-Ayuso/netfilter-add-nf_-tcp-udp-sctp-icmp-dccp-icmpv6-generic-_pernet/20181102-101813 base:

Re: [PATCH nf 1/2] netfilter: add nf_{tcp,udp,sctp,icmp,dccp,icmpv6,generic}_pernet()

2018-11-01 Thread kbuild test robot
Hi Pablo, I love your patch! Yet something to improve: [auto build test ERROR on nf/master] url: https://github.com/0day-ci/linux/commits/Pablo-Neira-Ayuso/netfilter-add-nf_-tcp-udp-sctp-icmp-dccp-icmpv6-generic-_pernet/20181102-101813 base:

Re: [PATCH libnftnl 4/4] src: Use memcpy() to handle potentially unaligned data

2018-11-01 Thread Pablo Neira Ayuso
On Wed, Oct 31, 2018 at 07:18:04PM -0700, Matt Turner wrote: > On Fri, Oct 19, 2018 at 11:09 AM Matt Turner wrote: > > If you wouldn't mind, now might be a good time to make a 1.1.2 > > release. In the four months since 1.1.1 there are some important fixes > > for oddball systems (big endian,

[PATCH nf 2/2] netfilter: nfnetlink_cttimeout: pass default timeout policy to obj_to_nlattr

2018-11-01 Thread Pablo Neira Ayuso
Otherwise, we hit a NULL pointer deference since handlers always assume default timeout policy is passed. netlink: 24 bytes leftover after parsing attributes in process `syz-executor2'. kasan: CONFIG_KASAN_INLINE enabled kasan: GPF could be caused by NULL-ptr deref or user memory access general

Re: [PATCH iptables] iptables: iptables-test: fix netns test

2018-11-01 Thread Pablo Neira Ayuso
On Thu, Nov 01, 2018 at 11:32:50PM +0900, Taehee Yoo wrote: > The libxt_rateest test is always failed because dependent command is not > executed in netns. > (@iptables -I INPUT -j RATEEST --rateest-name RE1 --rateest-interval \ > 250.0ms --rateest-ewmalog 500.0ms) > After this path, adding netns

[PATCH iptables] iptables: iptables-test: fix netns test

2018-11-01 Thread Taehee Yoo
The libxt_rateest test is always failed because dependent command is not executed in netns. (@iptables -I INPUT -j RATEEST --rateest-name RE1 --rateest-interval \ 250.0ms --rateest-ewmalog 500.0ms) After this path, adding netns command is executed first. Then test commands are executed. Fixes:

[PATCH] netfilter: ctnetlink: always honor CTA_MARK_MASK

2018-11-01 Thread Andreas Jaggi
Useful to only set a particular range of the conntrack mark while leaving existing parts of the value alone, e.g. when updating conntrack marks via netlink from userspace. For NFQUEUE it was already implemented in commit 534473c6080e01395058445135df29a8eb638c77. This now adds the same

Re: [nft PATCH] doc: Fix for make distcheck

2018-10-31 Thread Pablo Neira Ayuso
On Wed, Oct 31, 2018 at 11:16:56PM +0100, Phil Sutter wrote: > When building from a separate build directory, a2x did not find the > source file nft.txt. Using '$<' instead fixes this. Applied, thanks!

Re: [iptables PATCH v2] xtables: Fix for matching rules with wildcard interfaces

2018-10-31 Thread Pablo Neira Ayuso
On Wed, Oct 31, 2018 at 08:13:34PM +0100, Phil Sutter wrote: > Due to xtables_parse_interface() and parse_ifname() being misaligned > regarding interface mask setting, rules containing a wildcard interface > added with iptables-nft could neither be checked nor deleted. > > As suggested, introduce

[nft PATCH] doc: Fix for make distcheck

2018-10-31 Thread Phil Sutter
When building from a separate build directory, a2x did not find the source file nft.txt. Using '$<' instead fixes this. Fixes: 3bacae9e4a1e3 ("doc: Review man page building in Makefile.am") Signed-off-by: Phil Sutter --- doc/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

[iptables PATCH v2] xtables: Fix for matching rules with wildcard interfaces

2018-10-31 Thread Phil Sutter
Due to xtables_parse_interface() and parse_ifname() being misaligned regarding interface mask setting, rules containing a wildcard interface added with iptables-nft could neither be checked nor deleted. As suggested, introduce extensions/iptables.t to hold checks for built-in selectors. This file

Re: [PATCH nft] json: fix json_events_cb() declaration when libjansson is not present

2018-10-31 Thread Phil Sutter
Hey Laura, On Wed, Oct 31, 2018 at 12:54:18PM +0100, Laura Garcia Liebana wrote: > When nftables is configured without libjansson support, the following > compilation error is shown: > > monitor.c: In function ‘netlink_echo_callback’: > monitor.c:910:10: error: too many arguments to function

[PATCH nf 1/2] netfilter: nf_tables: don't skip inactive chains during update

2018-10-31 Thread Florian Westphal
There is no synchronization between packet path and the configuration plane. The packet path uses two arrays with rules, one contains the current (active) generation. The other either contains the last (obsolete) generation or the future one. Consider: cpu1 cpu2

[PATCH nf 2/2] selftests: add script to stress-test nft packet path vs. control plane

2018-10-31 Thread Florian Westphal
Start flood ping for each cpu while loading/flushing rulesets to make sure we do not access already-free'd rules from nf_tables evaluation loop. Also add this to TARGETS so 'make run_tests' in selftest dir runs it automatically. This would have caught the bug fixed in previous change

Re: stable regression: revert request for netfilter ipv6 defrag bug

2018-10-31 Thread Sasha Levin
On Wed, Oct 24, 2018 at 12:31:04PM +0200, Florian Westphal wrote: Hi, please consider reverting commit 84379c9afe011020e797e3f50a662b08a6355dcf netfilter: ipv6: nf_defrag: drop skb dst before queueing It causes kernel crash for locally generated ipv6 fragments when netfilter ipv6

Re: [nft PATCH] py: Adjust Nftables class to output flags changes

2018-10-31 Thread Pablo Neira Ayuso
On Wed, Oct 31, 2018 at 01:53:16PM +0100, Phil Sutter wrote: > Introduce setter/getter methods for each introduced output flag. Ignore > NFT_CTX_OUTPUT_NUMERIC_ALL for now since it's main purpose is for > internal use. > > Adjust the script in tests/py accordingly: Due to the good defaults, >

Re: [PATCH nft] json: fix json_events_cb() declaration when libjansson is not present

2018-10-31 Thread Pablo Neira Ayuso
On Wed, Oct 31, 2018 at 12:54:18PM +0100, Laura Garcia Liebana wrote: > When nftables is configured without libjansson support, the following > compilation error is shown: > > monitor.c: In function ‘netlink_echo_callback’: > monitor.c:910:10: error: too many arguments to function

[nft PATCH] py: Adjust Nftables class to output flags changes

2018-10-31 Thread Phil Sutter
Introduce setter/getter methods for each introduced output flag. Ignore NFT_CTX_OUTPUT_NUMERIC_ALL for now since it's main purpose is for internal use. Adjust the script in tests/py accordingly: Due to the good defaults, only numeric proto output has to be selected - this is not a must, but

[PATCH nft] json: fix json_events_cb() declaration when libjansson is not present

2018-10-31 Thread Laura Garcia Liebana
When nftables is configured without libjansson support, the following compilation error is shown: monitor.c: In function ‘netlink_echo_callback’: monitor.c:910:10: error: too many arguments to function ‘json_events_cb’ return json_events_cb(nlh, _monh); ^~ This patch

Segmentation fault when using ebtables

2018-10-31 Thread Dmitry Vinokurov
Hello, I'm trying to execute "ebtables -A FORWARD -p arp -j DROP" compiled for x86_64 from ebtables-v2.0.10-4 sources and get segmentation fault on file libebtc.c and line 240 ( ebt_find_target(EBT_STANDARD_TARGET)->used = 1; ). Seems that ebt_find_target returns NULL. Could anybody help explain

[PATCH] netfilter: conntrack: fix cloned unconfirmed skb->_nfct race in __nf_conntrack_confirm

2018-10-31 Thread Chieh-Min Wang
From: Chieh-Min Wang For bridge(br_flood) or broadcast/multicast packets, they could clone skb with unconfirmed conntrack which break the rule that unconfirmed skb->_nfct is never shared. With nfqueue running on my system, the race can be easily reproduced with following warning calltrace:

[PATCH v2] netfilter: ipset: Fix calling ip_set() macro at dumping

2018-10-30 Thread Jozsef Kadlecsik
The ip_set() macro is called when either ip_set_ref_lock held only or no lock/nfnl mutex is held at dumping. Take this into account properly. Also, use Pablo's suggestion to use rcu_dereference_raw(), the ref_netlink protects the set. Signed-off-by: Jozsef Kadlecsik ---

Re: [PATCH nf 1/2] netfilter: nf_conncount: use spin_lock_bh instead of spin_lock

2018-10-30 Thread Taehee Yoo
Thanks to all reviewer! On Tue, 30 Oct 2018 at 08:41, Florian Westphal wrote: > > Pablo Neira Ayuso wrote: > > On Thu, Oct 25, 2018 at 11:56:12PM +0900, Taehee Yoo wrote: > > > conn_free() holds lock with spin_lock(). and it is called by both > > > nf_conncount_lookup() and

Re: [PATCH nf] netfilter: xt_RATEEST: remove netns exit routine

2018-10-30 Thread Taehee Yoo
On Tue, 30 Oct 2018 at 08:00, Pablo Neira Ayuso wrote: > Hi Pablo, Thank you for review! > On Fri, Oct 19, 2018 at 12:27:57AM +0900, Taehee Yoo wrote: > > xt_rateest_net_exit() was added to check whether rules are flushed > > successfully. but ->net_exit() callback is called earlier than > >

Re: [iptables PATCH] xtables: Fix for matching rules with wildcard interfaces

2018-10-30 Thread Pablo Neira Ayuso
On Tue, Oct 30, 2018 at 06:45:20PM +0100, Phil Sutter wrote: > Hi Pablo, > > On Tue, Oct 30, 2018 at 06:01:19PM +0100, Pablo Neira Ayuso wrote: > > On Tue, Oct 30, 2018 at 05:57:53PM +0100, Phil Sutter wrote: > > > Due to xtables_parse_interface() and parse_ifname() being misaligned > > >

Re: [iptables PATCH] xtables: Fix for matching rules with wildcard interfaces

2018-10-30 Thread Phil Sutter
Hi Pablo, On Tue, Oct 30, 2018 at 06:01:19PM +0100, Pablo Neira Ayuso wrote: > On Tue, Oct 30, 2018 at 05:57:53PM +0100, Phil Sutter wrote: > > Due to xtables_parse_interface() and parse_ifname() being misaligned > > regarding interface mask setting, rules containing a wildcard interface > >

Re: [iptables PATCH] xtables: Fix for matching rules with wildcard interfaces

2018-10-30 Thread Pablo Neira Ayuso
On Tue, Oct 30, 2018 at 05:57:53PM +0100, Phil Sutter wrote: > Due to xtables_parse_interface() and parse_ifname() being misaligned > regarding interface mask setting, rules containing a wildcard interface > added with iptables-nft could neither be checked nor deleted. > > Signed-off-by: Phil

[iptables PATCH] xtables: Fix for matching rules with wildcard interfaces

2018-10-30 Thread Phil Sutter
Due to xtables_parse_interface() and parse_ifname() being misaligned regarding interface mask setting, rules containing a wildcard interface added with iptables-nft could neither be checked nor deleted. Signed-off-by: Phil Sutter --- iptables/nft-shared.c| 2 +-

Re: [PATCH] ulogd2: fix build with musl libc

2018-10-30 Thread Pablo Neira Ayuso
On Mon, Oct 29, 2018 at 05:52:51PM -0700, Cameron Norman wrote: > Yes, we can do that. Would you send me a patch? Please, add your Signed-off-by: tag. Or I can just mangle this patch here if you prefer this. Thanks. > On Mon, Oct 29, 2018 at 2:11 PM Pablo Neira Ayuso wrote: > > > > Hi, > > >

Re: [PATCH 3/3 nft,v2] expression: always print range expression numerically

2018-10-30 Thread Phil Sutter
On Mon, Oct 29, 2018 at 09:58:00PM +0100, Pablo Neira Ayuso wrote: > Otherwise we end up displaying things that we cannot parse as input. > Moreover, in a range, it's relevant to the user the values that are > enclosed in the range, so let's print this numerically. > > Fixes: baa4e0e3fa5f ("src:

Re: [PATCH 1/3 nft,v3] src: get rid of nft_ctx_output_{get,set}_numeric()

2018-10-30 Thread Phil Sutter
On Mon, Oct 29, 2018 at 09:57:58PM +0100, Pablo Neira Ayuso wrote: > This patch adds NFT_CTX_OUTPUT_NUMERIC_SYMBOL, which replaces the last > client of the numeric level approach. > > This patch updates `-n' option semantics to display all output > numerically. > > Note that monitor code was

Re: [PATCH] ulogd2: fix build with musl libc

2018-10-29 Thread Cameron Norman
Yes, we can do that. On Mon, Oct 29, 2018 at 2:11 PM Pablo Neira Ayuso wrote: > > Hi, > > On Sat, Oct 27, 2018 at 01:05:45PM -0700, Cameron Norman wrote: > > The attached patch fixes building ulogd2 with musl libc. It is being > > used on Void Linux right now. > > > >

Re: [PATCH nf 1/2] netfilter: nf_conncount: use spin_lock_bh instead of spin_lock

2018-10-29 Thread Florian Westphal
Pablo Neira Ayuso wrote: > On Thu, Oct 25, 2018 at 11:56:12PM +0900, Taehee Yoo wrote: > > conn_free() holds lock with spin_lock(). and it is called by both > > nf_conncount_lookup() and nf_conncount_gc_list(). > > nf_conncount_lookup() is bottom-half context and nf_conncount_gc_list() > > is

Re: [PATCH nf 1/2] netfilter: nf_conncount: use spin_lock_bh instead of spin_lock

2018-10-29 Thread Pablo Neira Ayuso
On Thu, Oct 25, 2018 at 11:56:12PM +0900, Taehee Yoo wrote: > conn_free() holds lock with spin_lock(). and it is called by both > nf_conncount_lookup() and nf_conncount_gc_list(). > nf_conncount_lookup() is bottom-half context and nf_conncount_gc_list() > is process context. so that spin_lock() is

Re: [PATCH nf] netfilter: xt_IDLETIMER: add sysfs filename checking routine

2018-10-29 Thread Pablo Neira Ayuso
On Sun, Oct 21, 2018 at 12:00:08AM +0900, Taehee Yoo wrote: > When IDLETIMER rule is added, sysfs file is created under > /sys/class/xt_idletimer/timers/ > But some label name shouldn't be used. > ".", "..", "power", "uevent", "subsystem", etc... > So that sysfs filename checking routine is

Re: [PATCH nf] netfilter: xt_RATEEST: remove netns exit routine

2018-10-29 Thread Pablo Neira Ayuso
On Fri, Oct 19, 2018 at 12:27:57AM +0900, Taehee Yoo wrote: > xt_rateest_net_exit() was added to check whether rules are flushed > successfully. but ->net_exit() callback is called earlier than > ->destroy() callback. > So that ->net_exit() callback can't check that. > > test commands: >%ip

Re: [PATCH nf 2/2] netfilter: nf_conncount: fix list_del corruption in conn_free

2018-10-29 Thread Yi-Hung Wei
On Thu, Oct 25, 2018 at 7:56 AM Taehee Yoo wrote: > > nf_conncount_tuple is an element of nft_connlimit and that is deleted by > conn_free(). elements can be deleted by both GC routine and > data path functions(nf_conncount_lookup, nf_conncount_add) and they > calls conn_free() to free elements.

<    1   2   3   4   5   6   7   8   9   10   >