lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210802100238.GA3756@pc-32.home>
Date:   Mon, 2 Aug 2021 12:02:38 +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 Sat, Jul 31, 2021 at 10:30:54PM +0200, Pali Rohár wrote:
> 
> And now I would like to know, how to race-free find out interface name
> (or id) of this newly created interface?
> 
> Response to RTM_NEWLINK/NLM_F_CREATE packet from kernel contains only
> buffer with struct nlmsgerr where is just error number (zero for
> success) without any additional information.

You'd normally pass the NLM_F_ECHO flag on the netlink request, so the
kernel would echo back a netlink message with all information about the
device it created.

Unfortunately, many netlink handlers don't implement this feature. And
it seems that RTM_NEWLINK is part of them (rtmsg_ifinfo_send() doesn't
provide the 'nlh' argument when it calls rtnl_notify()).

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ