aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Ahern <dsahern@gmail.com>2018-01-24 22:45:29 -0500
committerDavid S. Miller <davem@davemloft.net>2018-01-25 16:22:02 -0500
commit955ec4cb3b54c7c389a9f830be7d3ae2056b9212 (patch)
treedfce42ecd2ae158579862cd41f2d6320a5536245
parentbfd4b329acd5159077603d3f1873a7d761236d25 (diff)
net/ipv6: Do not allow route add with a device that is down
IPv6 allows routes to be installed when the device is not up (admin up). Worse, it does not mark it as LINKDOWN. IPv4 does not allow it and really there is no reason for IPv6 to allow it, so check the flags and deny if device is admin down. Signed-off-by: David Ahern <dsahern@gmail.com> Reviewed-by: Ido Schimmel <idosch@mellanox.com> Reviewed-by: Roopa Prabhu <roopa@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/ipv6/route.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index f85da2f1e729..aa4411c81e7e 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2734,6 +2734,12 @@ static struct rt6_info *ip6_route_info_create(struct fib6_config *cfg,
2734 if (!dev) 2734 if (!dev)
2735 goto out; 2735 goto out;
2736 2736
2737 if (!(dev->flags & IFF_UP)) {
2738 NL_SET_ERR_MSG(extack, "Nexthop device is not up");
2739 err = -ENETDOWN;
2740 goto out;
2741 }
2742
2737 if (!ipv6_addr_any(&cfg->fc_prefsrc)) { 2743 if (!ipv6_addr_any(&cfg->fc_prefsrc)) {
2738 if (!ipv6_chk_addr(net, &cfg->fc_prefsrc, dev, 0)) { 2744 if (!ipv6_chk_addr(net, &cfg->fc_prefsrc, dev, 0)) {
2739 NL_SET_ERR_MSG(extack, "Invalid source address"); 2745 NL_SET_ERR_MSG(extack, "Invalid source address");