From mboxrd@z Thu Jan 1 00:00:00 1970 From: ebiederm@xmission.com (Eric W. Biederman) Subject: Re: [PATCH] net: clear iflink when moving to a new netns Date: Wed, 12 Feb 2014 18:00:47 -0800 Message-ID: <87sirn4vqo.fsf@xmission.com> References: <1392162690-6647-1-git-send-email-xiyou.wangcong@gmail.com> <52FB969A.607@6wind.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Nicolas Dichtel , Cong Wang , netdev , "David S. Miller" , Eric Dumazet , Hannes Frederic Sowa To: Cong Wang Return-path: Received: from out01.mta.xmission.com ([166.70.13.231]:39661 "EHLO out01.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751585AbaBMCAz convert rfc822-to-8bit (ORCPT ); Wed, 12 Feb 2014 21:00:55 -0500 In-Reply-To: (Cong Wang's message of "Wed, 12 Feb 2014 17:18:08 -0800") Sender: netdev-owner@vger.kernel.org List-ID: Cong Wang writes: > On Wed, Feb 12, 2014 at 7:43 AM, Nicolas Dichtel > wrote: >> Le 12/02/2014 00:51, Cong Wang a =C3=A9crit : >> >>> From: Cong Wang >>> >>> BZ: https://bugzilla.kernel.org/show_bug.cgi?id=3D66691 >>> >>> macvlan and vlan both use iflink to identify its lower device, >>> however, after such device is moved to the new netns, its iflink >>> would become meaningless as ifindex is per netns. So, instead of >>> forbid them moving to another netns, just clear this field so that >>> it will not be dumped at least. >>> >>> Cc: David S. Miller >>> Cc: Eric W. Biederman >>> Cc: Eric Dumazet >>> Cc: Hannes Frederic Sowa , >>> Signed-off-by: Cong Wang >>> Signed-off-by: Cong Wang >> >> I wonder if this patch breaks things in ip tunnels. >> For example, ip6_tunnel uses iflink to find tunnels that are bound t= o an >> interface. >> If you reset this field, ipip6_tunnel_lookup() will fail when the tu= nnel >> moves >> to another netns. > > Most tunnels set NETIF_F_NETNS_LOCAL, ip6_tunnel should set it too > (need a patch). So this is not a problem. There was an effort not long ago to make tunnels safe to pass between namespaces. NETIF_F_NETNS_LOCAL was removed from ip6_tunnel in that effort. Apparently something was overlooked. Making iflink a netdevice reference or finding a way to remove it entirely seems better that masking the problem. Eric