netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: nicolas.dichtel@6wind.com
Cc: Eugene Yakubovich <eugene.yakubovich@coreos.com>, netdev@vger.kernel.org
Subject: Re: new link failing on duplicate names in different namespaces
Date: Wed, 25 Feb 2015 11:44:05 -0600	[thread overview]
Message-ID: <8761apubru.fsf@x220.int.ebiederm.org> (raw)
In-Reply-To: <54EDF7BB.2060809@6wind.com> (Nicolas Dichtel's message of "Wed, 25 Feb 2015 17:26:35 +0100")

Nicolas Dichtel <nicolas.dichtel@6wind.com> writes:

> Le 25/02/2015 01:48, Eugene Yakubovich a écrit :
>> Hello,
>>
>> rtnetlink's RTM_NEWLINK allows for specifying the network namespace in
>> which the link is to be created via IFLA_NET_NS_PID or IFLA_NET_NS_FD.
>> This not only saves a user a call to move the link into the target
>> namespace, it can avoid a potential ifname conflict. For example, if
>> creating eth0 in another namespace and the current one already has
>> eth0.
>>
>> Unfortunately, this is not the current behavior. If the user specifies
>> IFLA_IFNAME, leaves ifinfomsg.ifi_index unspecified and sets
>> NLM_F_EXCL flag, as in the case of creating a new link, the call will
>> fail with EEXIST in cases where there's a name conflict.
>>
>> rtnl_newlink() will:
>>
>> if (ifname[0])
>>      dev = __dev_get_by_name(net, ifname);
> Yes, it seems that this should be done in "dest_net" or "link_net".

Ugh.  Looking at that code I think the link_net is at best extremely
confusing most likely semantically broken the way it is being
interpreted in rtnl_newlink.  More in another email message.

The original semantics and what seems mostly reasonable because the
network device in some sense lives in multiple network namespaces
as it is being created is that the network device name be unique
in both namespaces.

The code that creates a network devices fundamentally needs to know
about both namespaces network devices like the macvlan driver need
to find their lower devices in the original network namespace.

I think we could possibly remove the restriction for the names of newly
created network devices being unique in both network namespaces but I
don't think the code changes will be trivial.

Eric

  reply	other threads:[~2015-02-25 17:47 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-25  0:48 new link failing on duplicate names in different namespaces Eugene Yakubovich
2015-02-25 16:26 ` Nicolas Dichtel
2015-02-25 17:44   ` Eric W. Biederman [this message]
2015-02-26  5:29     ` Cong Wang
2015-02-26  5:56       ` Cong Wang
2015-02-26  9:14         ` Nicolas Dichtel
2015-02-26 13:55           ` Eric W. Biederman
2015-02-26 14:40             ` Nicolas Dichtel
2015-02-27  0:22           ` Cong Wang
2015-02-25 19:03   ` What are the intended semantics of IFLA_LINK_NETNSID? Eric W. Biederman
2015-02-26  5:07     ` Cong Wang
2015-02-26  8:55     ` Nicolas Dichtel
2015-02-26 13:48       ` Eric W. Biederman
2015-02-26 14:52         ` Nicolas Dichtel
2015-02-26 22:19           ` [PATCH net 1/2] net: Verify permission to dest_net in newlink Eric W. Biederman
2015-02-26 22:20             ` [PATCH net 2/2] net: Verify permission to link_net " Eric W. Biederman
2015-02-27  9:03               ` Nicolas Dichtel
2015-02-28 20:15               ` David Miller
2015-02-27  9:03             ` [PATCH net 1/2] net: Verify permission to dest_net " Nicolas Dichtel
2015-02-28 20:15             ` David Miller

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=8761apubru.fsf@x220.int.ebiederm.org \
    --to=ebiederm@xmission.com \
    --cc=eugene.yakubovich@coreos.com \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.dichtel@6wind.com \
    /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).