aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/linux/linux_ioctl.c
diff options
context:
space:
mode:
authorAlexander Leidinger <netchild@FreeBSD.org>2006-03-18 18:20:17 +0000
committerAlexander Leidinger <netchild@FreeBSD.org>2006-03-18 18:20:17 +0000
commit5c8919adf42db11b7af50afde07a570d2749497a (patch)
tree0bfbd4f21076e4935e7376b8d0502c8d258d4cfa /sys/compat/linux/linux_ioctl.c
parent1ecfb7ed3d86a3414518fc750864b35bf6cdf236 (diff)
downloadsrc-5c8919adf42db11b7af50afde07a570d2749497a.tar.gz
src-5c8919adf42db11b7af50afde07a570d2749497a.zip
Get rid of the need of COMPAT_43 in the linuxolator.
Submitted by: Divacky Roman <xdivac02@stud.fit.vutbr.cz> Obtained from: DragonFly (some parts)
Notes
Notes: svn path=/head/; revision=156842
Diffstat (limited to 'sys/compat/linux/linux_ioctl.c')
-rw-r--r--sys/compat/linux/linux_ioctl.c35
1 files changed, 31 insertions, 4 deletions
diff --git a/sys/compat/linux/linux_ioctl.c b/sys/compat/linux/linux_ioctl.c
index 14568e2e6160..a8e494de1116 100644
--- a/sys/compat/linux/linux_ioctl.c
+++ b/sys/compat/linux/linux_ioctl.c
@@ -2280,6 +2280,29 @@ linux_gifhwaddr(struct ifnet *ifp, struct l_ifreq *ifr)
return (ENOENT);
}
+
+ /*
+* If we fault in bsd_to_linux_ifreq() then we will fault when we call
+* the native ioctl(). Thus, we don't really need to check the return
+* value of this function.
+*/
+static int
+bsd_to_linux_ifreq(struct ifreq *arg)
+{
+ struct ifreq ifr;
+ size_t ifr_len = sizeof(struct ifreq);
+ int error;
+
+ if ((error = copyin(arg, &ifr, ifr_len)))
+ return (error);
+
+ *(u_short *)&ifr.ifr_addr = ifr.ifr_addr.sa_family;
+
+ error = copyout(&ifr, arg, ifr_len);
+
+ return (error);
+}
+
/*
* Socket related ioctls
*/
@@ -2411,8 +2434,9 @@ linux_ioctl_socket(struct thread *td, struct linux_ioctl_args *args)
break;
case LINUX_SIOCGIFADDR:
- args->cmd = OSIOCGIFADDR;
+ args->cmd = SIOCGIFADDR;
error = ioctl(td, (struct ioctl_args *)args);
+ bsd_to_linux_ifreq((struct ifreq *)args->arg);
break;
case LINUX_SIOCSIFADDR:
@@ -2422,18 +2446,21 @@ linux_ioctl_socket(struct thread *td, struct linux_ioctl_args *args)
break;
case LINUX_SIOCGIFDSTADDR:
- args->cmd = OSIOCGIFDSTADDR;
+ args->cmd = SIOCGIFDSTADDR;
error = ioctl(td, (struct ioctl_args *)args);
+ bsd_to_linux_ifreq((struct ifreq *)args->arg);
break;
case LINUX_SIOCGIFBRDADDR:
- args->cmd = OSIOCGIFBRDADDR;
+ args->cmd = SIOCGIFBRDADDR;
error = ioctl(td, (struct ioctl_args *)args);
+ bsd_to_linux_ifreq((struct ifreq *)args->arg);
break;
case LINUX_SIOCGIFNETMASK:
- args->cmd = OSIOCGIFNETMASK;
+ args->cmd = SIOCGIFNETMASK;
error = ioctl(td, (struct ioctl_args *)args);
+ bsd_to_linux_ifreq((struct ifreq *)args->arg);
break;
case LINUX_SIOCSIFNETMASK: