netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net/ipv6: Do not allow route add with a device that is down
@ 2018-01-24  3:13 David Ahern
  2018-01-24  5:24 ` Roopa Prabhu
  2018-01-24 12:48 ` Ido Schimmel
  0 siblings, 2 replies; 3+ messages in thread
From: David Ahern @ 2018-01-24  3:13 UTC (permalink / raw)
  To: netdev; +Cc: yoshfuji, idosch, David Ahern

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 <dsahern@gmail.com>
---
 net/ipv6/route.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index f85da2f1e729..689670713744 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2734,6 +2734,11 @@ static struct rt6_info *ip6_route_info_create(struct fib6_config *cfg,
 	if (!dev)
 		goto out;
 
+	if (!(dev->flags & IFF_UP)) {
+		NL_SET_ERR_MSG(extack, "Nexthop device is not up");
+		goto out;
+	}
+
 	if (!ipv6_addr_any(&cfg->fc_prefsrc)) {
 		if (!ipv6_chk_addr(net, &cfg->fc_prefsrc, dev, 0)) {
 			NL_SET_ERR_MSG(extack, "Invalid source address");
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net/ipv6: Do not allow route add with a device that is down
  2018-01-24  3:13 [PATCH net-next] net/ipv6: Do not allow route add with a device that is down David Ahern
@ 2018-01-24  5:24 ` Roopa Prabhu
  2018-01-24 12:48 ` Ido Schimmel
  1 sibling, 0 replies; 3+ messages in thread
From: Roopa Prabhu @ 2018-01-24  5:24 UTC (permalink / raw)
  To: David Ahern; +Cc: netdev, Hideaki YOSHIFUJI, Ido Schimmel

On Tue, Jan 23, 2018 at 7:13 PM, David Ahern <dsahern@gmail.com> wrote:
> 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 <dsahern@gmail.com>
> ---
>  net/ipv6/route.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index f85da2f1e729..689670713744 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -2734,6 +2734,11 @@ static struct rt6_info *ip6_route_info_create(struct fib6_config *cfg,
>         if (!dev)
>                 goto out;
>
> +       if (!(dev->flags & IFF_UP)) {
> +               NL_SET_ERR_MSG(extack, "Nexthop device is not up");
> +               goto out;
> +       }

looks like it will need a -ENETDOWN too ?



> +
>         if (!ipv6_addr_any(&cfg->fc_prefsrc)) {
>                 if (!ipv6_chk_addr(net, &cfg->fc_prefsrc, dev, 0)) {
>                         NL_SET_ERR_MSG(extack, "Invalid source address");
> --
> 2.11.0
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net/ipv6: Do not allow route add with a device that is down
  2018-01-24  3:13 [PATCH net-next] net/ipv6: Do not allow route add with a device that is down David Ahern
  2018-01-24  5:24 ` Roopa Prabhu
@ 2018-01-24 12:48 ` Ido Schimmel
  1 sibling, 0 replies; 3+ messages in thread
From: Ido Schimmel @ 2018-01-24 12:48 UTC (permalink / raw)
  To: David Ahern; +Cc: netdev, yoshfuji, idosch

On Tue, Jan 23, 2018 at 07:13:43PM -0800, David Ahern wrote:
> 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 <dsahern@gmail.com>

I figured people might complain if I change that, but I obviously prefer
to have it like IPv4. Agree with Roopa about the error code.

Thanks

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-01-24 12:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-24  3:13 [PATCH net-next] net/ipv6: Do not allow route add with a device that is down David Ahern
2018-01-24  5:24 ` Roopa Prabhu
2018-01-24 12:48 ` Ido Schimmel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).