Skip to content

Commit 428604f

Browse files
LorenzoBianconidavem330
authored andcommitted
ipv6: do not set routes if disable_ipv6 has been enabled
Do not allow setting ipv6 routes from userspace if disable_ipv6 has been enabled. The issue can be triggered using the following reproducer: - sysctl net.ipv6.conf.all.disable_ipv6=1 - ip -6 route add a:b:c:d::/64 dev em1 - ip -6 route show a:b:c:d::/64 dev em1 metric 1024 pref medium Fix it checking disable_ipv6 value in ip6_route_info_create routine Signed-off-by: Lorenzo Bianconi <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent d162190 commit 428604f

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
@@ -2917,6 +2917,12 @@ static struct rt6_info *ip6_route_info_create(struct fib6_config *cfg,
29172917
if (!dev)
29182918
goto out;
29192919

2920+
if (idev->cnf.disable_ipv6) {
2921+
NL_SET_ERR_MSG(extack, "IPv6 is disabled on nexthop device");
2922+
err = -EACCES;
2923+
goto out;
2924+
}
2925+
29202926
if (!(dev->flags & IFF_UP)) {
29212927
NL_SET_ERR_MSG(extack, "Nexthop device is not up");
29222928
err = -ENETDOWN;

0 commit comments

Comments
 (0)