netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] netfilter: nf_queue:fix reinject verdict handling
@ 2019-05-08 18:31 Jagdish Motwani
  2019-05-13  9:22 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 4+ messages in thread
From: Jagdish Motwani @ 2019-05-08 18:31 UTC (permalink / raw)
  To: netdev
  Cc: j.k.motwani, Jagdish Motwani, Pablo Neira Ayuso,
	Jozsef Kadlecsik, Florian Westphal, David S. Miller,
	netfilter-devel, coreteam, linux-kernel

From: Jagdish Motwani <jagdish.motwani@sophos.com>

In case of more than 1 nf_queues, hooks between them are being executed
more than once.

Signed-off-by: Jagdish Motwani <jagdish.motwani@sophos.com>
---
 net/netfilter/nf_queue.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/netfilter/nf_queue.c b/net/netfilter/nf_queue.c
index 9dc1d6e..b5b2be5 100644
--- a/net/netfilter/nf_queue.c
+++ b/net/netfilter/nf_queue.c
@@ -255,6 +255,7 @@ static unsigned int nf_iterate(struct sk_buff *skb,
 repeat:
 		verdict = nf_hook_entry_hookfn(hook, skb, state);
 		if (verdict != NF_ACCEPT) {
+			*index = i;
 			if (verdict != NF_REPEAT)
 				return verdict;
 			goto repeat;
-- 
2.9.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net] netfilter: nf_queue:fix reinject verdict handling
  2019-05-08 18:31 [PATCH net] netfilter: nf_queue:fix reinject verdict handling Jagdish Motwani
@ 2019-05-13  9:22 ` Pablo Neira Ayuso
  2019-05-13 10:36   ` Jagdish Motwani
  0 siblings, 1 reply; 4+ messages in thread
From: Pablo Neira Ayuso @ 2019-05-13  9:22 UTC (permalink / raw)
  To: Jagdish Motwani
  Cc: netdev, Jagdish Motwani, Jozsef Kadlecsik, Florian Westphal,
	David S. Miller, netfilter-devel, coreteam, linux-kernel

Hi Jagdish,

On Thu, May 09, 2019 at 12:01:14AM +0530, Jagdish Motwani wrote:
> From: Jagdish Motwani <jagdish.motwani@sophos.com>
> 
> In case of more than 1 nf_queues, hooks between them are being executed
> more than once.

This refers to NF_REPEAT, correct?

I think this broke with 960632ece6949. If so, it would be good to add
the following tag to this patch then. It's useful for robots
collecting fixes for -stable kernels.

Fixes: 960632ece694 ("netfilter: convert hook list to an array")

> Signed-off-by: Jagdish Motwani <jagdish.motwani@sophos.com>

Thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH net] netfilter: nf_queue:fix reinject verdict handling
  2019-05-13  9:22 ` Pablo Neira Ayuso
@ 2019-05-13 10:36   ` Jagdish Motwani
  2019-05-13 10:40     ` Pablo Neira Ayuso
  0 siblings, 1 reply; 4+ messages in thread
From: Jagdish Motwani @ 2019-05-13 10:36 UTC (permalink / raw)
  To: Pablo Neira Ayuso, Jagdish Motwani
  Cc: netdev, Jozsef Kadlecsik, Florian Westphal, David S. Miller,
	netfilter-devel, coreteam, linux-kernel

Hi Pablo,

The case I am referring to is : If there are more than 1  hooks returning NF_QUEUE verdict.
When the first queue reinjects the packet, 'nf_reinject' starts traversing hooks with hook_index (i).
However if it again receives a NF_QUEUE verdict (by some other netfilter hook), it queue with the wrong hook_index.
So, when the second queue reinjects the packet, it re-executes some hooks in between the first 2 hooks.

Thanks, I will mark :  Fixes: 960632ece694 ("netfilter: convert hook list to an array") and update the description also.

Regards,
Jagdish
-----Original Message-----
From: Pablo Neira Ayuso <pablo@netfilter.org>
Sent: Monday, May 13, 2019 2:52 PM
To: Jagdish Motwani <j.k.motwani@gmail.com>
Cc: netdev@vger.kernel.org; Jagdish Motwani <Jagdish.Motwani@Sophos.com>; Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>; Florian Westphal <fw@strlen.de>; David S. Miller <davem@davemloft.net>; netfilter-devel@vger.kernel.org; coreteam@netfilter.org; linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] netfilter: nf_queue:fix reinject verdict handling

Hi Jagdish,


On Thu, May 09, 2019 at 12:01:14AM +0530, Jagdish Motwani wrote:
> From: Jagdish Motwani <jagdish.motwani@sophos.com>
>
> In case of more than 1 nf_queues, hooks between them are being
> executed more than once.

This refers to NF_REPEAT, correct?

I think this broke with 960632ece6949. If so, it would be good to add the following tag to this patch then. It's useful for robots collecting fixes for -stable kernels.

Fixes: 960632ece694 ("netfilter: convert hook list to an array")

> Signed-off-by: Jagdish Motwani <jagdish.motwani@sophos.com>

Thanks.

________________________________

Sophos Technologies Private Limited Regd. Office: Sophos House, Saigulshan Complex, Beside White House, Panchvati Cross Road, Ahmedabad - 380006, Gujarat, India CIN: U72200GJ2006PTC047857

Sophos Ltd, a company registered in England and Wales number 2096520, The Pentagon, Abingdon Science Park, Abingdon, OX14 3YP, United Kingdom.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] netfilter: nf_queue:fix reinject verdict handling
  2019-05-13 10:36   ` Jagdish Motwani
@ 2019-05-13 10:40     ` Pablo Neira Ayuso
  0 siblings, 0 replies; 4+ messages in thread
From: Pablo Neira Ayuso @ 2019-05-13 10:40 UTC (permalink / raw)
  To: Jagdish Motwani
  Cc: Jagdish Motwani, netdev, Jozsef Kadlecsik, Florian Westphal,
	David S. Miller, netfilter-devel, coreteam, linux-kernel

On Mon, May 13, 2019 at 10:36:51AM +0000, Jagdish Motwani wrote:
> Hi Pablo,
> 
> The case I am referring to is : If there are more than 1  hooks
> returning NF_QUEUE verdict.  When the first queue reinjects the
> packet, 'nf_reinject' starts traversing hooks with hook_index (i).
> However if it again receives a NF_QUEUE verdict (by some other
> netfilter hook), it queue with the wrong hook_index.  So, when the
> second queue reinjects the packet, it re-executes some hooks in
> between the first 2 hooks.

Please, include this description in the patch. And thanks for
explaining.

> Thanks, I will mark :  Fixes: 960632ece694 ("netfilter: convert hook list to an array") and update the description also.

Thanks, will wait for v2.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-05-13 10:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-08 18:31 [PATCH net] netfilter: nf_queue:fix reinject verdict handling Jagdish Motwani
2019-05-13  9:22 ` Pablo Neira Ayuso
2019-05-13 10:36   ` Jagdish Motwani
2019-05-13 10:40     ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).