Skip to content

Commit 955ec4c

Browse files
dsaherndavem330
authored andcommitted
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 <[email protected]> Reviewed-by: Ido Schimmel <[email protected]> Reviewed-by: Roopa Prabhu <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent bfd4b32 commit 955ec4c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

net/ipv6/route.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2734,6 +2734,12 @@ static struct rt6_info *ip6_route_info_create(struct fib6_config *cfg,
27342734
if (!dev)
27352735
goto out;
27362736

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+
27372743
if (!ipv6_addr_any(&cfg->fc_prefsrc)) {
27382744
if (!ipv6_chk_addr(net, &cfg->fc_prefsrc, dev, 0)) {
27392745
NL_SET_ERR_MSG(extack, "Invalid source address");

0 commit comments

Comments
 (0)