git: 56928500eceb - main - linux: Use the if_name() accessor to get loopback name

From: Justin Hibbits <jhibbits_at_FreeBSD.org>
Date: Tue, 07 Mar 2023 14:46:56 UTC
The branch main has been updated by jhibbits:

URL: https://cgit.FreeBSD.org/src/commit/?id=56928500eceb7ff381e2eaf4ea08f36a743d072e

commit 56928500eceb7ff381e2eaf4ea08f36a743d072e
Author:     Justin Hibbits <jhibbits@FreeBSD.org>
AuthorDate: 2023-03-06 16:36:31 +0000
Commit:     Justin Hibbits <jhibbits@FreeBSD.org>
CommitDate: 2023-03-07 14:47:01 +0000

    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.
---
 sys/compat/linux/linux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/compat/linux/linux.c b/sys/compat/linux/linux.c
index dcf5ac1e6892..47a6561264e9 100644
--- a/sys/compat/linux/linux.c
+++ b/sys/compat/linux/linux.c
@@ -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. */