Determining ifname after rtnl_link_add()

Manuel Schölling manuel.schoelling at gmx.de
Sat Dec 23 02:05:04 PST 2017


Hi,

I am creating a network interface without specifying the name of it
using these function calls:

link = rtnl_link_alloc();
rtnl_link_set_type(link, kind));
rtnl_link_add(sk, link, NLM_F_CREATE));

The creation of the new interface works fine, but I'd like to figure
out the name of the interface afterwards.

The problem is that neither rtnl_link_get_name(link) nor 
rtnl_link_get_ifindex(link) succeed after the rtnl_link_add() call.

Is there a way to determine the name of the interface somehow?

Thanks,

Manuel



More information about the libnl mailing list