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

2018-10-14 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 nf v2 1/3] netfilter: ipt_CLUSTERIP: fix deadlock in netns exit routine

2018-10-14 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 v2 2/3] netfilter: ipt_CLUSTERIP: remove wrong WARN_ON_ONCE in netns exit routine

2018-10-14 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

[nft PATCH] xt: Fix for covscan warning in xt_stmt_xlate()

2018-10-12 Thread Phil Sutter
This does not fix a real issue, target or match field should never be NULL. Also, I can't find a place where opts field is being assigned to. Still, covscan sees the NULL check and assumes that if target or match field is NULL *and* opts field is NULL as well, code ends up dereferencing the NULL

[nft PATCH] json: Fix memleak in dup_stmt_json()

2018-10-12 Thread Phil Sutter
The variable 'root' is always assigned to after initialization, so there is no point in initializing it upon declaration. Fixes: e70354f53e9f6 ("libnftables: Implement JSON output support") Signed-off-by: Phil Sutter --- src/json.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

[nft PATCH] parser_json: Fix for ineffective family value checks

2018-10-12 Thread Phil Sutter
Since handle->family is unsigned, checking for value < 0 never yields true. Overcome this by changing parse_family() to return an error code and write the parsed family value into a pointer passed as parameter. The above change required a bit more cleanup to avoid passing pointers to signed

[nft PATCH] libnftables: Fix memleak in nft_parse_bison_filename()

2018-10-12 Thread Phil Sutter
Allocated scanner object leaks when returning to caller. For some odd reason, this was missed by the commit referenced below. Fixes: bd82e03e15df8 ("libnftables: Move scanner object into struct nft_ctx") Signed-off-by: Phil Sutter --- src/libnftables.c | 7 +++ 1 file changed, 3

[nft PATCH] Fix memleak in netlink_parse_fwd() error path

2018-10-12 Thread Phil Sutter
Make sure allocated 'stmt' is freed before returning to caller. Fixes: 30d45266bf38b ("expr: extend fwd statement to support address and family") Signed-off-by: Phil Sutter --- src/netlink_delinearize.c | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git

[PATCH nf-next] netfilter: nft_flow_offload: remove secpath check

2018-10-11 Thread Pablo Neira Ayuso
It is safe to place a flow that is coming from IPSec into the flowtable. So decapsulated can benefit from the flowtable fastpath. Signed-off-by: Pablo Neira Ayuso Signed-off-by: Steffen Klassert --- I'm recovering this patch, this enables faster flowtable forwarding from ingress. Florian has

[PATCH nf v2] netfilter: nf_flow_table: do not remove offload when other netns's interface is down

2018-10-11 Thread Taehee Yoo
When interface is down, offload cleanup function(nf_flow_table_do_cleanup) is called and that checks whether interface index of offload and index of link down interface is same. but only interface index checking is not enough because flowtable is not pernet list. So that, if other netns's

[PATCH nf-next] netfilter: nf_flow_table: remove unnecessary parameter of nf_flow_table_cleanup()

2018-10-11 Thread Taehee Yoo
parameter net of nf_flow_table_cleanup() is not used. So that it can be removed. Signed-off-by: Taehee Yoo --- include/net/netfilter/nf_flow_table.h | 2 +- net/netfilter/nf_flow_table_core.c| 2 +- net/netfilter/nft_flow_offload.c | 2 +- 3 files changed, 3 insertions(+), 3

[nft PATCH 1/8] tests/py: Add missing JSON bits for inet/meta.t

2018-10-11 Thread Phil Sutter
Those were forgotten when renaming meta secpath to meta ipsec. Fixes: 8f55ed41d0070 ("src: rename meta secpath to meta ipsec") Signed-off-by: Phil Sutter --- tests/py/inet/meta.t.json| 8 +--- tests/py/inet/meta.t.json.output | 15 +++ 2 files changed, 20 insertions(+),

[nft PATCH 6/8] monitor: Fix printing of ct objects

2018-10-11 Thread Phil Sutter
Monitor output is supposed to be single lined without tabs, but ct object were printed with newlines and tabs hard-coded. Fixing this wasn't too hard given that there is 'stmt_separator' to also include semi-colons where required if newline was removed. A more obvious mistake was position of

[nft PATCH 0/8] monitor: Use libnftables for JSON output

2018-10-11 Thread Phil Sutter
This series essentially moves nft monitor JSON output to libnftables (in patch 7). Patch 8 enhances tests/monitor to get that tested as well (via passing '-j' parameter to run-tests.sh). The leading six patches are more or less prerequisites for the later ones. Phil Sutter (8): tests/py: Add

[nft PATCH 7/8] monitor: Use libnftables JSON output

2018-10-11 Thread Phil Sutter
This switches 'nft monitor' JSON output from using libnftnl's to libnftables' implementation. Signed-off-by: Phil Sutter --- include/json.h | 51 + src/json.c | 57 ++ src/monitor.c | 281 + src/rule.c | 2 - 4 files

[nft PATCH 4/8] monitor: Drop fake XML support

2018-10-11 Thread Phil Sutter
Since libnftnl doesn't support XML formatting, pretending to do so in nft monitor is pointless. Signed-off-by: Phil Sutter --- src/monitor.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/src/monitor.c b/src/monitor.c index 4310c3b8dc434..d75410888e3d0 100644 --- a/src/monitor.c +++

[nft PATCH 3/8] json: Add ct timeout support

2018-10-11 Thread Phil Sutter
Add support for printing and parsing ct timeout objects to JSON API. Signed-off-by: Phil Sutter --- src/json.c | 29 ++ src/parser_json.c | 82 +- tests/py/ip/objects.t.json | 7 3 files changed, 117 insertions(+), 1

[nft PATCH 8/8] tests: monitor: Test JSON output as well

2018-10-11 Thread Phil Sutter
Enhance monitor test suite to test check JSON output as well. Note that for now there is no support for --echo output testing with JSON. Signed-off-by: Phil Sutter --- tests/monitor/README | 27 +++- tests/monitor/run-tests.sh | 45

[nft PATCH 2/8] json: Drop unused symbolic_constant_json() stub

2018-10-11 Thread Phil Sutter
This seems like a left-over from day 1: Said function is static in json.c, so there is no point in providing a stub when compiling with JSON disabled. Signed-off-by: Phil Sutter --- include/json.h | 6 -- 1 file changed, 6 deletions(-) diff --git a/include/json.h b/include/json.h index

Re: spinlock'ing of "struct nf_conn"->custom_buffer_ptr within xt_match.match callback

2018-10-11 Thread Florian Westphal
Oleh Danilovskyi wrote: > I have implemented a custom extension for conntrack. It is basically > extra pointer which resides in "struct nf_conn". > The pointer references a slab buffer and it is used/modified in custom > netfilter match extension. > I'm not sure whether it is possible that

spinlock'ing of "struct nf_conn"->custom_buffer_ptr within xt_match.match callback

2018-10-11 Thread Oleh Danilovskyi
I have implemented a custom extension for conntrack. It is basically extra pointer which resides in "struct nf_conn". The pointer references a slab buffer and it is used/modified in custom netfilter match extension. I'm not sure whether it is possible that different skbs with the same nf_conn can

Re: [PATCH nf 2/2] netfilter: xt_TEE: add missing code to get interface index in checkentry.

2018-10-11 Thread Taehee Yoo
On Thu, 11 Oct 2018 at 19:17, Pablo Neira Ayuso wrote: > Hi Pablo, > On Wed, Oct 10, 2018 at 07:56:18PM +0200, Pablo Neira Ayuso wrote: > > On Sun, Oct 07, 2018 at 12:09:32AM +0900, Taehee Yoo wrote: > > > checkentry(tee_tg_check) should initialize priv->oif from dev if possible. > > > But only

[iptables PATCH] xtables: Remove target_maxnamelen field

2018-10-11 Thread Phil Sutter
This is a partial revert of commit 9f075031a1973 ("Combine parse_target() and command_jump() implementations"): Upstream prefers to reduce max chain name length of arptables by two characters instead of the introduced struct xtables_globals field which requires to bump library API version. Fixes:

Re: [PATCH nf] netfilter: nf_flow_table: do not remove offload when other netns's interface is down

2018-10-11 Thread Taehee Yoo
On Thu, 11 Oct 2018 at 03:09, Pablo Neira Ayuso wrote: > Hi Pablo, Thank you for review! > On Tue, Oct 09, 2018 at 02:59:48AM +0900, Taehee Yoo wrote: > > When interface is down, offload cleanup function(nf_flow_table_do_cleanup) > > is called and that checks whether interface index of offload

Re: [PATCH nf 1/2] netfilter: ipt_CLUSTERIP: fix deadlock in netns exit routine

2018-10-11 Thread Taehee Yoo
On Thu, 11 Oct 2018 at 02:32, Pablo Neira Ayuso wrote: > Hi Pablo, Thank you for review! > On Sat, Oct 06, 2018 at 01:42:42AM +0900, Taehee Yoo wrote: > > diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c > > b/net/ipv4/netfilter/ipt_CLUSTERIP.c > > index 2c8d313ae216..6ccabe6f74a6 100644 > >

Re: [PATCH nf-next v4] nft_osf: Add ttl option support

2018-10-11 Thread Pablo Neira Ayuso
On Wed, Oct 10, 2018 at 09:57:13AM +0200, Fernando Fernandez Mancera wrote: > Add ttl option support to the nftables "osf" expression. Applied, thanks. I have mangled the patch to: netfilter: nft_osf: usage from output path is not valid This never meant to work there actually, to make

Re: [PATCH nf 1/2] netfilter: xt_TEE: fix wrong interface selection

2018-10-11 Thread Pablo Neira Ayuso
On Sun, Oct 07, 2018 at 12:09:18AM +0900, Taehee Yoo wrote: > TEE netdevice notifier handler checks only interface name. however > each netns can have same interface name. hence other netns's interface > could be selected. > > test commands: >%ip netns add vm1 >%iptables -I INPUT -p icmp

Re: [PATCH nf 2/2] netfilter: xt_TEE: add missing code to get interface index in checkentry.

2018-10-11 Thread Pablo Neira Ayuso
On Wed, Oct 10, 2018 at 07:56:18PM +0200, Pablo Neira Ayuso wrote: > On Sun, Oct 07, 2018 at 12:09:32AM +0900, Taehee Yoo wrote: > > checkentry(tee_tg_check) should initialize priv->oif from dev if possible. > > But only netdevice notifier handler can set that. > > Hence priv->oif is always -1

[PATCH nf-next,v2] netfilter: nft_compat: do not dump private area

2018-10-11 Thread Pablo Neira Ayuso
Zero pad private area, otherwise we expose private kernel pointer to userspace. This patch also zeroes the tail area after the ->matchsize and ->targetsize that results from XT_ALIGN(). Fixes: 0ca743a55991 ("netfilter: nf_tables: add compatibility layer for x_tables") Reported-by: Florian

[PATCH nf-next] netfilter: xt_osf: simplify xt_osf_match_packet()

2018-10-11 Thread Pablo Neira Ayuso
info area in match is always available, and remove unneeded variables. Signed-off-by: Pablo Neira Ayuso --- net/netfilter/xt_osf.c | 8 +--- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/net/netfilter/xt_osf.c b/net/netfilter/xt_osf.c index bf7bba80e24c..7a103553d10d 100644

Re: [PATCH nf] netfilter: nf_flow_table: do not remove offload when other netns's interface is down

2018-10-10 Thread Pablo Neira Ayuso
On Tue, Oct 09, 2018 at 02:59:48AM +0900, Taehee Yoo wrote: > When interface is down, offload cleanup function(nf_flow_table_do_cleanup) > is called and that checks whether interface index of offload and > index of link down interface is same. but only interface index checking > is not enough

Re: [PATCH nf 2/2] netfilter: xt_TEE: add missing code to get interface index in checkentry.

2018-10-10 Thread Pablo Neira Ayuso
On Sun, Oct 07, 2018 at 12:09:32AM +0900, Taehee Yoo wrote: > checkentry(tee_tg_check) should initialize priv->oif from dev if possible. > But only netdevice notifier handler can set that. > Hence priv->oif is always -1 until notifier handler is called. > > Fixes: 22265a5c3c10 ("netfilter:

Re: [PATCH nf 1/2] netfilter: ipt_CLUSTERIP: fix deadlock in netns exit routine

2018-10-10 Thread Pablo Neira Ayuso
On Sat, Oct 06, 2018 at 01:42:42AM +0900, Taehee Yoo wrote: > diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c > b/net/ipv4/netfilter/ipt_CLUSTERIP.c > index 2c8d313ae216..6ccabe6f74a6 100644 > --- a/net/ipv4/netfilter/ipt_CLUSTERIP.c > +++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c > @@ -59,7 +59,6 @@

[PATCH nft] segtree: set proper error cause on existing elements

2018-10-10 Thread Pablo Neira Ayuso
Adding new elements result in a confusing "Success" error message. # nft add element x y { 0-3 } Error: interval overlaps with an existing one add element x y { 0-3 } ^^^ Error: Could not process rule: Success add element x y { 0-3 }

[PATCH nf-next] netfilter: nf_tables: xfrm: use state family, not hook one

2018-10-10 Thread Florian Westphal
Eyal says: doesn't the use of nft_pf(pkt) in this context limit the matching of encapsulated packets to the same family? IIUC when an e.g. IPv6-in-IPv4 packet is matched, the nft_pf(pkt) will be the decapsulated packet family - IPv6 - whereas the state may be IPv4. So this check would

[PATCH nft] segtree: incorrect handling of last element in get_set_decompose()

2018-10-10 Thread Pablo Neira Ayuso
Add range to the list of matching elements. Fixes: 95629758a5ec ("segtree: bogus range via get set element on existing elements") Signed-off-by: Pablo Neira Ayuso --- src/segtree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/segtree.c b/src/segtree.c index

[PATCH nft 2/3] src: remove netlink_flush_table()

2018-10-10 Thread Pablo Neira Ayuso
Just a simple wrapper function, replace it by direct call to mnl_nft_rule_del(). Signed-off-by: Pablo Neira Ayuso --- include/netlink.h | 1 - src/netlink.c | 10 -- src/rule.c| 2 +- 3 files changed, 1 insertion(+), 12 deletions(-) diff --git a/include/netlink.h

[PATCH nft 1/3] mnl: remove alloc_nftnl_set()

2018-10-10 Thread Pablo Neira Ayuso
We can remove alloc_nftnl_set() and consolidate infrastructure in the src/mnl.c file. Signed-off-by: Pablo Neira Ayuso --- include/mnl.h | 18 +++-- include/netlink.h | 14 ++-- src/mnl.c | 192 ++ src/netlink.c | 176

[PATCH nft 3/3] src: remove netlink_flush_chain()

2018-10-10 Thread Pablo Neira Ayuso
Signed-off-by: Pablo Neira Ayuso --- include/netlink.h | 1 - src/netlink.c | 5 - src/rule.c| 3 +-- 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/include/netlink.h b/include/netlink.h index e27d75ead855..b7e2232f4bd9 100644 --- a/include/netlink.h +++

Wohltätigkeitsspende in Höhe von € 2.000.000,00

2018-10-10 Thread cinthia_reyes
Lieber Freund, Ich bin Herr Tayeb Souami, New Jersey, Vereinigte Staaten von Amerika, der Mega-Gewinner von $ 315million In Mega Millions Jackpot, spende ich an 5 zufällige Personen, wenn Sie diese E-Mail erhalten, dann wurde Ihre E-Mail nach einem Spinball ausgewählt.Ich habe den größten

[PATCH nft] mnl: remove alloc_nftnl_rule()

2018-10-10 Thread Pablo Neira Ayuso
We can remove alloc_nftnl_rule() and consolidate infrastructure in the src/mnl.c file. Signed-off-by: Pablo Neira Ayuso --- include/mnl.h | 11 --- include/netlink.h | 9 -- src/mnl.c | 90 --- src/netlink.c | 76

Re: [iptables] extensions: Add tests and description for xt_quota module

2018-10-10 Thread Pablo Neira Ayuso
On Tue, Oct 09, 2018 at 04:47:20PM -0700, Maciej Żenczykowski wrote: > Ah, yes, the (2**64 - 1) + 1 problem. > > The fact max allowed remaining is (2**64 - 2) is perhaps surprising... > should we clamp? or warn? > > userspace has: > if (cb->entry->id == O_REMAIN) info->remain++; > should this

Re: [iptables] extensions: Add tests and description for xt_quota module

2018-10-10 Thread Pablo Neira Ayuso
On Tue, Oct 09, 2018 at 04:14:40PM -0700, Chenbo Feng wrote: > From: Chenbo Feng > > Introduces some iptables tests for the new --remain option in xt_quota > module. Add a breif description for how to use the --remain option in > the iptables-extension man page. Applied, thanks Chenbo.

[PATCH nf-next v4] nft_osf: Add ttl option support

2018-10-10 Thread Fernando Fernandez Mancera
Add ttl option support to the nftables "osf" expression. Signed-off-by: Fernando Fernandez Mancera --- v1:initial patch v2:v2: code correctness and fix the "~" typo. v3:make priv->ttl = ttl; optional and priv->ttl default value is now 0. v4:delete "if (ttl_check != -1)" branch ---

[PATCH nf] netfilter: nft_osf: output hook is not valid anymore

2018-10-10 Thread Fernando Fernandez Mancera
nft_osf no longer supports "output" hook as xt_osf doesn't either. Fixes: b96af92d6eaf ("netfilter: nf_tables: implement Passive OS fingerprint module in nft_osf") Signed-off-by: Fernando Fernandez Mancera --- net/netfilter/nft_osf.c | 10 ++ 1 file changed, 10 insertions(+) diff

Re: [iptables] extensions: Add tests and description for xt_quota module

2018-10-09 Thread Maciej Żenczykowski
Ah, yes, the (2**64 - 1) + 1 problem. The fact max allowed remaining is (2**64 - 2) is perhaps surprising... should we clamp? or warn? userspace has: if (cb->entry->id == O_REMAIN) info->remain++; should this error out in userspace if we end up at zero? +-m quota --quota 18446744073709551615

[iptables] extensions: Add tests and description for xt_quota module

2018-10-09 Thread Chenbo Feng
From: Chenbo Feng Introduces some iptables tests for the new --remain option in xt_quota module. Add a breif description for how to use the --remain option in the iptables-extension man page. Signed-off-by: Chenbo Feng --- extensions/libxt_quota.man | 4 extensions/libxt_quota.t | 11

[PATCH nf] netfilter: nft_compat: do not dump private area

2018-10-09 Thread Pablo Neira Ayuso
Zero pad private area, otherwise we expose private kernel pointer to userspace. This patch also zero the tail area after the ->matchsize and ->targetsize that results from XT_ALIGN(). Fixes: 0ca743a55991 ("netfilter: nf_tables: add compatibility layer for x_tables") Signed-off-by: Pablo Neira

[PATCH iptables] extensions: cgroup: fix option parsing for v2

2018-10-09 Thread Pablo Neira Ayuso
Structure layout is different, therefore a new struct xt_option_entry is needed. Fixes: f9efc8cb79c0 ("extensions: add cgroup revision 2") Signed-off-by: Pablo Neira Ayuso --- extensions/libxt_cgroup.c | 20 +++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git

Re: iptables (nf_tables) error when negating an interface and using protocol port - works fine with classic iptables

2018-10-09 Thread Florian Westphal
Pedretti Fabio wrote: > Hi, I tried iptables 1.8 with the new nf_tables back-end using the > Debian 1.8.0-1~exp1 package with my firewall script. > > It seems to properly load most rules, however I am getting an error > when negating an interface and using protocol ports, which works fine > with

iptables (nf_tables) error when negating an interface and using protocol port - works fine with classic iptables

2018-10-09 Thread Pedretti Fabio
Hi, I tried iptables 1.8 with the new nf_tables back-end using the Debian 1.8.0-1~exp1 package with my firewall script. It seems to properly load most rules, however I am getting an error when negating an interface and using protocol ports, which works fine with classic iptables. Specifically

Re: [PATCH nf-next] netfilter: nf_flow_table: remove flowtable hook flush routine in netns exit routine

2018-10-09 Thread Taehee Yoo
On Tue, 9 Oct 2018 at 08:19, Pablo Neira Ayuso wrote: > > Hi Taehee, > Hi Pablo, Thank you for your review! > I can reproduce it, so this is a bug :-). Still one question below: > > On Tue, Oct 02, 2018 at 02:17:14AM +0900, Taehee Yoo wrote: > [...] > > diff --git

Re: [PATCH nf-next] netfilter: nf_flow_table: remove flowtable hook flush routine in netns exit routine

2018-10-08 Thread Pablo Neira Ayuso
Hi Taehee, I can reproduce it, so this is a bug :-). Still one question below: On Tue, Oct 02, 2018 at 02:17:14AM +0900, Taehee Yoo wrote: [...] > diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c > index f0159eea2978..42487d01a3ed 100644 > ---

Re: [PATCH] nftables: add support for setting secmark

2018-10-08 Thread Pablo Neira Ayuso
On Thu, Sep 20, 2018 at 09:43:22AM +0200, Christian Göttsche wrote: > Add support for new nft object secmark holding security context strings. > > The following should demonstrate its usage (based on SELinux context): > > # define a tag containing a context string > nft add secmark inet

Re: [PATCH nf-next v3] nft_osf: Add ttl option support

2018-10-08 Thread Pablo Neira Ayuso
On Thu, Oct 04, 2018 at 02:17:53PM +0200, Fernando Fernandez Mancera wrote: > On 10/4/18 2:03 PM, Pablo Neira Ayuso wrote: > > On Thu, Oct 04, 2018 at 01:57:17PM +0200, Fernando Fernandez Mancera wrote: > > [...] > > > diff --git a/net/netfilter/nfnetlink_osf.c b/net/netfilter/nfnetlink_osf.c > >

[PATCH nf] netfilter: nf_flow_table: do not remove offload when other netns's interface is down

2018-10-08 Thread Taehee Yoo
When interface is down, offload cleanup function(nf_flow_table_do_cleanup) is called and that checks whether interface index of offload and index of link down interface is same. but only interface index checking is not enough because flowtable is not pernet list. So that, if other netns's

[PATCH nf-next] netfilter: nf_nat_snmp_basic: add missing helper alias name

2018-10-06 Thread Taehee Yoo
In order to upload helper module automatically, helper alias name is needed. so that MODULE_ALIAS_NFCT_HELPER() should be added. And unlike other nat helper modules, the nf_nat_snmp_basic can be used independently. helper name is "snmp_trap" so that alias name will be "nfct-helper-snmp_trap" by

[PATCH nf 1/2] netfilter: xt_TEE: fix wrong interface selection

2018-10-06 Thread Taehee Yoo
TEE netdevice notifier handler checks only interface name. however each netns can have same interface name. hence other netns's interface could be selected. test commands: %ip netns add vm1 %iptables -I INPUT -p icmp -j TEE --gateway 192.168.1.1 --oif enp2s0 %ip link set enp2s0 netns vm1

[PATCH nf 0/2] netfilter: xt_TEE: fix bugs in xt_TEE

2018-10-06 Thread Taehee Yoo
This patchset fix bugs in xt_TEE.c First patch fixes wrong interface selection. In the netdevice notifier handler of xt_TEE, other netns's interface could be selected. but that is wrong behaviour. Second patch adds missing code that finds interface's index(dev->ifindex) when rule is inserted.

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

2018-10-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 1/2] netfilter: ipt_CLUSTERIP: fix deadlock in netns exit routine

2018-10-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 0/2] netfilter: ipt_CLUSTERIP: fix bugs in ipt_CLUSTERIP

2018-10-05 Thread Taehee Yoo
This patchset fixes bug in ipt_CLUSTERIP when network namespace is destroyed. First patch fixes deadlock. Second patch removes wrong warning message. test commands: test commands: %ip netns add vm1 %ip netns exec vm1 bash %ip link set lo up %iptables -A INPUT -p tcp -i lo -d

Re: [PATCH nf-next v3] nft_osf: Add ttl option support

2018-10-04 Thread Fernando Fernandez Mancera
On 10/4/18 2:03 PM, Pablo Neira Ayuso wrote: On Thu, Oct 04, 2018 at 01:57:17PM +0200, Fernando Fernandez Mancera wrote: [...] diff --git a/net/netfilter/nfnetlink_osf.c b/net/netfilter/nfnetlink_osf.c index 00db27dfd2ff..e0fe1b8429ac 100644 --- a/net/netfilter/nfnetlink_osf.c +++

Re: [PATCH nf-next v3] nft_osf: Add ttl option support

2018-10-04 Thread Pablo Neira Ayuso
On Thu, Oct 04, 2018 at 01:57:17PM +0200, Fernando Fernandez Mancera wrote: [...] > diff --git a/net/netfilter/nfnetlink_osf.c b/net/netfilter/nfnetlink_osf.c > index 00db27dfd2ff..e0fe1b8429ac 100644 > --- a/net/netfilter/nfnetlink_osf.c > +++ b/net/netfilter/nfnetlink_osf.c > @@ -32,9 +32,7 @@

[PATCH nf-next v3] nft_osf: Add ttl option support

2018-10-04 Thread Fernando Fernandez Mancera
Add ttl option support to the nftables "osf" expression. Signed-off-by: Fernando Fernandez Mancera --- v1:initial patch v2:v2: code correctness and fix the "~" typo. v3:make priv->ttl = ttl; optional and priv->ttl default value is now 0. --- include/linux/netfilter/nfnetlink_osf.h | 3 ++-

Re: [PATCH nf-next v2] nft_osf: Add ttl option support

2018-10-04 Thread Pablo Neira Ayuso
On Thu, Oct 04, 2018 at 01:05:42PM +0200, Fernando Fernandez Mancera wrote: [...] > On 10/3/18 5:36 PM, Pablo Neira Ayuso wrote: [...] > > Better make this optional, ie. > > > > if (tb[NFTA_OSF_TTL]) { > > ttl = nla_get_u8(tb[NFTA_OSF_TTL]); > > if (ttl

Re: [PATCH nf-next v2] nft_osf: Add ttl option support

2018-10-04 Thread Fernando Fernandez Mancera
On 10/3/18 5:36 PM, Pablo Neira Ayuso wrote: Hi Fernando, A few comments. On Sat, Sep 29, 2018 at 12:18:51PM +0200, Fernando Fernandez Mancera wrote: Add ttl option support to the nftables "osf" expression. [..] if (!os_name) strncpy((char *)dest, "unknown",

Re: [nft PATCH] parser_bison: Fix for ECN keyword in LHS of relational

2018-10-03 Thread Pablo Neira Ayuso
On Fri, Aug 24, 2018 at 01:26:57PM +0200, Phil Sutter wrote: > Of all possible TCP flags, 'ecn' is special since it is recognized by > lex as a keyword (there is a a field in IPv4 and IPv6 headers with the > same name). Therefore it is listed in keyword_expr, but that was > sufficient for RHS

Re: [nft PATCH] parser_bison: Fix for ECN keyword in LHS of relational

2018-10-03 Thread Pablo Neira Ayuso
Hi Phil, On Wed, Oct 03, 2018 at 09:00:51PM +0200, Phil Sutter wrote: > On Wed, Oct 03, 2018 at 05:28:24PM +0200, Pablo Neira Ayuso wrote: > > On Fri, Aug 24, 2018 at 01:26:57PM +0200, Phil Sutter wrote: > > > Of all possible TCP flags, 'ecn' is special since it is recognized by > > > lex as a

Re: [nft PATCH] parser_bison: Fix for ECN keyword in LHS of relational

2018-10-03 Thread Phil Sutter
Hi Pablo, On Wed, Oct 03, 2018 at 05:28:24PM +0200, Pablo Neira Ayuso wrote: > On Fri, Aug 24, 2018 at 01:26:57PM +0200, Phil Sutter wrote: > > Of all possible TCP flags, 'ecn' is special since it is recognized by > > lex as a keyword (there is a a field in IPv4 and IPv6 headers with the > > same

[PATCH nft 2/4] src: get rid of netlink_genid_get()

2018-10-03 Thread Pablo Neira Ayuso
Signed-off-by: Pablo Neira Ayuso --- include/netlink.h | 1 - src/netlink.c | 5 - src/rule.c| 5 +++-- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/include/netlink.h b/include/netlink.h index d153e2be03ac..4925af04a707 100644 --- a/include/netlink.h +++

[PATCH nft 0/4] assorted updates

2018-10-03 Thread Pablo Neira Ayuso
Hi, A bunch of assorted updates: 1) Remove json code, we have better support these days in libnftables. So we can deprecate the existing code in libnftnl. 2) Peel off the netlink layer sitting between the command and mnl layers. This is just preparation works for the extended error

[PATCH nft 4/4] mnl: remove alloc_nftnl_chain()

2018-10-03 Thread Pablo Neira Ayuso
The netlink layer sits in between the mnl and the rule layers, remove it. We can remove alloc_nftnl_chain() and consolidate infrastructure in the src/mnl.c file. Signed-off-by: Pablo Neira Ayuso --- include/mnl.h | 10 +++--- include/netlink.h | 8 - src/mnl.c | 98

[PATCH nft 1/4] netlink: remove markup json parsing code

2018-10-03 Thread Pablo Neira Ayuso
We have better json support these days, remove libnftnl json support. Signed-off-by: Pablo Neira Ayuso --- src/netlink.c | 276 +- 1 file changed, 2 insertions(+), 274 deletions(-) diff --git a/src/netlink.c b/src/netlink.c index

[PATCH nft 3/4] mnl: remove alloc_nftnl_table()

2018-10-03 Thread Pablo Neira Ayuso
The netlink layer sits in between the mnl and the rule layers, remove it. We can remove alloc_nftnl_table() and consolidate infrastructure in the src/mnl.c file. Signed-off-by: Pablo Neira Ayuso --- include/mnl.h | 9 + include/netlink.h | 7 --- src/mnl.c | 55

Re: [nft PATCH] parser_bison: Fix for ECN keyword in LHS of relational

2018-10-03 Thread Pablo Neira Ayuso
On Wed, Oct 03, 2018 at 05:28:24PM +0200, Pablo Neira Ayuso wrote: [...] > On Fri, Aug 24, 2018 at 01:26:57PM +0200, Phil Sutter wrote: > > diff --git a/tests/py/inet/tcp.t b/tests/py/inet/tcp.t > > index d66ba8438a32f..f96e3634f41ed 100644 > > --- a/tests/py/inet/tcp.t > > +++

Re: [PATCH nf-next v2] nft_osf: Add ttl option support

2018-10-03 Thread Pablo Neira Ayuso
Hi Fernando, A few comments. On Sat, Sep 29, 2018 at 12:18:51PM +0200, Fernando Fernandez Mancera wrote: > Add ttl option support to the nftables "osf" expression. > > Signed-off-by: Fernando Fernandez Mancera > --- > v1: initial patch > v2: code correctness and fix the "~" typo. > --- >

Re: [nft PATCH] parser_bison: Fix for ECN keyword in LHS of relational

2018-10-03 Thread Pablo Neira Ayuso
Hi Phil, On Fri, Aug 24, 2018 at 01:26:57PM +0200, Phil Sutter wrote: > Of all possible TCP flags, 'ecn' is special since it is recognized by > lex as a keyword (there is a a field in IPv4 and IPv6 headers with the > same name). Therefore it is listed in keyword_expr, but that was > sufficient

[PATCH nft] segtree: stop iteration on existing elements in case closing range is found

2018-10-03 Thread Pablo Neira Ayuso
No need to keep iterating once the range object has been allocated. Signed-off-by: Pablo Neira Ayuso --- src/segtree.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/segtree.c b/src/segtree.c index dc2554b72acf..dc457d6bc1b7 100644 --- a/src/segtree.c +++

[PATCH nft] rule: fix memleak in do_get_setelems()

2018-10-03 Thread Pablo Neira Ayuso
Release set and elements in case of error. Signed-off-by: Pablo Neira Ayuso --- src/rule.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/rule.c b/src/rule.c index e6d61b670688..6d027c261f97 100644 --- a/src/rule.c +++ b/src/rule.c @@ -2190,17 +2190,15 @@ static

Re: [nft PATCH] tests: shell: Test 'get element' command

2018-10-03 Thread Pablo Neira Ayuso
On Fri, Sep 28, 2018 at 06:17:31PM +0200, Phil Sutter wrote: > This command is currently broken when used in sets with ranges. Test > various variants against known data and check if output is as expected. Applied, thanks.

[PATCH nft] segtree: memleak in get_set_decompose()

2018-10-03 Thread Pablo Neira Ayuso
Release set content on error. Moreover, release input set content in case we finally manage to decompose it. Signed-off-by: Pablo Neira Ayuso --- src/segtree.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/segtree.c b/src/segtree.c index 0d53c83fd837..dc2554b72acf 100644 ---

[PATCH nft] segtree: disantangle get_set_interval_end()

2018-10-03 Thread Pablo Neira Ayuso
This function overrides the left pointer. Instead update this function to return the range that we found to enclose the left element. Note that we may not find a closing right element - therefore, it is a standalone element - in that case this function returns NULL. Reported-by: Phil Sutter

Re: [PATCH nft] doc: Document ct timeout support

2018-10-02 Thread Pablo Neira Ayuso
Hi Harsha, On Wed, Sep 05, 2018 at 12:21:16AM +0530, Harsha Sharma wrote: [...] > diff --git a/doc/stateful-objects.txt b/doc/stateful-objects.txt > index 83a2575..120673d 100644 > --- a/doc/stateful-objects.txt > +++ b/doc/stateful-objects.txt > @@ -1,4 +1,4 @@ > -CT > +CT HELPER > ~~ This

Re: [PATCH] netfilter: ipset: export indexes via netlink

2018-10-01 Thread Jozsef Kadlecsik
Hi, On Mon, 1 Oct 2018, Florent Fourcot wrote: > Do you have any news on this topic? Can I help you to move forward for > inclusion? Sorry for the extremely long delay: I have been working on the userspace library and it still needs a couple of days. There'll be a new release in the first

[PATCH nf-next] netfilter: nf_flow_table: remove flowtable hook flush routine in netns exit routine

2018-10-01 Thread Taehee Yoo
When device is unregistered, flowtable flush routine is called by notifier_call(nf_tables_flowtable_event). and exit callback of nftables pernet_operation(nf_tables_exit_net) also has flowtable flush routine. but when network namespace is destroyed, both notifier_call and pernet_operation are

[PATCH nf] netfilter: nft_set_rbtree: allow loose matching of closing intervals

2018-10-01 Thread Pablo Neira Ayuso
Allow to find closest matching for the right side of an interval (end flag set on) so we allow lookups for inner ranges lookup, eg. 10-20 in 5-25. Fixes: ba0e4d9917b4 ("netfilter: nf_tables: get set elements via netlink") Reported-by: Phil Sutter Signed-off-by: Pablo Neira Ayuso --- @Phil: You

[PATCH nft] segtree: bogus range via get set element on existing elements

2018-10-01 Thread Pablo Neira Ayuso
table ip x { set y { type inet_service flags interval elements = { 10, 20-30, 40, 50-60 } } } # nft get element x y { 20-40 } table ip x { set y { type inet_service flags interval

Re: [PATCH nft] include: add missing xfrm.h to Makefile.am

2018-09-30 Thread Florian Westphal
Fernando Fernandez Mancera wrote: > @@ -31,4 +31,5 @@ noinst_HEADERS =cli.h \ > rule.h \ > rt.h\ > utils.h \ > + xfrm.h \ > xt.h

[PATCH nft] include: add missing xfrm.h to Makefile.am

2018-09-30 Thread Fernando Fernandez Mancera
Signed-off-by: Fernando Fernandez Mancera --- include/Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/include/Makefile.am b/include/Makefile.am index d3a677d..c103f48 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -31,4 +31,5 @@ noinst_HEADERS = cli.h

Re: [PATCH 2/2 nft] doc: osf: add ttl option to man page

2018-09-30 Thread Fernando Fernandez Mancera
Sorry, I have forgotten to add "Signed-off-by: Fernando Fernandez Mancera ". Thanks. On 9/29/18 12:15 PM, Fernando Fernandez Mancera wrote: --- doc/primary-expression.txt | 20 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/doc/primary-expression.txt

[PATCH nf-next v2] nft_osf: Add ttl option support

2018-09-29 Thread Fernando Fernandez Mancera
Add ttl option support to the nftables "osf" expression. Signed-off-by: Fernando Fernandez Mancera --- v1: initial patch v2: code correctness and fix the "~" typo. --- include/linux/netfilter/nfnetlink_osf.h | 3 ++- include/uapi/linux/netfilter/nf_tables.h | 7 +++

[PATCH libnftnl] expr: osf: add ttl option support

2018-09-29 Thread Fernando Fernandez Mancera
Signed-off-by: Fernando Fernandez Mancera --- include/libnftnl/expr.h | 1 + include/linux/netfilter/nf_tables.h | 4 +++- src/expr/osf.c | 26 +- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/include/libnftnl/expr.h

[PATCH 2/2 nft] doc: osf: add ttl option to man page

2018-09-29 Thread Fernando Fernandez Mancera
--- doc/primary-expression.txt | 20 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/doc/primary-expression.txt b/doc/primary-expression.txt index 0fda76d..92dd89a 100644 --- a/doc/primary-expression.txt +++ b/doc/primary-expression.txt @@ -187,18 +187,30 @@

[PATCH 1/2 nft v2] src: osf: add ttl option support

2018-09-29 Thread Fernando Fernandez Mancera
Add support for ttl option in "osf" expression. Example: table ip foo { chain bar { type filter hook input priority filter; policy accept; osf ttl nocheck name "Linux" } } Signed-off-by: Fernando Fernandez Mancera --- v1: initial patch v2: use

[nft PATCH] tests: shell: Test 'get element' command

2018-09-28 Thread Phil Sutter
This command is currently broken when used in sets with ranges. Test various variants against known data and check if output is as expected. Signed-off-by: Phil Sutter --- tests/shell/testcases/sets/0034get_element_0 | 37 1 file changed, 37 insertions(+) create mode

Re: [PATCH nf] netfilter: nft_set_rbtree: add missing rb_erase() in GC routine

2018-09-28 Thread Pablo Neira Ayuso
Applied, thanks.

Re: [PATCH nf] netfilter: avoid erronous array bounds warning

2018-09-28 Thread Pablo Neira Ayuso
On Mon, Sep 24, 2018 at 02:10:04PM +0200, Florian Westphal wrote: > Unfortunately some versions of gcc emit following warning: > $ make net/xfrm/xfrm_output.o > linux/compiler.h:252:20: warning: array subscript is above array bounds > [-Warray-bounds] > hook_head =

Re: [PATCH nf-next] netfilter: nf_flow_table: remove unnecessary nat flag check code

2018-09-28 Thread Pablo Neira Ayuso
On Tue, Sep 25, 2018 at 12:38:28AM +0900, Taehee Yoo wrote: > nf_flow_offload_{ip/ipv6}_hook() check nat flag then, call > nf_flow_nat_{ip/ipv6} but that also check nat flag. so that > nat flag check code in nf_flow_offload_{ip/ipv6}_hook() are unnecessary. Applied, thanks Taehee.

Re: [PATCH nf-next] netfilter: nf_tables: use rhashtable_lookup() instead of rhashtable_lookup_fast()

2018-09-28 Thread Pablo Neira Ayuso
On Tue, Sep 25, 2018 at 12:39:27AM +0900, Taehee Yoo wrote: > Internally, rhashtable_lookup_fast() calls rcu_read_lock() then, > calls rhashtable_lookup(). so that in places where are guaranteed > by rcu read lock, rhashtable_lookup() is enough. Also applied, thanks.

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