Subject: Re: [PATCH] net: tcp: ipv6_mapped needs sk_rx_dst_set method

From: Artem Savkov <[email-masked]>
Date: Sun, 19 Aug 2012 12:11:38 +0400

On Sun, Aug 19, 2012 at 12:06:33AM -0400, Neal Cardwell wrote:
> On Sat, Aug 18, 2012 at 9:06 AM, Artem Savkov <[email-masked]> wrote:
> > [ 1699.195040] EIP is at inet6_sk_rx_dst_set+0x40/0xa0
> ...
> > [ 1699.198736]  [<c15662a1>] tcp_create_openreq_child+0x41/0x4e0
> > [ 1699.198884]  [<c1563b54>] tcp_v4_syn_recv_sock+0x34/0x330
> > [ 1699.199032]  [<c15d162e>] tcp_v6_syn_recv_sock+0x3fe/0x660
> ...
> > [ 1699.242913] EIP: [<c15d11d0>] inet6_sk_rx_dst_set+0x40/0xa0 SS:ESP 0068:f540dce0
> > [ 1699.245945] CR2: 0000000000000016
> > [ 1699.280708] ---[ end trace 3fb05aeec95e7238 ]---
> > [ 1699.280806] Kernel panic - not syncing: Fatal exception in interrupt
> > [ 1699.284674] panic occurred, switching back to text console
> Thanks for the detailed report!
> 
> I don't think that particular fix is kosher, since this basically
> changes the address family ops of the parent listening socket ('sk'
> here).The parent listening socket needs to keep its IPv6 af_ops so its
> IPv6 children can get the right af_ops.
Indeed, my approach breaks ipv6 after first mapped connection.

> We should probably either: (a) make sure the af_ops of the child
> socket are set correctly earlier, or (b) not use dynamic dispatch
> through the af_ops within tcp_create_openreq_child(), and just do the
> sk_rx_dst_set a tiny bit later. I've sent out a patch for approach (b)
> here, since it's simpler:
> 
>   http://patchwork.ozlabs.org/patch/178525/
> 
> I've verified that IPv4, IPv6, and IPv4-mapped-IPv6 connections work
> for me with this patch. But if you could test it as well, that would
> be great.

I've tested it and can confirm that all three connection types work.
Thank you for the patch and explanation.

-- 
Kind regards,
Artem