netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Brauner <christian.brauner@canonical.com>
To: David Ahern <dsahern@gmail.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	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,
	davem@davemloft.net
Subject: Re: [PATCH net 1/1 v1] rtnetlink: require unique netns identifier
Date: Sun, 4 Feb 2018 13:12:08 +0100	[thread overview]
Message-ID: <20180204121207.GB1344@gmail.com> (raw)
In-Reply-To: <0e8a86e6-5948-1e91-d937-893eb62ceef1@gmail.com>

On Sat, Feb 03, 2018 at 07:09:55PM -0700, David Ahern wrote:
> On 2/3/18 12:17 PM, 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?
> > 
> >> +
> >> +	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?
> > 
> 
> extack needs to be filled in too.

Yeah, it should report that an invalid network namespace identifier has
been specified.

Thanks!
Christian

  reply	other threads:[~2018-02-04 12:12 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 [this message]
2018-02-04 12:11     ` Christian Brauner
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=20180204121207.GB1344@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).