From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D921DC43387 for ; Fri, 18 Jan 2019 04:47:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B140D2086D for ; Fri, 18 Jan 2019 04:47:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727122AbfARErw (ORCPT ); Thu, 17 Jan 2019 23:47:52 -0500 Received: from out02.mta.xmission.com ([166.70.13.232]:45053 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726999AbfARErw (ORCPT ); Thu, 17 Jan 2019 23:47:52 -0500 Received: from in02.mta.xmission.com ([166.70.13.52]) by out02.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1gkM4M-00052L-0n; Thu, 17 Jan 2019 21:47:50 -0700 Received: from ip68-227-174-240.om.om.cox.net ([68.227.174.240] helo=x220.xmission.com) by in02.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1gkM4K-0000Rs-7Y; Thu, 17 Jan 2019 21:47:49 -0700 From: ebiederm@xmission.com (Eric W. Biederman) To: Andrew Lunn Cc: Donald Sharp , netdev@vger.kernel.org, David Ahern , Nicolas Dichtel , Roopa Prabhu References: <20190102140514.GH22737@lunn.ch> <20190102160221.GB2446@lunn.ch> Date: Thu, 17 Jan 2019 22:47:21 -0600 In-Reply-To: <20190102160221.GB2446@lunn.ch> (Andrew Lunn's message of "Wed, 2 Jan 2019 17:02:21 +0100") Message-ID: <871s5ashba.fsf@xmission.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1gkM4K-0000Rs-7Y;;;mid=<871s5ashba.fsf@xmission.com>;;;hst=in02.mta.xmission.com;;;ip=68.227.174.240;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1/6qzSUhwej8GPOdYTHyrm6dt1pW7pFztg= X-SA-Exim-Connect-IP: 68.227.174.240 X-SA-Exim-Mail-From: ebiederm@xmission.com Subject: Re: AF_UNIX sockets crossing namespace based boundaries X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Andrew Lunn writes: > On Wed, Jan 02, 2019 at 10:22:36AM -0500, Donald Sharp wrote: >> I am only creating a network namespace, but I don't think this changes >> my core question. >> >> Suppose I am running FRR/zebra in the default namespace and I startup >> a BGP instance in namespace one. BGP will connect to the default >> namespaces zebra instance. > > Hi David. > > We are talking about AF_UNIX here. By default, the name of the socket > is a path on a filesystem. So to me, netns plays no role here when you > reference the socket via its filesystem name. The path exists in the > filesystem namespace, and in your case with only netns, the same path > exists in all your netns. > > Linux has multiple namespaces, which in theory should be > orthogonal. However in practice, they do sometime overlap, and this is > one example. There are other examples, /proc files are also netns > unaware. It seems like having an object depend on two different > namespaces at the same time is simply not supported. To clarify. It was a deliberate design choice to allow connecting to a af_unix socket with a presence in a filesystem from other network namespaces. We audited the code to ensure that, that case would work without problems before actually allowing it. Long story short. If two processes can communicate through the filesystem then we allow creating an af_unix socket in the filesystem they can communicate through. Eric