Re: [PATCH nf-next,RFC 08/10] netfilter: move NF_QUEUE handling away from core

2016-10-14 Thread Pablo Neira Ayuso
On Fri, Oct 14, 2016 at 06:47:20PM +0200, Pablo Neira Ayuso wrote: > On Fri, Oct 14, 2016 at 05:38:12PM +0200, Florian Westphal wrote: > > Pablo Neira Ayuso wrote: > > > On Fri, Oct 14, 2016 at 04:06:15PM +0800, Liping Zhang wrote: > > > > Hi Pablo, > > > > > > > > 2016-10-13 20:02 GMT+08:00 Pablo

Re: [PATCH nf-next,RFC 08/10] netfilter: move NF_QUEUE handling away from core

2016-10-14 Thread Pablo Neira Ayuso
On Fri, Oct 14, 2016 at 05:38:12PM +0200, Florian Westphal wrote: > Pablo Neira Ayuso wrote: > > On Fri, Oct 14, 2016 at 04:06:15PM +0800, Liping Zhang wrote: > > > Hi Pablo, > > > > > > 2016-10-13 20:02 GMT+08:00 Pablo Neira Ayuso : > > > > +int nf_queue(struct sk_buff *skb, const struct nf_hook_

Re: [PATCH nf-next,RFC 08/10] netfilter: move NF_QUEUE handling away from core

2016-10-14 Thread Florian Westphal
Pablo Neira Ayuso wrote: > On Fri, Oct 14, 2016 at 04:06:15PM +0800, Liping Zhang wrote: > > Hi Pablo, > > > > 2016-10-13 20:02 GMT+08:00 Pablo Neira Ayuso : > > > +int nf_queue(struct sk_buff *skb, const struct nf_hook_state *state, > > > +unsigned int queuenum, bool bypass) > > > +{

Re: [PATCH nf-next,RFC 08/10] netfilter: move NF_QUEUE handling away from core

2016-10-14 Thread Pablo Neira Ayuso
On Fri, Oct 14, 2016 at 11:53:30AM +0200, Pablo Neira Ayuso wrote: [...] > BTW, looking at ipt_mangle_out(): > > ret = ipt_do_table(skb, state, state->net->ipv4.iptable_mangle); > /* Reroute for ANY change. */ > if (ret != NF_DROP && ret != NF_STOLEN) { > i

Re: [PATCH nf-next,RFC 08/10] netfilter: move NF_QUEUE handling away from core

2016-10-14 Thread Pablo Neira Ayuso
On Fri, Oct 14, 2016 at 04:06:15PM +0800, Liping Zhang wrote: > Hi Pablo, > > 2016-10-13 20:02 GMT+08:00 Pablo Neira Ayuso : > > +int nf_queue(struct sk_buff *skb, const struct nf_hook_state *state, > > +unsigned int queuenum, bool bypass) > > +{ > > + int ret; > > + > > + r

Re: [PATCH nf-next,RFC 08/10] netfilter: move NF_QUEUE handling away from core

2016-10-14 Thread Liping Zhang
Hi Pablo, 2016-10-13 20:02 GMT+08:00 Pablo Neira Ayuso : > +int nf_queue(struct sk_buff *skb, const struct nf_hook_state *state, > +unsigned int queuenum, bool bypass) > +{ > + int ret; > + > + ret = __nf_queue(skb, state, queuenum); > + if (ret < 0) { > +

Re: [PATCH nf-next,RFC 08/10] netfilter: move NF_QUEUE handling away from core

2016-10-13 Thread Pablo Neira Ayuso
On Thu, Oct 13, 2016 at 02:38:21PM +0200, Florian Westphal wrote: > Pablo Neira Ayuso wrote: [...] > > diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c > > index de4fa03f46f3..7040842c34f4 100644 > > --- a/net/ipv4/netfilter/ip_tables.c > > +++ b/net/ipv4/netfilter/ip_t

Re: [PATCH nf-next,RFC 08/10] netfilter: move NF_QUEUE handling away from core

2016-10-13 Thread Florian Westphal
Pablo Neira Ayuso wrote: > > Any reason why this is needed? > > AFAICS xt_NFQUEUE will never return NF_QUEUE after this patch. > > -j QUEUE uses the standard target to return NF_QUEUE. This is very > primitive way to queue packets to userspace queue 0 via nf_queue, but > still may break. I can pl

Re: [PATCH nf-next,RFC 08/10] netfilter: move NF_QUEUE handling away from core

2016-10-13 Thread Florian Westphal
Pablo Neira Ayuso wrote: > Export a new nf_queue() function that translates the NF_QUEUE verdict > depending on the scenario: > > 1) Drop packet if queue is full. > 2) Accept packet if bypass is enabled. > 3) Return stolen if packet is enqueued. > > We can call this function from xt_NFQUEUE and

[PATCH nf-next,RFC 08/10] netfilter: move NF_QUEUE handling away from core

2016-10-13 Thread Pablo Neira Ayuso
Export a new nf_queue() function that translates the NF_QUEUE verdict depending on the scenario: 1) Drop packet if queue is full. 2) Accept packet if bypass is enabled. 3) Return stolen if packet is enqueued. We can call this function from xt_NFQUEUE and nft_queue. Thus, we move packet queuing to

[PATCH nf-next,RFC 08/10] netfilter: move NF_QUEUE handling away from core

2016-10-13 Thread Pablo Neira Ayuso
Export a new nf_queue() function that translates the NF_QUEUE verdict depending on the scenario: 1) Drop packet if queue is full. 2) Accept packet if bypass is enabled. 3) Return stolen if packet is enqueued. We can call this function from xt_NFQUEUE and nft_queue. Thus, we move packet queuing to