blob: 7881d99449752b8499fa93904810e5465ceb4f2e [file] [log] [blame] [raw]
Add macro _NO_CONVERT_IFNAME that prevent interface names to be converted to
eth*. Useful when using linprocfs separately without Linux binary
compatibility.
diff -ru --exclude-from freebsd-src-diff-exclude-names /usr/src/sys/compat/linprocfs/linprocfs.c freebsd-11.1/usr/src/sys/compat/linprocfs/linprocfs.c
--- /usr/src/sys/compat/linprocfs/linprocfs.c 2017-07-21 07:42:01.000000000 +0800
+++ freebsd-11.1/usr/src/sys/compat/linprocfs/linprocfs.c 2019-03-22 17:10:50.198786000 +0800
@@ -39,6 +39,8 @@
* @(#)procfs_status.c 8.4 (Berkeley) 6/15/94
*/
+#define _NO_CONVERT_IFNAME 1
+
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: releng/10.3/sys/compat/linprocfs/linprocfs.c 295951 2016-02-24 02:34:11Z araujo $");
@@ -1070,6 +1076,7 @@
return (error);
}
+#ifndef _NO_CONVERT_IFNAME
/*
* Criteria for interface name translation
*/
@@ -1098,6 +1105,7 @@
return (0);
}
+#endif
/*
* Filler function for proc/net/dev
@@ -1105,7 +1113,9 @@
static int
linprocfs_donetdev(PFS_FILL_ARGS)
{
+#ifndef _NO_CONVERT_IFNAME
char ifname[16]; /* XXX LINUX_IFNAMSIZ */
+#endif
struct ifnet *ifp;
sbuf_printf(sb, "%6s|%58s|%s\n"
@@ -1118,8 +1128,12 @@
CURVNET_SET(TD_TO_VNET(curthread));
IFNET_RLOCK();
TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
+#ifdef _NO_CONVERT_IFNAME
+ sbuf_printf(sb, "%6.6s: ", ifp->if_xname);
+#else
linux_ifname(ifp, ifname, sizeof ifname);
sbuf_printf(sb, "%6.6s: ", ifname);
+#endif
sbuf_printf(sb, "%7ju %7ju %4ju %4ju %4lu %5lu %10lu %9ju ",
(uintmax_t )ifp->if_get_counter(ifp, IFCOUNTER_IBYTES),
(uintmax_t )ifp->if_get_counter(ifp, IFCOUNTER_IPACKETS),