Skip to content

Commit e769604

Browse files
committed
Merge branch 'do-not-allow-adding-routes-if-disable_ipv6-is-enabled'
Lorenzo Bianconi says: ==================== do not allow adding routes if disable_ipv6 is enabled Do not allow userspace to add static ipv6 routes if disable_ipv6 is enabled. Update disable_ipv6 documentation according to that change Changes since v1: - added an extack message telling the user that IPv6 is disabled on the nexthop device - rebased on-top of net-next ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents d162190 + 2f0aaf7 commit e769604

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

Documentation/networking/ip-sysctl.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1703,7 +1703,9 @@ disable_ipv6 - BOOLEAN
17031703
interface and start Duplicate Address Detection, if necessary.
17041704

17051705
When this value is changed from 0 to 1 (IPv6 is being disabled),
1706-
it will dynamically delete all address on the given interface.
1706+
it will dynamically delete all addresses and routes on the given
1707+
interface. From now on it will not possible to add addresses/routes
1708+
to the selected interface.
17071709

17081710
accept_dad - INTEGER
17091711
Whether to accept DAD (Duplicate Address Detection).

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)