From: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
To: David Ahern <dsahern@gmail.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: Re: [PATCH net-next 1/2] ipv6: do not set routes if disable_ipv6 has been enabled
Date: Thu, 29 Mar 2018 10:19:30 +0200 [thread overview]
Message-ID: <20180329081929.GA3186@localhost.localdomain> (raw)
In-Reply-To: <d7815ad8-c1a2-9444-deb9-b3a9c8fb3b50@gmail.com>
> On 3/27/18 11:11 AM, Lorenzo Bianconi wrote:
> > 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
> >
> > Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
> > ---
> > net/ipv6/route.c | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> > diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> > index 1d0eaa69874d..672fd7fdb037 100644
> > --- a/net/ipv6/route.c
> > +++ b/net/ipv6/route.c
> > @@ -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.
>
Ack, will do in v2.
Regards,
Lorenzo
> > + goto out;
> > + }
> > +
> > if (!(dev->flags & IFF_UP)) {
> > NL_SET_ERR_MSG(extack, "Nexthop device is not up");
> > err = -ENETDOWN;
> >
>
next prev parent reply other threads:[~2018-03-29 8:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-27 17:11 [PATCH net-next 0/2] do not allow to add routes if disable_ipv6 is enabled Lorenzo Bianconi
2018-03-27 17:11 ` [PATCH net-next 1/2] ipv6: do not set routes if disable_ipv6 has been enabled Lorenzo Bianconi
2018-03-28 19:12 ` David Ahern
2018-03-29 8:19 ` Lorenzo Bianconi [this message]
2018-03-27 17:11 ` [PATCH net-next 2/2] Documentation: ip-sysctl.txt: clarify disable_ipv6 Lorenzo Bianconi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180329081929.GA3186@localhost.localdomain \
--to=lorenzo.bianconi@redhat.com \
--cc=davem@davemloft.net \
--cc=dsahern@gmail.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).