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

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.


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

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-31 20:30 Pali Rohár
2021-08-01 14:31 ` Andrew Lunn [this message]
2021-08-01 14:38   ` Pali Rohár
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 \ \ \ \ \ \
    --subject='Re: How to find out name or id of newly created interface' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).