From 44fbe3d283010cbf2f057dfe496aae178387857a Mon Sep 17 00:00:00 2001 From: Andi Kleen Date: Fri, 26 Mar 2004 20:56:44 -0800 Subject: [PATCH] [PATCH] Emulate deviceless bridge ioctls This helps vmware users running vmware on x86-64 - vmnet tries to set up a bridge. Emulate these ioctls. The bridge has more ioctls on its bridge device, but these don't seem to be needed here. --- fs/compat_ioctl.c | 16 ++++++++++++++++ include/linux/compat_ioctl.h | 4 ---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index c8c5e2824bac7..23baed6180ff3 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -3070,6 +3070,20 @@ static int do_wireless_ioctl(unsigned int fd, unsigned int cmd, unsigned long ar return sys_ioctl(fd, cmd, (unsigned long) iwr); } +/* Emulate old style bridge ioctls */ +static int do_bridge_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg) +{ + u32 tmp; + unsigned long *argbuf = compat_alloc_user_space(3 * sizeof(unsigned long)); + int i; + for (i = 0; i < 3; i++) { + if (get_user(tmp, i + ((u32 *)arg)) || + put_user(tmp, i + argbuf)) + return -EFAULT; + } + return sys_ioctl(fd, cmd, (unsigned long)argbuf); +} + #undef CODE #endif @@ -3247,6 +3261,8 @@ HANDLE_IOCTL(SIOCSIWNICKN, do_wireless_ioctl) HANDLE_IOCTL(SIOCGIWNICKN, do_wireless_ioctl) HANDLE_IOCTL(SIOCSIWENCODE, do_wireless_ioctl) HANDLE_IOCTL(SIOCGIWENCODE, do_wireless_ioctl) +HANDLE_IOCTL(SIOCSIFBR, do_bridge_ioctl) +HANDLE_IOCTL(SIOCGIFBR, do_bridge_ioctl) #undef DECLARES #endif diff --git a/include/linux/compat_ioctl.h b/include/linux/compat_ioctl.h index fabf0f345a17c..be4c3e031f1e3 100644 --- a/include/linux/compat_ioctl.h +++ b/include/linux/compat_ioctl.h @@ -248,10 +248,6 @@ COMPATIBLE_IOCTL(SIOCSIFLINK) COMPATIBLE_IOCTL(SIOCSIFENCAP) COMPATIBLE_IOCTL(SIOCGIFENCAP) COMPATIBLE_IOCTL(SIOCSIFNAME) -/* FIXME: not compatible -COMPATIBLE_IOCTL(SIOCSIFBR) -COMPATIBLE_IOCTL(SIOCGIFBR) -*/ COMPATIBLE_IOCTL(SIOCSARP) COMPATIBLE_IOCTL(SIOCGARP) COMPATIBLE_IOCTL(SIOCDARP) -- 2.53.0