netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fix conntrack reassembly expire code
@ 2012-12-07  9:42 haibbo
  2012-12-11  1:50 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 3+ messages in thread
From: haibbo @ 2012-12-07  9:42 UTC (permalink / raw)
  To: pablo, kaber, netfilter-devel, netfilter, coreteam; +Cc: Haibo Xi

From: Haibo Xi <haibbo@gmail.com>

Commit b836c99fd6c9 (ipv6: unify conntrack reassembly expire
code with standard one) use the standard IPv6 reassembly
code(ip6_expire_frag_queue) to handle conntrack reassembly expire.

In ip6_expire_frag_queue, it invoke dev_get_by_index_rcu to get
which device received this expired packet.so we must save ifindex
when NF_conntrack get this packet.

With this patch applied, I can see ICMP Time Exceeded sent
from the receiver when the sender sent out 1/2 fragmented
IPv6 packet.

Signed-off-by: Haibo Xi <haibbo@gmail.com>
---
 net/ipv6/netfilter/nf_conntrack_reasm.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
index 22c8ea9..e7197be 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -196,6 +196,7 @@ static int nf_ct_frag6_queue(struct frag_queue *fq, struct sk_buff *skb,
 	struct sk_buff *prev, *next;
 	unsigned int payload_len;
 	int offset, end;
+	struct net_device *dev = NULL;
 
 	if (fq->q.last_in & INET_FRAG_COMPLETE) {
 		pr_debug("Already completed\n");
@@ -311,7 +312,11 @@ found:
 	else
 		fq->q.fragments = skb;
 
-	skb->dev = NULL;
+	dev = skb->dev;
+	if (dev) {
+		fq->iif = dev->ifindex;
+		skb->dev = NULL;
+	}
 	fq->q.stamp = skb->tstamp;
 	fq->q.meat += skb->len;
 	if (payload_len > fq->q.max_size)
-- 
1.7.0.4


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

* Re: [PATCH] fix conntrack reassembly expire code
  2012-12-07  9:42 [PATCH] fix conntrack reassembly expire code haibbo
@ 2012-12-11  1:50 ` Pablo Neira Ayuso
       [not found]   ` <CAOa9=yr+r6TP33j1Ugp=UveS3yuEssZcbTfRxvaBYqboW_Lz_g@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Pablo Neira Ayuso @ 2012-12-11  1:50 UTC (permalink / raw)
  To: haibbo; +Cc: kaber, netfilter-devel, netfilter, coreteam

Hi Haibbo,

On Fri, Dec 07, 2012 at 05:42:17PM +0800, haibbo@gmail.com wrote:
> From: Haibo Xi <haibbo@gmail.com>
> 
> Commit b836c99fd6c9 (ipv6: unify conntrack reassembly expire
> code with standard one) use the standard IPv6 reassembly
> code(ip6_expire_frag_queue) to handle conntrack reassembly expire.
> 
> In ip6_expire_frag_queue, it invoke dev_get_by_index_rcu to get
> which device received this expired packet.so we must save ifindex
> when NF_conntrack get this packet.
> 
> With this patch applied, I can see ICMP Time Exceeded sent
> from the receiver when the sender sent out 1/2 fragmented
> IPv6 packet.
> 
> Signed-off-by: Haibo Xi <haibbo@gmail.com>
> ---
>  net/ipv6/netfilter/nf_conntrack_reasm.c |    7 ++++++-
>  1 files changed, 6 insertions(+), 1 deletions(-)
> 
> diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
> index 22c8ea9..e7197be 100644
> --- a/net/ipv6/netfilter/nf_conntrack_reasm.c
> +++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
> @@ -196,6 +196,7 @@ static int nf_ct_frag6_queue(struct frag_queue *fq, struct sk_buff *skb,
>  	struct sk_buff *prev, *next;
>  	unsigned int payload_len;
>  	int offset, end;
> +	struct net_device *dev = NULL;

This assignation above is superfluous.

>  	if (fq->q.last_in & INET_FRAG_COMPLETE) {
>  		pr_debug("Already completed\n");
> @@ -311,7 +312,11 @@ found:
>  	else
>  		fq->q.fragments = skb;
>  
> -	skb->dev = NULL;
> +	dev = skb->dev;
> +	if (dev) {
> +		fq->iif = dev->ifindex;
> +		skb->dev = NULL;
> +	}
>  	fq->q.stamp = skb->tstamp;
>  	fq->q.meat += skb->len;
>  	if (payload_len > fq->q.max_size)
> -- 
> 1.7.0.4
> 

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

* Re: [PATCH] fix conntrack reassembly expire code
       [not found]   ` <CAOa9=yr+r6TP33j1Ugp=UveS3yuEssZcbTfRxvaBYqboW_Lz_g@mail.gmail.com>
@ 2012-12-16 22:43     ` Pablo Neira Ayuso
  0 siblings, 0 replies; 3+ messages in thread
From: Pablo Neira Ayuso @ 2012-12-16 22:43 UTC (permalink / raw)
  To: Haibo Xi; +Cc: kaber, netfilter-devel, netfilter, coreteam

On Tue, Dec 11, 2012 at 10:52:16AM +0800, Haibo Xi wrote:
>    Hi Pablo,
> 
>    Thanks for your advice.
>    Given below is new patch.

Applied, thanks.

Minor nitpick: Please, next time check that your mail client is
sending plain text, HTML makes no good to the patch.

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

end of thread, other threads:[~2012-12-16 22:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-07  9:42 [PATCH] fix conntrack reassembly expire code haibbo
2012-12-11  1:50 ` Pablo Neira Ayuso
     [not found]   ` <CAOa9=yr+r6TP33j1Ugp=UveS3yuEssZcbTfRxvaBYqboW_Lz_g@mail.gmail.com>
2012-12-16 22:43     ` 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).