[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210802134320.GB3756@pc-32.home>
Date: Mon, 2 Aug 2021 15:43:20 +0200
From: Guillaume Nault <gnault@...hat.com>
To: Pali Rohár <pali@...nel.org>
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: How to find out name or id of newly created interface
On Mon, Aug 02, 2021 at 12:58:25PM +0200, Pali Rohár wrote:
> On Monday 02 August 2021 12:02:38 Guillaume Nault wrote:
> >
> > So the proper solution is to implement NLM_F_ECHO support for
> > RTM_NEWLINK messages (RTM_NEWROUTE is an example of netlink handler
> > that supports NLM_F_ECHO, see rtmsg_fib()).
>
> Do you know if there is some workaround / other solution which can be
> used by userspace applications now? And also with stable kernels (which
> obviously do not receive this new NLM_F_ECHO support for RTM_NEWLINK)?
I unfortunately can't think of any clean solution. It might be possible
to create the new interface with attributes very unlikely to be used by
external programs and retrieve the interface name and id by monitoring
link creation messages (like 'ip monitor' does). But at this point it's
probably easier to just set the interface name and retry with a
different name every time it conflicted with an existing device.
Maybe someone else could propose less hacky solutions, but I really
can't think of anything else apart from implementing NLM_F_ECHO.
Powered by blists - more mailing lists