svn commit: r318324 - stable/11/sys/compat/linux
Tai-hwa Liang
avatar at FreeBSD.org
Mon May 15 22:51:24 UTC 2017
Author: avatar
Date: Mon May 15 22:51:22 2017
New Revision: 318324
URL: https://svnweb.freebsd.org/changeset/base/318324
Log:
MFC 316658:
Adding SIOCGIFNAME support in Linuxulator. This should silence the console warning associated
with linux-opera:
linux: pid 23492 (opera): ioctl fd=5, cmd=0x8910 ('\M^I',16) is not implemented
linux: pid 23492 (opera): ioctl fd=28, cmd=0x8910 ('\M^I',16) is not implemented
...
Reviewed by: kib, marcel, dchagin
Tested with: linux-opera-12.16_3
Modified:
stable/11/sys/compat/linux/linux_ioctl.c
stable/11/sys/compat/linux/linux_ioctl.h
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sys/compat/linux/linux_ioctl.c
==============================================================================
--- stable/11/sys/compat/linux/linux_ioctl.c Mon May 15 22:50:54 2017 (r318323)
+++ stable/11/sys/compat/linux/linux_ioctl.c Mon May 15 22:51:22 2017 (r318324)
@@ -2173,6 +2173,49 @@ ifname_linux_to_bsd(struct thread *td, c
}
/*
+ * Implement the SIOCGIFNAME ioctl
+ */
+
+static int
+linux_ioctl_ifname(struct thread *td, struct l_ifreq *uifr)
+{
+ struct l_ifreq ifr;
+ struct ifnet *ifp;
+ int error, ethno, index;
+
+ error = copyin(uifr, &ifr, sizeof(ifr));
+ if (error != 0)
+ return (error);
+
+ CURVNET_SET(TD_TO_VNET(curthread));
+ IFNET_RLOCK();
+ index = 1; /* ifr.ifr_ifindex starts from 1 */
+ ethno = 0;
+ error = ENODEV;
+ TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
+ if (ifr.ifr_ifindex == index) {
+ if (IFP_IS_ETH(ifp))
+ snprintf(ifr.ifr_name, LINUX_IFNAMSIZ,
+ "eth%d", ethno);
+ else
+ strlcpy(ifr.ifr_name, ifp->if_xname,
+ LINUX_IFNAMSIZ);
+ error = 0;
+ break;
+ }
+ if (IFP_IS_ETH(ifp))
+ ethno++;
+ index++;
+ }
+ IFNET_RUNLOCK();
+ if (error == 0)
+ error = copyout(&ifr, uifr, sizeof(ifr));
+ CURVNET_RESTORE();
+
+ return (error);
+}
+
+/*
* Implement the SIOCGIFCONF ioctl
*/
@@ -2399,6 +2442,7 @@ linux_ioctl_socket(struct thread *td, st
case LINUX_SIOCADDMULTI:
case LINUX_SIOCATMARK:
case LINUX_SIOCDELMULTI:
+ case LINUX_SIOCGIFNAME:
case LINUX_SIOCGIFCONF:
case LINUX_SIOCGPGRP:
case LINUX_SIOCSPGRP:
@@ -2484,6 +2528,10 @@ linux_ioctl_socket(struct thread *td, st
/* LINUX_SIOCGSTAMP */
+ case LINUX_SIOCGIFNAME:
+ error = linux_ioctl_ifname(td, (struct l_ifreq *)args->arg);
+ break;
+
case LINUX_SIOCGIFCONF:
error = linux_ifconf(td, (struct ifconf *)args->arg);
break;
Modified: stable/11/sys/compat/linux/linux_ioctl.h
==============================================================================
--- stable/11/sys/compat/linux/linux_ioctl.h Mon May 15 22:50:54 2017 (r318323)
+++ stable/11/sys/compat/linux/linux_ioctl.h Mon May 15 22:51:22 2017 (r318324)
@@ -226,6 +226,7 @@
#define LINUX_SIOCGPGRP 0x8904
#define LINUX_SIOCATMARK 0x8905
#define LINUX_SIOCGSTAMP 0x8906
+#define LINUX_SIOCGIFNAME 0x8910
#define LINUX_SIOCGIFCONF 0x8912
#define LINUX_SIOCGIFFLAGS 0x8913
#define LINUX_SIOCGIFADDR 0x8915
More information about the svn-src-stable-11
mailing list