net: ipv6: check route protocol when deleting routes
authorMantas M <grawity@gmail.com>
Fri, 16 Dec 2016 08:30:59 +0000 (10:30 +0200)
committerSasha Levin <alexander.levin@verizon.com>
Tue, 13 Jun 2017 13:29:17 +0000 (09:29 -0400)
[ Upstream commit c2ed1880fd61a998e3ce40254a99a2ad000f1a7d ]

The protocol field is checked when deleting IPv4 routes, but ignored for
IPv6, which causes problems with routing daemons accidentally deleting
externally set routes (observed by multiple bird6 users).

This can be verified using `ip -6 route del <prefix> proto something`.

Signed-off-by: Mantas Mikulėnas <grawity@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
net/ipv6/route.c

index fe70bd6a751621654070d7b2509110f7f3395e60..f0a4c744c019c9cf880ecd52cef94735dba1e7a3 100644 (file)
@@ -1815,6 +1815,8 @@ static int ip6_route_del(struct fib6_config *cfg)
                                continue;
                        if (cfg->fc_metric && cfg->fc_metric != rt->rt6i_metric)
                                continue;
+                       if (cfg->fc_protocol && cfg->fc_protocol != rt->rt6i_protocol)
+                               continue;
                        dst_hold(&rt->dst);
                        read_unlock_bh(&table->tb6_lock);