Netdev Archive on
help / color / mirror / Atom feed
From: "Pali Rohár" <>
To: Andrew Lunn <>
Subject: Re: How to find out name or id of newly created interface
Date: Sun, 1 Aug 2021 16:38:40 +0200	[thread overview]
Message-ID: <20210801143840.j6bfvt3zsfb2x7q5@pali> (raw)
In-Reply-To: <>

On Sunday 01 August 2021 16:31:33 Andrew Lunn wrote:
> 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

Hello! This has additional issue that I have to choose some free ifindex
number and it introduce another race condition that other userspace
process may choose same ifindex number. So create request in this case
fails if other userspace process is faster... So it has same race
condition as specifying interface name.

  reply	other threads:[~2021-08-01 14:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-31 20:30 How to find out name or id of newly created interface Pali Rohár
2021-08-01 14:31 ` Andrew Lunn
2021-08-01 14:38   ` Pali Rohár [this message]
2021-08-02 14:21     ` Andrew Lunn
2021-08-02 17:25       ` Pali Rohár
2021-08-02 10:02 ` Guillaume Nault
2021-08-02 10:58   ` Pali Rohár
2021-08-02 13:43     ` Guillaume Nault
2021-08-02 17:23       ` Pali Rohár

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210801143840.j6bfvt3zsfb2x7q5@pali \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).