linux: Use the if_name() accessor to get loopback name

Avoid directly accessing the if_xname ifnet member. and use the
designated accessor function instead.

Sponsored by:	Juniper Networks, Inc.
This commit is contained in:
Justin Hibbits 2023-03-06 11:36:31 -05:00
parent 084846271a
commit 56928500ec

View File

@ -329,7 +329,7 @@ ifname_bsd_to_linux_ifp(struct ifnet *ifp, char *lxname, size_t len)
* Linux loopback interface name is lo (not lo0),
* we translate lo to lo0, loX to loX.
*/
if (IFP_IS_LOOP(ifp) && strncmp(ifp->if_xname, "lo0", IFNAMSIZ) == 0)
if (IFP_IS_LOOP(ifp) && strncmp(if_name(ifp), "lo0", IFNAMSIZ) == 0)
return (strlcpy(lxname, "lo", len));
/* Short-circuit non ethernet interfaces. */