On 1/7/19 5:05 PM, Stephen Hemminger wrote: > On Mon, 7 Jan 2019 14:55:52 -0800 > David Ahern <dsah...@kernel.org> wrote: > >> + idx = ll_link_get(name); >> + if (idx == 0) >> + idx = if_nametoindex(name); > > What is advantage of using netlink, other than not having to open > a socket. >
As mentioned in my response to Eric, use of netlink is to keep the cache entries in sync. The existing cache is populated by netlink messages; this function should follow suit. if_nametoindex does not allow setting the flags or type fields.