linux/drivers/net
Pavel Emelyanov 849c9b6f93 tun: Allow to skip filter on attach
There's a small problem with sk-filters on tun devices. Consider
an application doing this sequence of steps:

fd = open("/dev/net/tun");
ioctl(fd, TUNSETIFF, { .ifr_name = "tun0" });
ioctl(fd, TUNATTACHFILTER, &my_filter);
ioctl(fd, TUNSETPERSIST, 1);
close(fd);

At that point the tun0 will remain in the system and will keep in
mind that there should be a socket filter at address '&my_filter'.

If after that we do

fd = open("/dev/net/tun");
ioctl(fd, TUNSETIFF, { .ifr_name = "tun0" });

we most likely receive the -EFAULT error, since tun_attach() would
try to connect the filter back. But (!) if we provide a filter at
address &my_filter, then tun0 will be created and the "new" filter
would be attached, but application may not know about that.

This may create certain problems to anyone using tun-s, but it's
critical problem for c/r -- if we meet a persistent tun device
with a filter in mind, we will not be able to attach to it to dump
its state (flags, owner, address, vnethdr size, etc.).

The proposal is to allow to attach to tun device (with TUNSETIFF)
w/o attaching the filter to the tun-file's socket. After this
attach app may e.g clean the device by dropping the filter, it
doesn't want to have one, or (in case of c/r) get information
about the device with tun ioctls.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2013-08-21 12:21:45 -07:00
..
appletalk
arcnet arcnet: cleanup sizeof parameter 2013-07-19 17:36:03 -07:00
bonding bonding: unwind on bond_add_vlan failure 2013-08-08 22:31:21 -07:00
caif drivers/net: caif: fix wrong rtnl_is_locked() usage 2013-07-09 12:55:48 -07:00
can Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2013-08-16 15:37:26 -07:00
cris
dsa
ethernet net/mlx4_en: Reduce scope of local variables in mlx4_en_xmit 2013-08-21 12:19:26 -07:00
fddi
hamradio
hippi
hyperv hyperv: Fix the NETIF_F_SG flag setting in netvsc 2013-07-16 23:02:24 -07:00
ieee802154 drivers/net/ieee802154: don't use devm_pinctrl_get_select_default() in probe 2013-07-11 17:18:27 -07:00
irda
phy net/phy: micrel: Add OF configuration support for ksz9021 2013-08-21 00:03:38 -07:00
plip
ppp pptp: fix byte order warnings 2013-08-13 15:10:22 -07:00
slip
team team: cleanup netpoll clode 2013-07-26 15:24:32 -07:00
usb r8152: add comments 2013-08-20 00:08:22 -07:00
vmxnet3
wan net: wan: sbni: Fix incorrect placement of __initdata 2013-08-09 13:24:26 -07:00
wimax
wireless mwifiex: fix build error when CONFIG_PM is not set 2013-08-12 14:36:55 -04:00
xen-netback xen-netback: xenbus.c: use more current logging styles 2013-07-02 00:52:55 -07:00
dummy.c dummy: fix oops when loading the dummy failed 2013-07-11 11:59:20 -07:00
eql.c
ifb.c ifb: fix oops when loading the ifb failed 2013-07-11 12:00:05 -07:00
Kconfig packet: nlmon: virtual netlink monitoring device for packet sockets 2013-06-24 16:39:05 -07:00
LICENSE.SRC
loopback.c
macvlan.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2013-08-16 15:37:26 -07:00
macvtap.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2013-08-16 15:37:26 -07:00
Makefile packet: nlmon: virtual netlink monitoring device for packet sockets 2013-06-24 16:39:05 -07:00
mdio.c
mii.c
netconsole.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2013-07-09 18:24:39 -07:00
nlmon.c nlmon: use standard rtnetlink link api for add/del devices 2013-07-02 12:53:17 -07:00
ntb_netdev.c
rionet.c rapidio/rionet: rework driver initialization and removal 2013-07-03 16:08:04 -07:00
sb1000.c
Space.c
sungem_phy.c
tun.c tun: Allow to skip filter on attach 2013-08-21 12:21:45 -07:00
veth.c veth: add vlan features 2013-07-19 17:36:03 -07:00
virtio_net.c virtio-net: put virtio net header inline with data 2013-07-27 20:06:10 -07:00
vxlan.c vxlan: using kfree_rcu() to simplify the code 2013-08-20 15:05:03 -07:00
xen-netfront.c xen-netfront: pull on receive skb may need to happen earlier 2013-07-17 12:51:19 -07:00