From mboxrd@z Thu Jan 1 00:00:00 1970 From: Steffen Klassert Subject: Re: [RFC PATCH ipsec] xfrm: use the right dev to fill xdst Date: Tue, 9 Apr 2013 14:47:35 +0200 Message-ID: <20130409124735.GA21448@secunet.com> References: <1365088362-4318-1-git-send-email-nicolas.dichtel@6wind.com> <20130405094629.GV21448@secunet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Nicolas Dichtel , herbert@gondor.apana.org.au, davem@davemloft.net, netdev@vger.kernel.org To: Daniel Baluta Return-path: Received: from a.mx.secunet.com ([195.81.216.161]:53799 "EHLO a.mx.secunet.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759009Ab3DIMri (ORCPT ); Tue, 9 Apr 2013 08:47:38 -0400 Content-Disposition: inline In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: On Fri, Apr 05, 2013 at 03:59:59PM +0300, Daniel Baluta wrote: > On Fri, Apr 5, 2013 at 12:46 PM, Steffen Klassert > wrote: > > On Thu, Apr 04, 2013 at 05:12:42PM +0200, Nicolas Dichtel wrote: > >> Commit bc8e4b954e46 (xfrm6: ensure to use the same dev when building a bundle) > >> broke IPsec for IPv4 over IPv6 tunnels (because dev points to an IPv4 only > >> interface, hence in6_dev_get(dev) returns NULL. > > > > Can you give some informations on how to reproduce this? I'm running > > interfamily tunnels on our testing environment and it seems to > > work fine. > > I can hit this in our setup while using some internal custom simulated > interfaces. > > Anyhow, this should be reproducible with a classic IPv6 IPsec over > IPv4 test. Please make sure > that the IPv4 interface doesn't have an IPv6 address set up. > > Quoting from commit bc8e4b954e46 (xfrm6: ensure to use the same dev > when building a bundle): > > - xdst->u.rt6.rt6i_idev = in6_dev_get(rt->u.dst.dev); > + xdst->u.rt6.rt6i_idev = in6_dev_get(dev); > > dev points to IPv4 endpoint and if it doesn't have an IPv6 address > associated then > in6_dev_get(dev) will return NULL. Hm, inet6_init() registers addrconf_notify() as a netdevice notifier function. So addrconf_notify() is called whenever a netdevice is registered. When looking at addrconf_notify(), there are only two cases when the net_device has no inet6_dev assigned. This is either on error, or if the device mtu is smaller than IPV6_MIN_MTU (i.e. 1280). I can reproduce the behaviour you describe if I set the mtu of the ipv4 device to a value below IPV6_MIN_MTU, but in no other case. Is it possible that your ipv4 device has a mtu below IPV6_MIN_MTU?