From: Christian Brauner <christian.brauner@canonical.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: Christian Brauner <christian.brauner@ubuntu.com>,
netdev@vger.kernel.org, ebiederm@xmission.com, jbenc@redhat.com,
nicolas.dichtel@6wind.com, linux-kernel@vger.kernel.org,
dsahern@gmail.com, davem@davemloft.net
Subject: Re: [PATCH net 1/1 v1] rtnetlink: require unique netns identifier
Date: Sun, 4 Feb 2018 13:11:02 +0100 [thread overview]
Message-ID: <20180204121100.GA1344@gmail.com> (raw)
In-Reply-To: <20180203111701.2ff8d7a3@xeon-e3>
On Sat, Feb 03, 2018 at 11:17:01AM -0800, Stephen Hemminger wrote:
> On Sat, 3 Feb 2018 14:29:04 +0100
> Christian Brauner <christian.brauner@ubuntu.com> wrote:
>
> > +static int rtnl_ensure_unique_netns_attr(const struct sock *sk,
> > + struct nlattr *tb[],
> > + struct netlink_ext_ack *extack)
> > +{
> > + int ret = -EINVAL;
> > + struct net *net = NULL, *unique_net = NULL;
> > +
> > + /* Requests without network namespace ids have been able to specify
> > + * multiple properties referring to different network namespaces so
> > + * don't regress them.
> > + */
> > + if (!tb[IFLA_IF_NETNSID])
> > + return 0;
> > +
> > + if (!tb[IFLA_NET_NS_PID] && !tb[IFLA_NET_NS_FD])
> > + return 0;
>
> Isn't this an error?
My reasoning was that having no explicit network namespace identifying
attributes the caller operates on the current network namespace which is
uniquely identified.
>
> > +
> > + unique_net = get_net_ns_by_id(sock_net(sk), nla_get_s32(tb[IFLA_IF_NETNSID]));
> > + if (!unique_net)
> > + return -1;
>
> Other paths are returning errno, so why -1 here?
Yes, this should be -EINVAL as well.
Thanks!
Christian
next prev parent reply other threads:[~2018-02-04 12:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-03 13:29 [PATCH net 0/1 v1] rtnetlink: require unique netns identifier Christian Brauner
2018-02-03 13:29 ` [PATCH net 1/1 " Christian Brauner
2018-02-03 19:17 ` Stephen Hemminger
2018-02-04 2:09 ` David Ahern
2018-02-04 12:12 ` Christian Brauner
2018-02-04 12:11 ` Christian Brauner [this message]
2018-02-04 17:21 ` David Ahern
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=20180204121100.GA1344@gmail.com \
--to=christian.brauner@canonical.com \
--cc=christian.brauner@ubuntu.com \
--cc=davem@davemloft.net \
--cc=dsahern@gmail.com \
--cc=ebiederm@xmission.com \
--cc=jbenc@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nicolas.dichtel@6wind.com \
--cc=stephen@networkplumber.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).