do not allow adding routes if disable_ipv6 is enabled
Subsystems (4)
v2 cover 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
Lorenzo Bianconi (2):
ipv6: do not set routes if disable_ipv6 has been enabled
Documentation: ip-sysctl.txt: clarify disable_ipv6
Documentation/networking/ip-sysctl.txt | 4 +++- net/ipv6/route.c | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-)
Signature · 1 line
2.14.3
PATCH v2 1/2 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
--- net/ipv6/route.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/ipv6/route.c +6 -0
@@ -2917,6 +2917,12 @@ static struct rt6_info *ip6_route_info_create(struct fib6_config *cfg,if (!dev) goto out; +if (idev->cnf.disable_ipv6) { +NL_SET_ERR_MSG (extack,"IPv6 is disabled on nexthop device" ); + err = -EACCES ; + goto out; + } +if (!(dev->flags &IFF_UP )) {NL_SET_ERR_MSG (extack,"Nexthop device is not up" ); err = -ENETDOWN ;
Signature · 1 line
2.14.3
PATCH v2 2/2 Documentation: ip-sysctl.txt: clarify disable_ipv6
In reply to Lorenzo BianconiClarify that when disable_ipv6 is enabled even the ipv6 routes are deleted for the selected interface and from now it will not be possible to add addresses/routes to that interface
--- Documentation/networking/ip-sysctl.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Documentation/networking/ip-sysctl.txt +3 -1
@@ -1703,7 +1703,9 @@ disable_ipv6 - BOOLEAN interface and start Duplicate Address Detection, if necessary. When this value is changed from 0 to 1 (IPv6 is being disabled), - it will dynamically delete all address on the given interface. + it will dynamically delete all addresses and routes on the given + interface. From now on it will not possible to add addresses/routes + to the selected interface. accept_dad - INTEGER Whether to accept DAD (Duplicate Address Detection).
Signature · 1 line
2.14.3
David Miller
maintainerFrom: Lorenzo Bianconi <[email protected]>
Date: Thu, 29 Mar 2018 11:02:23 +0200
Quoted 7 lines
Do not allow userspace to add static ipv6 routes if
disable_ipv6is enabled. Updatedisable_ipv6documentation according to that changeChanges since v1:
- added an extack message telling the user that IPv6 is disabled on the nexthop device
- rebased on-top of net-next
Series applied, thanks Lorenzo.