do not allow to add routes if disable_ipv6 is enabled
Subsystems (4)
cover do not allow to add 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
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 | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-)
Signature · 1 line
2.14.3
PATCH 1/2 ipv6: do not set routes if disable_ipv6 has been enabled
Do not allow to set 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 | 5 +++++ 1 file changed, 5 insertions(+)
net/ipv6/route.c +5 -0
@@ -2917,6 +2917,11 @@ static struct rt6_info *ip6_route_info_create(struct fib6_config *cfg,if (!dev) goto out; +if (idev->cnf.disable_ipv6) { + 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 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
Re: [PATCH net-next 1/2] ipv6: do not set routes if disable_ipv6 has been enabled
In reply to Lorenzo BianconiQuoted 20 lines · Lorenzo Bianconi
Do not allow to set ipv6 routes from userspace if
disable_ipv6has 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 mediumFix it checking
disable_ipv6value inip6_route_info_createroutineSigned-off-by Lorenzo Bianconi <[email protected]>--- net/ipv6/route.c | 5 +++++ 1 file changed, 5 insertions(+)net/ipv6/route.c +0
-0
net/ipv6/route.c static struct rt6_info *ip6_route_info_create(struct fib6_config *cfg, · line 2921
Quoted 5 lines
net/ipv6/route.c +2
-0@@ -2917,6 +2917,11 @@ static struct rt6_info *ip6_route_info_create(struct fib6_config *cfg,if (!dev) goto out; +if (idev->cnf.disable_ipv6) { + err = -EACCES ;
you need an extack message telling the user that IPv6 is disabled on the nexthop device.
Quoted 7 lines
net/ipv6/route.c +3
-0+ goto out; + } +if (!(dev->flags &IFF_UP )) {NL_SET_ERR_MSG (extack,"Nexthop device is not up" ); err = -ENETDOWN ;
Re: [PATCH net-next 1/2] ipv6: do not set routes if disable_ipv6 has been enabled
Quoted 24 lines · Lorenzo Bianconi
Quoted 23 lines
Do not allow to set ipv6 routes from userspace if
disable_ipv6has 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 mediumFix it checking
disable_ipv6value inip6_route_info_createroutineSigned-off-by Lorenzo Bianconi <[email protected]>--- net/ipv6/route.c | 5 +++++ 1 file changed, 5 insertions(+)net/ipv6/route.c +0
-0@@ -2917,6 +2917,11 @@ static struct rt6_info *ip6_route_info_create(struct fib6_config *cfg,if (!dev) goto out;
Quoted 6 lines
net/ipv6/route.c static struct rt6_info *ip6_route_info_create(struct fib6_config *cfg, · line 2921
Quoted 2 lines
net/ipv6/route.c +2
-0+if (idev->cnf.disable_ipv6) { + err = -EACCES ;you need an extack message telling the user that IPv6 is disabled on the nexthop device.
Ack, will do in v2.
Regards,
Lorenzo
Quoted 8 lines
Quoted 7 lines
net/ipv6/route.c +3
-0+ goto out; + } +if (!(dev->flags &IFF_UP )) {NL_SET_ERR_MSG (extack,"Nexthop device is not up" ); err = -ENETDOWN ;