diff options
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/tun.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 1e655ea63102..d91856b19f6f 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -477,6 +477,7 @@ static void tun_setup(struct net_device *dev) | |||
477 | dev->stop = tun_net_close; | 477 | dev->stop = tun_net_close; |
478 | dev->ethtool_ops = &tun_ethtool_ops; | 478 | dev->ethtool_ops = &tun_ethtool_ops; |
479 | dev->destructor = free_netdev; | 479 | dev->destructor = free_netdev; |
480 | dev->features |= NETIF_F_NETNS_LOCAL; | ||
480 | } | 481 | } |
481 | 482 | ||
482 | static struct tun_struct *tun_get_by_name(struct tun_net *tn, const char *name) | 483 | static struct tun_struct *tun_get_by_name(struct tun_net *tn, const char *name) |
@@ -544,6 +545,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) | |||
544 | if (!dev) | 545 | if (!dev) |
545 | return -ENOMEM; | 546 | return -ENOMEM; |
546 | 547 | ||
548 | dev_net_set(dev, net); | ||
547 | tun = netdev_priv(dev); | 549 | tun = netdev_priv(dev); |
548 | tun->dev = dev; | 550 | tun->dev = dev; |
549 | tun->flags = flags; | 551 | tun->flags = flags; |
@@ -583,6 +585,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) | |||
583 | 585 | ||
584 | file->private_data = tun; | 586 | file->private_data = tun; |
585 | tun->attached = 1; | 587 | tun->attached = 1; |
588 | get_net(dev_net(tun->dev)); | ||
586 | 589 | ||
587 | strcpy(ifr->ifr_name, tun->dev->name); | 590 | strcpy(ifr->ifr_name, tun->dev->name); |
588 | return 0; | 591 | return 0; |
@@ -798,6 +801,7 @@ static int tun_chr_close(struct inode *inode, struct file *file) | |||
798 | /* Detach from net device */ | 801 | /* Detach from net device */ |
799 | file->private_data = NULL; | 802 | file->private_data = NULL; |
800 | tun->attached = 0; | 803 | tun->attached = 0; |
804 | put_net(dev_net(tun->dev)); | ||
801 | 805 | ||
802 | /* Drop read queue */ | 806 | /* Drop read queue */ |
803 | skb_queue_purge(&tun->readq); | 807 | skb_queue_purge(&tun->readq); |