Received: by 10.223.176.46 with SMTP id f43csp4396943wra; Tue, 23 Jan 2018 08:51:57 -0800 (PST) X-Google-Smtp-Source: AH8x22783aSzc+TvWzA9OYrR/cqbnY+1tf9Jooaazxqu1rnV6e5eiclZJCkcj/8m8alvwmSizsyb X-Received: by 10.36.172.6 with SMTP id s6mr4454865ite.88.1516726317219; Tue, 23 Jan 2018 08:51:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516726317; cv=none; d=google.com; s=arc-20160816; b=vOWwi+pF4LOzX1HBlZuKvPsD2iU5p6ki1Grzm2kV7+EhoeK4NwS0G9/lAGxQHRH09Q 1KHurzhnGS/TJJIdDm/8yVdm3ZpTNCtpJRPJWhEKg0v25VDxc78vao1dbagyBaDTo5Q7 NwpIeDE8hCxzqgzr3G2S4CCvOe5u+dX/XzqKOinMxQFJe4U0mjgMj5FS1GB5unjFWP6v +46P1UAUKdWeANlYrAmWs3EvwZ539xQZw0Hh/AYua4IORsIu1DhuUUucRMmMDKbUBu62 QBhSDNFLRRG3qwALLedpLAa2drqPoBVfwj5642uaW1VaEThXcyaaUlbVo8VUZ6RcZ2ql JEmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:cc:to:references:subject:reply-to :dkim-signature:arc-authentication-results; bh=eChxikEnGeDqZOY4swmuWSlIMDq/Z9fELFYyxRPDpxk=; b=mJQJXj3B8WdZti59YBQ4LoW5T56gjRuN0Ye9A0SCmT3KI0Df+8hAjVFLRM4exhtGtR r3CR5HsjsEfZZQCcfqy9pOazARToHCEUl7uys0DpIK9deD6ANEJdXMfttH7hZD+XThmD IOjTYcgsGzwYU254Qo4chKSHcNHmBiwscyAcEYXFRp9xsaoUHe3atNzKMfiHcpPHSnAf SuIQ8JuM/eS/1z73Fe2K6aSGbsRe1Ub6vxTj71fEirbCeQpacZuacCuDf/LxH1aKXzL5 ky9zbZAW8VwRFQ5oWTBl+1NUJeV3vMkVMGX6H97V7Y9SghC8UpPoXscFamRLB1LIRUMc xBVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@6wind-com.20150623.gappssmtp.com header.s=20150623 header.b=Oe3fV7mo; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n62si15206342iod.231.2018.01.23.08.51.44; Tue, 23 Jan 2018 08:51:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@6wind-com.20150623.gappssmtp.com header.s=20150623 header.b=Oe3fV7mo; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751683AbeAWQuj (ORCPT + 99 others); Tue, 23 Jan 2018 11:50:39 -0500 Received: from mail-wr0-f175.google.com ([209.85.128.175]:38881 "EHLO mail-wr0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751279AbeAWQuh (ORCPT ); Tue, 23 Jan 2018 11:50:37 -0500 Received: by mail-wr0-f175.google.com with SMTP id x1so1292414wrb.5 for ; Tue, 23 Jan 2018 08:50:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=reply-to:subject:references:to:cc:from:organization:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=eChxikEnGeDqZOY4swmuWSlIMDq/Z9fELFYyxRPDpxk=; b=Oe3fV7moDoQ0HLB60lzIcqn0KjiCrMkXaOEBhTGpq3ml43Vz8E4B0Y4wGpao2jIcle KJ4Nlt3+6/8anXaLD3kKkcqwZHrW+kHkXlOy1l5dcJkuDEG5PVKBUpd2XTdjU/u7B2wb xrb99rwbTZYeCJR99jhhmJsYuUpOTS/C9hklwjX05b0IQBYFpH9LpLHp1oprIqVDHUiq 5BKZIfrDgB5CHh479Ot8f7MDQ7Mo9231Lo1lir6316VRmd4+u1bDYFm2WsiLdQKy7m5P E2gnzRjbTLuPK/mIahXU5lhgGNz6ZIp2gNg8AHLXYPQDAyL5ERNaMRXeQLYBysM2k557 0D2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:reply-to:subject:references:to:cc:from :organization:message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=eChxikEnGeDqZOY4swmuWSlIMDq/Z9fELFYyxRPDpxk=; b=P3g+XapyxuK4j2hEijRyHuguR65V4l5N4q1zlSyxKKY0T93UGuojil8q/U9yVpzblZ S8PK+8kk875ggSZF+L3/IoWUr5STFrYw+2E+OeQLbVpwg2guwdS7LBc0BfOO566GPYhY hTdImdj9KqO8g+4XLbIuH6febyV/cgPJN29Qb4u5dCBN4G8Ae9IQMzuQfj7qaoE8pQOS HtPbJcKdfNdtCCCB/SalxmZa+iRCzmif2auow8y361jz1uUP9EIqGG1aesAeBKcRbkl5 mbd+p5NU+4CiAmOpWVajSWlfXPhTIVGeZMz5NyNalwRNXoh1cAnDoxpX/Kr5ySI2W3EP RYzA== X-Gm-Message-State: AKwxytd7Ik6fDq8vZL+V1cGbcQQUlo6Mq3XAYnz2c1COBsnF7cuMSEbX ZdM3xZlqBMvwRMQsR9dkLv5Qbw== X-Received: by 10.223.148.162 with SMTP id 31mr3122678wrr.232.1516726236290; Tue, 23 Jan 2018 08:50:36 -0800 (PST) Received: from ?IPv6:2a01:e35:8b63:dc30:c358:2e43:4ca8:894a? ([2a01:e35:8b63:dc30:c358:2e43:4ca8:894a]) by smtp.gmail.com with ESMTPSA id w14sm1012147wrc.63.2018.01.23.08.50.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Jan 2018 08:50:34 -0800 (PST) Reply-To: nicolas.dichtel@6wind.com Subject: Re: [PATCH net-next 1/1] rtnetlink: request RTM_GETLINK by pid or fd References: <20180118202124.21616-1-christian.brauner@ubuntu.com> <20180118202124.21616-2-christian.brauner@ubuntu.com> <20180118212914.74878b82@redhat.com> <20180118205552.jm7shzcojbumax2k@gmail.com> <20180122220046.7b65a98a@redhat.com> <20180122212353.7n6lrruqedfhrwux@gmail.com> <20180122230616.0c457f55@redhat.com> <20180122222540.oqrr3apswopavyta@gmail.com> <20180123103009.41c2a043@redhat.com> <20180123102658.wll4xb7ewjjy5x55@olga.proxmox.com> To: Wolfgang Bumiller , Jiri Benc Cc: Christian Brauner , Christian Brauner , davem@davemloft.net, dsahern@gmail.com, fw@strlen.de, daniel@iogearbox.net, lucien.xin@gmail.com, mschiffer@universe-factory.net, jakub.kicinski@netronome.com, vyasevich@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, stephen@networkplumber.org From: Nicolas Dichtel Organization: 6WIND Message-ID: <64deff27-258e-3849-f835-ff854478a196@6wind.com> Date: Tue, 23 Jan 2018 17:50:31 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180123102658.wll4xb7ewjjy5x55@olga.proxmox.com> Content-Type: text/plain; charset=utf-8 Content-Language: fr Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 23/01/2018 à 11:26, Wolfgang Bumiller a écrit : > On Tue, Jan 23, 2018 at 10:30:09AM +0100, Jiri Benc wrote: >> On Mon, 22 Jan 2018 23:25:41 +0100, Christian Brauner wrote: >>> This is not necessarily true in scenarios where I move a network device >>> via RTM_NEWLINK + IFLA_NET_NS_PID into a network namespace I haven't >>> created. Here is an example: >>> >>> nlmsghdr->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK; >>> nlmsghdr->nlmsg_type = RTM_NEWLINK; >>> /* move to network namespace of pid */ >>> nla_put_u32(nlmsg, IFLA_NET_NS_PID, pid) >>> /* give interface new name */ >>> nla_put_string(nlmsg, IFLA_IFNAME, ifname) >>> >>> The only thing I have is the pid that identifies the network namespace. >> >> How do you know the interface did not get renamed in the new netns? >> >> This is racy and won't work reliably. You really need to know the >> netnsid before moving the interface to the netns to be able to do >> meaningful queries. > > Even if you know the netnsid, do the mentioned watches work for > nested/child namespaces if eg. a container creates new namespace before > and/or after the watch was established and moves interfaces to these > child namespaces, would you just see them disappear, or can you keep > track of them later on as well? nsid can be monitored (see ip monitor nsid). > > Even if that works, from what the documentation tells me netlink is an > unreliable protocol, so if my watcher's socket buffer is full, wouldn't > I be losing important tracking information? You can track socket error statistics. In case of error, you can start a dump to ensure that you have the right view of the system. > > I think one possible solution to tracking interfaces would be to have a > unique identifier that never changes (even if it's just a simple > uint64_t incremented whenever an interface is created). But since > they're not local to the current namespace that may require a lot of > extra permission checks (but I'm just speculating here...). It's not possible to have unique identifiers. With CRIU, you need to be able to reassign all existing ids.