aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tun.c
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@parallels.com>2013-08-21 14:32:39 +0400
committerDavid S. Miller <davem@davemloft.net>2013-08-21 12:21:45 -0700
commit76975e9cb4a7c6fe39478a3dc4dd292a5c6c8c74 (patch)
treec17c80f50fc5fa83b350e28ca04630ad738d0213 /drivers/net/tun.c
parenttun: Allow to skip filter on attach (diff)
downloadlinux-dev-76975e9cb4a7c6fe39478a3dc4dd292a5c6c8c74.tar.xz
linux-dev-76975e9cb4a7c6fe39478a3dc4dd292a5c6c8c74.zip
tun: Get skfilter layout
The only thing we may have from tun device is the fprog, whic contains the number of filter elements and a pointer to (user-space) memory where the elements are. The program itself may not be available if the device is persistent and detached. Signed-off-by: Pavel Emelyanov <xemul@parallels.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tun.c')
-rw-r--r--drivers/net/tun.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 6acbdbccebcd..60a1e93e9d35 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -2042,6 +2042,16 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
tun_detach_filter(tun, tun->numqueues);
break;
+ case TUNGETFILTER:
+ ret = -EINVAL;
+ if ((tun->flags & TUN_TYPE_MASK) != TUN_TAP_DEV)
+ break;
+ ret = -EFAULT;
+ if (copy_to_user(argp, &tun->fprog, sizeof(tun->fprog)))
+ break;
+ ret = 0;
+ break;
+
default:
ret = -EINVAL;
break;