[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210406171532.dlcvtm5wzmuemhwk@eve.qyliss.net>
Date: Tue, 6 Apr 2021 17:15:32 +0000
From: Alyssa Ross <hi@...ssa.is>
To: Stephen Hemminger <stephen@...workplumber.org>
Cc: netdev@...r.kernel.org
Subject: Re: [iproute2] finding the name of a TAP created with %d
On Tue, Apr 06, 2021 at 09:22:31AM -0700, Stephen Hemminger wrote:
> On Tue, 6 Apr 2021 13:42:40 +0000
> Alyssa Ross <hi@...ssa.is> wrote:
>
> > If I do
> >
> > ip tuntap add name tap%d mode tap
> >
> > then a TAP device with a name like "tap0", "tap1", etc. will be created.
> > But there's no way for me to find out which name was chosen for the
> > device created by that command.
>
> Use a follow on ip link show or look in sysfs.
>
> > Perhaps ip should print the name of tuntap devices after they're
> > created?
>
> You can already do that with followon command, or use batch to put two commands together.
I don't think that's reliable, is it? What happens if I create one
device, but by the time I do ip link show another one has been created?
There's no way to know for sure that the last device was created by the
command I ran.
As I understand it, the only way to avoid a race like that for sure
would be to look at the ifr_name returned by the kernel from TUNSETIFF.
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists