diff options
-rw-r--r-- | drivers/net/tun.c | 2 | ||||
-rw-r--r-- | include/linux/if_tun.h | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 589f0ca668d6..94622e5fb936 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -874,6 +874,8 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) | |||
874 | 874 | ||
875 | dev = __dev_get_by_name(net, ifr->ifr_name); | 875 | dev = __dev_get_by_name(net, ifr->ifr_name); |
876 | if (dev) { | 876 | if (dev) { |
877 | if (ifr->ifr_flags & IFF_TUN_EXCL) | ||
878 | return -EBUSY; | ||
877 | if ((ifr->ifr_flags & IFF_TUN) && dev->netdev_ops == &tun_netdev_ops) | 879 | if ((ifr->ifr_flags & IFF_TUN) && dev->netdev_ops == &tun_netdev_ops) |
878 | tun = netdev_priv(dev); | 880 | tun = netdev_priv(dev); |
879 | else if ((ifr->ifr_flags & IFF_TAP) && dev->netdev_ops == &tap_netdev_ops) | 881 | else if ((ifr->ifr_flags & IFF_TAP) && dev->netdev_ops == &tap_netdev_ops) |
diff --git a/include/linux/if_tun.h b/include/linux/if_tun.h index 049d6c9428db..915ba5789f0e 100644 --- a/include/linux/if_tun.h +++ b/include/linux/if_tun.h | |||
@@ -55,6 +55,7 @@ | |||
55 | #define IFF_NO_PI 0x1000 | 55 | #define IFF_NO_PI 0x1000 |
56 | #define IFF_ONE_QUEUE 0x2000 | 56 | #define IFF_ONE_QUEUE 0x2000 |
57 | #define IFF_VNET_HDR 0x4000 | 57 | #define IFF_VNET_HDR 0x4000 |
58 | #define IFF_TUN_EXCL 0x8000 | ||
58 | 59 | ||
59 | /* Features for GSO (TUNSETOFFLOAD). */ | 60 | /* Features for GSO (TUNSETOFFLOAD). */ |
60 | #define TUN_F_CSUM 0x01 /* You can hand me unchecksummed packets. */ | 61 | #define TUN_F_CSUM 0x01 /* You can hand me unchecksummed packets. */ |