diff options
Diffstat (limited to 'drivers/net/ipvlan/ipvlan_main.c')
-rw-r--r-- | drivers/net/ipvlan/ipvlan_main.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c index 19bdde60680c..07e41c42bcf5 100644 --- a/drivers/net/ipvlan/ipvlan_main.c +++ b/drivers/net/ipvlan/ipvlan_main.c | |||
@@ -100,12 +100,12 @@ static int ipvlan_set_port_mode(struct ipvl_port *port, u16 nval, | |||
100 | err = ipvlan_register_nf_hook(read_pnet(&port->pnet)); | 100 | err = ipvlan_register_nf_hook(read_pnet(&port->pnet)); |
101 | if (!err) { | 101 | if (!err) { |
102 | mdev->l3mdev_ops = &ipvl_l3mdev_ops; | 102 | mdev->l3mdev_ops = &ipvl_l3mdev_ops; |
103 | mdev->priv_flags |= IFF_L3MDEV_MASTER; | 103 | mdev->priv_flags |= IFF_L3MDEV_RX_HANDLER; |
104 | } else | 104 | } else |
105 | goto fail; | 105 | goto fail; |
106 | } else if (port->mode == IPVLAN_MODE_L3S) { | 106 | } else if (port->mode == IPVLAN_MODE_L3S) { |
107 | /* Old mode was L3S */ | 107 | /* Old mode was L3S */ |
108 | mdev->priv_flags &= ~IFF_L3MDEV_MASTER; | 108 | mdev->priv_flags &= ~IFF_L3MDEV_RX_HANDLER; |
109 | ipvlan_unregister_nf_hook(read_pnet(&port->pnet)); | 109 | ipvlan_unregister_nf_hook(read_pnet(&port->pnet)); |
110 | mdev->l3mdev_ops = NULL; | 110 | mdev->l3mdev_ops = NULL; |
111 | } | 111 | } |
@@ -167,7 +167,7 @@ static void ipvlan_port_destroy(struct net_device *dev) | |||
167 | struct sk_buff *skb; | 167 | struct sk_buff *skb; |
168 | 168 | ||
169 | if (port->mode == IPVLAN_MODE_L3S) { | 169 | if (port->mode == IPVLAN_MODE_L3S) { |
170 | dev->priv_flags &= ~IFF_L3MDEV_MASTER; | 170 | dev->priv_flags &= ~IFF_L3MDEV_RX_HANDLER; |
171 | ipvlan_unregister_nf_hook(dev_net(dev)); | 171 | ipvlan_unregister_nf_hook(dev_net(dev)); |
172 | dev->l3mdev_ops = NULL; | 172 | dev->l3mdev_ops = NULL; |
173 | } | 173 | } |
@@ -499,6 +499,8 @@ static int ipvlan_nl_changelink(struct net_device *dev, | |||
499 | 499 | ||
500 | if (!data) | 500 | if (!data) |
501 | return 0; | 501 | return 0; |
502 | if (!ns_capable(dev_net(ipvlan->phy_dev)->user_ns, CAP_NET_ADMIN)) | ||
503 | return -EPERM; | ||
502 | 504 | ||
503 | if (data[IFLA_IPVLAN_MODE]) { | 505 | if (data[IFLA_IPVLAN_MODE]) { |
504 | u16 nmode = nla_get_u16(data[IFLA_IPVLAN_MODE]); | 506 | u16 nmode = nla_get_u16(data[IFLA_IPVLAN_MODE]); |
@@ -601,6 +603,8 @@ int ipvlan_link_new(struct net *src_net, struct net_device *dev, | |||
601 | struct ipvl_dev *tmp = netdev_priv(phy_dev); | 603 | struct ipvl_dev *tmp = netdev_priv(phy_dev); |
602 | 604 | ||
603 | phy_dev = tmp->phy_dev; | 605 | phy_dev = tmp->phy_dev; |
606 | if (!ns_capable(dev_net(phy_dev)->user_ns, CAP_NET_ADMIN)) | ||
607 | return -EPERM; | ||
604 | } else if (!netif_is_ipvlan_port(phy_dev)) { | 608 | } else if (!netif_is_ipvlan_port(phy_dev)) { |
605 | /* Exit early if the underlying link is invalid or busy */ | 609 | /* Exit early if the underlying link is invalid or busy */ |
606 | if (phy_dev->type != ARPHRD_ETHER || | 610 | if (phy_dev->type != ARPHRD_ETHER || |