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-next>] [day] [month] [year] [list]
Date:   Sat, 31 Jul 2021 22:30:54 +0200
From:   Pali Rohár <pali@...nel.org>
To:     netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: How to find out name or id of newly created interface

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

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.

I can send another rtnetlink packet to request list of all existing
network interfaces and expect that the interface with the highest id was
that one which was created. But it is racy as another process may
meanwhile create another network interface or it may delete this my
newly created one, prior I send this followup packet.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ