nlmsg_translate_ifname_nla() always used nw->ifp for the name,
which is fine for a single-message ifnet event, but an RTM_GETLINK
dump holds one RTM_NEWLINK per interface and is translated with
the ifp the writer had when the buffer was flushed.
The root of the problem is that msgs_to_linux() takes a single
ifp for a buffer that may contain messages about many interfaces.
Use nw->ifp only when its index matches the ifi_index, otherwise
resolve the name by index.
Assisted by: Claude (Fable 5.1)
*Disclosure*:
I'm not an expert in compat/linux, but I know how our netlink works.
I used an *AI* assistant to analyze linux_netlink.c and draft the initial diff after I had narrowed the problem to the kernel side with strace.
I reviewed and reworked the patch and tested it myself (dump, single reply, up/down events and interface removal), and I take full responsibility for it.