Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp954010pxy; Sun, 1 Aug 2021 07:33:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+mQkkFuLLXjnsYQr/t/dTXAAhIGT8avpplB8U81WQgcrSe1nZf1Eh31GA8AkrrEMdwkPk X-Received: by 2002:a17:907:2096:: with SMTP id pv22mr7218946ejb.443.1627828403641; Sun, 01 Aug 2021 07:33:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627828403; cv=none; d=google.com; s=arc-20160816; b=o9HSqkWq1Le8mnyKFz+dTX+n7ClPgSqAzuzSfCyRkwU3DdUoqjL27BP9HxZNvNj/UC XAjzI3NF/ubhEwC2bLRFa+dFnyazjQVWzLgs1DtP6SIZDucqX87MBxbDlRhH/lmVHQ7e 4TfXOc6GS3HUN4vokt9DrH3t5lhZ+GkPWDWhkYQkKCdyyuEtuB3telQgJBXAFsXpGrWX YR2F7kXmIm8Gh31i1AKxQF9vm3pVi9VWjAsBAz65+AibBU+FluL0xztthqLyrmc+kVII idlpjloVk28jzEaoU2aEJ2L87y0GEc6E30Xo6i2jBSloiA9G5SdkuqxTqBQQO3/Qji4y D1jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=eTgx0KE33KIk1fuzL+/3WuloQZ2Q4QKhpop+vJYtbTw=; b=fcsiL0qF3+0WahINRGcy4/bpba9x1vY2G732Es5k03s4Fw3rljPNdVUW8mmmFl/k/e UTWYQSp9yBgsoI+A3+z6jAZT8u9zQ+1NBvltnawAWcGeU7FyOOkdOYbxkP58dgjf5Gct modsFoTpxSSzDOKytDx6WsyvQX6QY7UmdHdM8ZvisG4bSfTdUtcwTlBWRkXVjTR+a4Mj B5vO+fi//EHhCwlWcMp9+CTDIOClAhFuQ+61X++eJUxdqBXLlO+u2+BFNF6xmqL6hztk UBYj+1dquTpDWcWAWyj3A/69DiIWQkPDPmFMaXY88r2HtPBDYB5yKzgncvy0iwVKSGWv Ag6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=GGNkfJYB; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a2si7592619edk.106.2021.08.01.07.33.00; Sun, 01 Aug 2021 07:33:23 -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=@lunn.ch header.s=20171124 header.b=GGNkfJYB; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231965AbhHAObp (ORCPT + 99 others); Sun, 1 Aug 2021 10:31:45 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:55996 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231791AbhHAObn (ORCPT ); Sun, 1 Aug 2021 10:31:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Transfer-Encoding:Content-Disposition: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:From: Sender:Reply-To:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Content-Disposition: In-Reply-To:References; bh=eTgx0KE33KIk1fuzL+/3WuloQZ2Q4QKhpop+vJYtbTw=; b=GG NkfJYBfs7e2xCeZ+/F1LNEgHCosMiaj+D5CN3jppOqnqAulOvSov42Vs28M+jvv7ODzm8XO4BYDRk +Qpo/M7EN1oP96x7Kan/VqbgqSgiEcDeuRB31bE6JsKUR/Ubb+INnMpVbewXHdkardYf3DdRJ4QnT 6Uoqd6Lsw0TayoE=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1mACV3-00Fitf-WF; Sun, 01 Aug 2021 16:31:34 +0200 Date: Sun, 1 Aug 2021 16:31:33 +0200 From: Andrew Lunn To: Pali =?iso-8859-1?Q?Roh=E1r?= Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: How to find out name or id of newly created interface Message-ID: References: <20210731203054.72mw3rbgcjuqbf4j@pali> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210731203054.72mw3rbgcjuqbf4j@pali> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jul 31, 2021 at 10:30:54PM +0200, Pali Roh?r wrote: > Hello! > > Via rtnetlink API (RTM_NEWLINK/NLM_F_CREATE) it is possible to create a > new network interface without specifying neither interface name nor id. > This will let kernel to choose some interface name which does not > conflicts with any already existing network interface. So seems like > ideal way if I do not care about interface names. But at some stage it > is needed to "configure" interface and for this action it is required to > know interface id or name (as some ioctls use interface name instead of > id). Hi Pali Looking at __rtnl_newlink() it looks like you can specify the dev->ifindex when you request the create. So you can leave the kernel to pick the name, but pick the if_index from user space. Andrew