[PATCH libmnl] nlmsg: Improve payload printing

2016-06-08 Thread Carlos Falgueras García
It make more sense to use "isprint" than "isalnum" because we use non alphanumeric characters like '%', '_', etc. And, in case of non printable character, print a space is preferable to print a NULL (0) in order to keep alignment. Before: ... |00012|--|2||len |flags| type| | 5f 5f 73 6

Re: [PATCH v2 libnftnl] Check all strdup

2016-06-08 Thread Pablo Neira Ayuso
On Tue, Jun 07, 2016 at 05:08:10PM +0200, Pablo Neira Ayuso wrote: > Carlos, > > On Tue, May 31, 2016 at 12:08:32PM +0200, Carlos Falgueras García wrote: > > Check all strdup possible error and treat it consequently. > > Please, manually apply these two patches in your local working copy: > > ht

Re: [PATCH v2 libnftnl] Check all strdup

2016-06-08 Thread Florian Westphal
Pablo Neira Ayuso wrote: > + if (attr > NFTNL_CHAIN_MAX) { > + errno = -EOPNOTSUPP; The negation should be dropped. -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vg

Re: [PATCH v2 libnftnl] Check all strdup

2016-06-08 Thread Pablo Neira Ayuso
On Wed, Jun 08, 2016 at 01:37:41PM +0200, Florian Westphal wrote: > Pablo Neira Ayuso wrote: > > + if (attr > NFTNL_CHAIN_MAX) { > > + errno = -EOPNOTSUPP; > > The negation should be dropped. Right, this should be: errno = EOPNOTSUPP; -- To unsubscribe from this list

Re: [PATCH 1/3] bridge: netfilter: checkpatch whitespace fixes

2016-06-08 Thread Pablo Neira Ayuso
On Tue, Jun 07, 2016 at 11:02:30AM -0700, Joe Perches wrote: > On Tue, 2016-06-07 at 19:34 +0200, Pablo Neira Ayuso wrote: > > On Tue, Jun 07, 2016 at 10:04:40AM -0700, Joe Perches wrote: > > > One more question, is this chunk below correct from > > > coding style point of view? > > > > if

Re: [PATCH] netfilter/nflog: nflog-range does not truncate packets

2016-06-08 Thread Pablo Neira Ayuso
On Tue, Jun 07, 2016 at 07:06:15PM -0400, Vishwanath Pai wrote: > On 06/06/2016 06:31 PM, Pablo Neira Ayuso wrote: > > On Wed, Jun 01, 2016 at 08:23:54PM -0400, Vishwanath Pai wrote: > >> netfilter/nflog: nflog-range does not truncate packets > >> > >> The --nflog-range parameter from userspace is

[PATCH nf-next] netfilter: nft_meta: set skb->nf_trace appropriately

2016-06-08 Thread Liping Zhang
From: Liping Zhang When user add a nft rule to set nftrace to zero, for example: # nft add rule ip filter input nftrace set 0 We should set nf_trace to zero also. Signed-off-by: Liping Zhang --- net/netfilter/nft_meta.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net

[PATCH nf-next] netfilter: xt_cpu: no need to check the validity of invert flag

2016-06-08 Thread Liping Zhang
From: Liping Zhang Instead, we can convert invert flag and ensure it is 1 or 0. Signed-off-by: Liping Zhang --- net/netfilter/xt_cpu.c | 12 +--- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/net/netfilter/xt_cpu.c b/net/netfilter/xt_cpu.c index c7a2e54..ca1eaaf 100644

[PATCH nf-next 1/4] netfilter: nf_log: handle NFPROTO_INET properly in nf_logger_[find_get|put]

2016-06-08 Thread Liping Zhang
From: Liping Zhang When we request NFPROTO_INET, it means both NFPROTO_IPV4 and NFPROTO_IPV6. Signed-off-by: Liping Zhang --- net/netfilter/nf_log.c | 20 1 file changed, 20 insertions(+) diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c index a5d41df..73b845d

[PATCH nf-next 0/4] netfilter: request related nf_log module when we add TRACE rule

2016-06-08 Thread Liping Zhang
From: Liping Zhang This patch set solve such problem, for example, if we add a following iptables rule: # iptables -t raw -I PREROUTING -j TRACE And nf_log_ipv4 kernel module is not installed, no trace log will be generated, until we install the nf_log_ipv4 module manully. This is not friendly

[PATCH nf-next 4/4] netfilter: nft_meta: add explicitly nf_logger_find_get call

2016-06-08 Thread Liping Zhang
From: Liping Zhang Like xt_TRACE do, we should request related nf_log module appropriately. Otherwise, if the nf_log_ipv4 kernel module is not installed, and the user add the following nft rule: # nft add rule filter input nftrace set 1 There will be no trace log generated until we install nf_

[PATCH nf-next 2/4] netfilter: nft_log: no need to deal with NFPROTO_INET family

2016-06-08 Thread Liping Zhang
From: Liping Zhang Since nf_logger_find_get and nf_logger_put can handle NFPROTO_INET properly, we can remove the special process logic now. Signed-off-by: Liping Zhang --- net/netfilter/nft_log.c | 21 + 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/net/net

[PATCH nf-next 3/4] netfilter: xt_TRACE: add explicitly nf_logger_find_get call

2016-06-08 Thread Liping Zhang
From: Liping Zhang Consider such situation, if nf_log_ipv4 kernel module is not installed, and the user add a following iptables rule: # iptables -t raw -I PREROUTING -j TRACE There will be no trace log generated until the user install nf_log_ipv4 module manully. So we should add request relat

[PATCH iptables] extensions: libxt_TRACE: Add translation to nft

2016-06-08 Thread Liping Zhang
From: Liping Zhang For example: # iptables-translate -t raw -A PREROUTING -j TRACE nft add rule ip raw PREROUTING counter nftrace set 1 Signed-off-by: Liping Zhang --- extensions/libxt_TRACE.c | 8 1 file changed, 8 insertions(+) diff --git a/extensions/libxt_TRACE.c b/extension

Re: [PATCH nf-next 4/4] netfilter: nft_meta: add explicitly nf_logger_find_get call

2016-06-08 Thread Florian Westphal
Liping Zhang wrote: > From: Liping Zhang > > Like xt_TRACE do, we should request related nf_log module appropriately. > Otherwise, if the nf_log_ipv4 kernel module is not installed, and the > user add the following nft rule: > # nft add rule filter input nftrace set 1 > > There will be no tra

Re: [PATCH nf-next 3/4] netfilter: xt_TRACE: add explicitly nf_logger_find_get call

2016-06-08 Thread Florian Westphal
Liping Zhang wrote: > From: Liping Zhang > > Consider such situation, if nf_log_ipv4 kernel module is not installed, > and the user add a following iptables rule: > # iptables -t raw -I PREROUTING -j TRACE > > There will be no trace log generated until the user install nf_log_ipv4 > module ma

Re: [PATCH iptables] extensions: libxt_TRACE: Add translation to nft

2016-06-08 Thread Pablo Neira Ayuso
On Wed, Jun 08, 2016 at 08:47:03PM +0800, Liping Zhang wrote: > From: Liping Zhang > > For example: > > # iptables-translate -t raw -A PREROUTING -j TRACE > nft add rule ip raw PREROUTING counter nftrace set 1 Applied, thanks. -- To unsubscribe from this list: send the line "unsubscribe net

Netfilter/Suricata user day on 27th June in Amsterdam, Netherlands

2016-06-08 Thread Pablo Neira Ayuso
Hi! We are organizing a public user day at the Vrije Universiteit (VU) Amsterdam on June 27th 2016. This day is titled "Suricata meets Netfilter" and brings talks about the Linux Netfilter/nftables Firewall project and the Suricata IDS/IPS project. Keynote will be delivered by Linux NetDev mainta

Re: [PATCH 1/3] bridge: netfilter: checkpatch whitespace fixes

2016-06-08 Thread Joe Perches
On Wed, 2016-06-08 at 13:52 +0200, Pablo Neira Ayuso wrote: > On Tue, Jun 07, 2016 at 11:02:30AM -0700, Joe Perches wrote: > > On Tue, 2016-06-07 at 19:34 +0200, Pablo Neira Ayuso wrote: > > > On Tue, Jun 07, 2016 at 10:04:40AM -0700, Joe Perches wrote: > > > > One more question, is this chunk belo

Re: [PATCH 1/3] bridge: netfilter: checkpatch whitespace fixes

2016-06-08 Thread Pablo Neira Ayuso
On Wed, Jun 08, 2016 at 09:52:30AM -0700, Joe Perches wrote: > On Wed, 2016-06-08 at 13:52 +0200, Pablo Neira Ayuso wrote: > > On Tue, Jun 07, 2016 at 11:02:30AM -0700, Joe Perches wrote: > > > On Tue, 2016-06-07 at 19:34 +0200, Pablo Neira Ayuso wrote: > > > > On Tue, Jun 07, 2016 at 10:04:40AM -0

Re: [PATCH 1/3] bridge: netfilter: checkpatch whitespace fixes

2016-06-08 Thread Pablo Neira Ayuso
On Wed, Jun 08, 2016 at 07:31:21PM +0200, Pablo Neira Ayuso wrote: > Then you can follow up with a patch to add this function. > > Just a suggestion, let me know if this is fine with you. Forget this idea. Actually your patch from: Date: Tue, 07 Jun 2016 11:02:30 -0700 looks easier to readable

[PATCHv4] extensions: libip6t_frag: Add translation to nft

2016-06-08 Thread Laura Garcia Liebana
Add translation for frag to nftables. According to the --fraglen code: case O_FRAGLEN: /* * As of Linux 3.0, the kernel does not check for * fraglen at all. */ In addition, the kernel code doesn't show any reference to the

[PATCH v2] iptables: extensions: libxt_MARK: Add translation to nft

2016-06-08 Thread Roberto García
Add translation for the MARK target to nftables. Examples: $ sudo iptables-translate -t mangle -A OUTPUT -j MARK --set-mark 64 nft add rule ip mangle OUTPUT counter meta mark set 0x40 $ sudo iptables-translate -t mangle -A OUTPUT -j MARK --set-xmark 0x40/0x32 nft add rule ip mangle OUTPUT cou