Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1537543pxb; Wed, 20 Oct 2021 07:05:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyLFuU5gO6vK+n3SMvnmneNEa/AtqZeKwujL8gdNjZECzehYVPMchk+UnupnvKioZLQxMun X-Received: by 2002:a17:902:ed12:b0:13f:47ba:c4d4 with SMTP id b18-20020a170902ed1200b0013f47bac4d4mr39668940pld.84.1634738707980; Wed, 20 Oct 2021 07:05:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634738707; cv=none; d=google.com; s=arc-20160816; b=IHNlm3yitmthjuGrkszl0JOVDGDlUhd+BGc8kXf9ydTDlmII+jp4qkddeMpzi3rWTT sCQyR34AWq2CnJyBkActmV3Y9O8dtilgE88NvLvyYeX1BNZZpwxylxYrbyzx/qcVN50C 617gAW9bGLLDsEsDQwoSYnECjohKG6i6Kv/EZJR7imp9+V2WyEB9pAXPC/FxAlwvLrSg 3Z0MnuO0fWZJsAYlJ85pReWOdkwfTfrwxoBvii+LB4cEcTCvOqLXaymViR1Ap8SD6MLg EaAMnmY5NWIDEmqc4ZKgsYSM/cbtKnrhbewExpjdZni18m0rYqljTXSYPpJxT2ZrgofA 8JJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=f8IZsbe4qFH+FKhmMa+PYWRqGe/fsoacOUgqe5PAJhg=; b=tAVk9zG3c/I5c0EdLMPLE3YhKtxoyGUvX0IaGa2+66hL6hpEEERAy2VGnZNgjCIzng KNJHvdqpL2gW9V7H7zfv2oUrxzyo6LVCRlkSCRCXseHg/fumqIU40puPDy+djjJAxbkj N7BQe5K4H2xtb5bQh+v2r2j6nz5xGXTLtwYxmldQYwS7aySyXh8rcYnUNhveilVCzWTW zNrsgZkCDMFipA6BRXLz2ltAewi8FLiJyG9YsQzCMHA7rP1QgbGeeO/5O+PGo2LR2vEd aD7ncZcfKixTro9rYmBBMFEq0ZssX+NzGq0nkripX3lSiMhTPTxLyA8BqHN1/HBCEIql qK7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=mN3lWsxe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y8si3072822pgh.387.2021.10.20.07.04.53; Wed, 20 Oct 2021 07:05:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=mN3lWsxe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230264AbhJTOFZ (ORCPT + 99 others); Wed, 20 Oct 2021 10:05:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230082AbhJTOFS (ORCPT ); Wed, 20 Oct 2021 10:05:18 -0400 Received: from mail-ua1-x931.google.com (mail-ua1-x931.google.com [IPv6:2607:f8b0:4864:20::931]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20381C06174E; Wed, 20 Oct 2021 07:03:04 -0700 (PDT) Received: by mail-ua1-x931.google.com with SMTP id i22so6752620ual.10; Wed, 20 Oct 2021 07:03:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=f8IZsbe4qFH+FKhmMa+PYWRqGe/fsoacOUgqe5PAJhg=; b=mN3lWsxeb/gbvlLZZR4VwWN381uX++1x7iIVbRNxE1ouNFTaa2EHuZA1tuuHUn3H+L +DJBHSxMpwOTzx92r31vFgz715UwG2k4A3slsZ9UNk1x39GPEh6xAlLRISZDMyGRirlK b69rxi40DFirhObWg6Gzhp/O+J76oEgEamh/gn3rxN4G8w4tIWbxmYOPprtePc1ncshT GpH4Tep3O4NZDGWWv2Iv/iMsq+XSf2WzTGYGDX+KC8eeu5KxmNoxBWk/havDqa7FChBM dOoSxft18R9N0eqHZ2H5VQVbi+7DeLoXJbst+RB1Pzz+3zrgAJzh21C1jqRiYyLZK2p2 3ASA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=f8IZsbe4qFH+FKhmMa+PYWRqGe/fsoacOUgqe5PAJhg=; b=uYIlNLSfpT83XKjZMUC+4OTk3kDv/7vlqp1R1wEt8K6/wP6rO/Uo5Mn/OiVY98q7x3 thhhUITOj4tgzYQz6GBYWnzid98h1hQBMKXUoqXq/xKcRqMskixBTwr5cnDhokah8qya es7gqdfZPiRmluWNEey4CbMBHX97XpavsKT1UnOP0AxJ6SP9F5+e3G8XGl0yoLBtMBDV UocjvOwEzvpzV5K5Om9oU65wP/bv4aYJJpSOV3FKrHOQx8CKmU2NLxGxELll2HkfM0fz LRNRA+v0xaZxkZb9c1Z6EHbiF2WCImRHkHuMITf5j/Qagb278Y0+MC1uVFB6oIr34oPJ lQEQ== X-Gm-Message-State: AOAM530grQhY0S+rilEv3kFIY2vK4pAykWRDYcDV6YhGXHIm6qw4qJKX gjQRYp408sahN5xx8lpqJrt+RAvQLPd5SmnLI+Hy0j+uhSY= X-Received: by 2002:ab0:3d06:: with SMTP id f6mr7757911uax.65.1634738583113; Wed, 20 Oct 2021 07:03:03 -0700 (PDT) MIME-Version: 1.0 References: <20211020095707.GA16295@ircssh-2.c.rugged-nimbus-611.internal> In-Reply-To: <20211020095707.GA16295@ircssh-2.c.rugged-nimbus-611.internal> From: Sergey Ryazanov Date: Wed, 20 Oct 2021 17:03:56 +0300 Message-ID: Subject: Re: Retrieving the network namespace of a socket To: Sargun Dhillon Cc: LKML , netdev , Christian Brauner Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Sargun, On Wed, Oct 20, 2021 at 12:57 PM Sargun Dhillon wrote: > I'm working on a problem where I need to determine which network namespace a > given socket is in. I can currently bruteforce this by using INET_DIAG, and > enumerating namespaces and working backwards. Namespace is not a per-socket, but a per-process attribute. So each socket of a process belongs to the same namespace. Could you elaborate what kind of problem you are trying to solve? Maybe there is a more simple solution. for it. -- Sergey