[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210801143840.j6bfvt3zsfb2x7q5@pali>
Date: Sun, 1 Aug 2021 16:38:40 +0200
From: Pali Rohár <pali@...nel.org>
To: Andrew Lunn <andrew@...n.ch>
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: How to find out name or id of newly created interface
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.
Powered by blists - more mailing lists