Skip to content

Commit 3565e18

Browse files
NicolasDichtelJiri Slaby
authored and
Jiri Slaby
committed
ip6_gre: don't allow to remove the fb_tunnel_dev
[ Upstream commit 54d63f7 ] It's possible to remove the FB tunnel with the command 'ip link del ip6gre0' but this is unsafe, the module always supposes that this device exists. For example, ip6gre_tunnel_lookup() may use it unconditionally. Let's add a rtnl handler for dellink, which will never remove the FB tunnel (we let ip6gre_destroy_tunnels() do the job). Introduced by commit c12b395 ("gre: Support GRE over IPv6"). CC: Dmitry Kozlov <[email protected]> Signed-off-by: Nicolas Dichtel <[email protected]> Signed-off-by: David S. Miller <[email protected]> Signed-off-by: Jiri Slaby <[email protected]>
1 parent dd6e370 commit 3565e18

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

net/ipv6/ip6_gre.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,6 +1554,15 @@ static int ip6gre_changelink(struct net_device *dev, struct nlattr *tb[],
15541554
return 0;
15551555
}
15561556

1557+
static void ip6gre_dellink(struct net_device *dev, struct list_head *head)
1558+
{
1559+
struct net *net = dev_net(dev);
1560+
struct ip6gre_net *ign = net_generic(net, ip6gre_net_id);
1561+
1562+
if (dev != ign->fb_tunnel_dev)
1563+
unregister_netdevice_queue(dev, head);
1564+
}
1565+
15571566
static size_t ip6gre_get_size(const struct net_device *dev)
15581567
{
15591568
return
@@ -1631,6 +1640,7 @@ static struct rtnl_link_ops ip6gre_link_ops __read_mostly = {
16311640
.validate = ip6gre_tunnel_validate,
16321641
.newlink = ip6gre_newlink,
16331642
.changelink = ip6gre_changelink,
1643+
.dellink = ip6gre_dellink,
16341644
.get_size = ip6gre_get_size,
16351645
.fill_info = ip6gre_fill_info,
16361646
};

0 commit comments

Comments
 (0)