public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: ebiederm-aS9lmoZGLiVWk0Htik3J/w@public•gmane.org (Eric W. Biederman)
To: Nicolas Dichtel
	<nicolas.dichtel-pdR9zngts4EAvxtiuMwx3w@public•gmane.org>
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public•gmane.org,
	containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public•gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public•gmane.org,
	luto-kltTT9wpgjJwATOyAt5JVQ@public•gmane.org,
	stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public•gmane.org,
	cwang-xCSkyg8dI+0RB7SZvlqPiA@public•gmane.org,
	linux-api-u79uwXL29TY76Z2rM5mHXA@public•gmane.org,
	akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public•gmane.org,
	davem-fT/PcQaiUtIeIZ0/mPfg9Q@public•gmane.org
Subject: Re: [PATCH net-next v4 0/4] netns: allow to identify peer netns
Date: Thu, 30 Oct 2014 11:41:03 -0700	[thread overview]
Message-ID: <871tpph03k.fsf@x220.int.ebiederm.org> (raw)
In-Reply-To: <1414682728-4532-1-git-send-email-nicolas.dichtel-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> (Nicolas Dichtel's message of "Thu, 30 Oct 2014 16:25:24 +0100")

Nicolas Dichtel <nicolas.dichtel-pdR9zngts4EAvxtiuMwx3w@public•gmane.org> writes:

> The goal of this serie is to be able to multicast netlink messages with an
> attribute that identify a peer netns.
> This is needed by the userland to interpret some informations contained in
> netlink messages (like IFLA_LINK value, but also some other attributes in case
> of x-netns netdevice (see also
> http://thread.gmane.org/gmane.linux.network/315933/focus=316064 and
> http://thread.gmane.org/gmane.linux.kernel.containers/28301/focus=4239)).
>
> Ids of peer netns are set by userland via a new genl messages. These ids are
> stored per netns and are local (ie only valid in the netns where they are set).
> To avoid allocating an int for each peer netns, I use idr_for_each() to retrieve
> the id of a peer netns. Note that it will be possible to add a table (struct net
> -> id) later to optimize this lookup if needed.
>
> Patch 1/4 introduces the netlink API mechanism to set and get these ids.
> Patch 2/4 and 3/4 implements an example of how to use these ids in rtnetlink
> messages. And patch 4/4 shows that the netlink messages can be symetric between
> a GET and a SET.
>
> iproute2 patches are available, I can send them on demand.

A quick reply.  I think this patchset is in the right general direction.
There are some oddball details that seem odd/awkward to me such as using
genetlink instead of rtnetlink to get and set the ids, and not having
ids if they are not set (that feels like a maintenance/usability challenge).

I would like to give your patches a deep review, but I won't be able to
do that for a couple of weeks.  I am deep in the process of moving,
and will be mostly offline until about the Nov 11th.

Eric


> Here is a small screenshot to show how it can be used by userland.
>
> First, setup netns and required ids:
> $ ip netns add foo
> $ ip netns del foo
> $ ip netns
> $ touch /var/run/netns/init_net
> $ mount --bind /proc/1/ns/net /var/run/netns/init_net
> $ ip netns add foo
> $ ip netns exec foo ip netns set init_net 0
> $ ip netns
> foo
> init_net
> $ ip netns exec foo ip netns
> foo
> init_net (id: 0)
>
> Now, add and display an ipip tunnel, with its link part in init_net (id 0 in
> netns foo) and the netdevice in foo:
> $ ip netns exec foo ip link add ipip1 link-netnsid 0 type ipip remote 10.16.0.121 local 10.16.0.249
> $ ip netns exec foo ip l ls ipip1
> 6: ipip1@NONE: <POINTOPOINT,NOARP> mtu 1480 qdisc noop state DOWN mode DEFAULT group default 
>     link/ipip 10.16.0.249 peer 10.16.0.121 link-netnsid 0
>
> The parameter link-netnsid shows us where the interface sends and receives
> packets (and thus we know where encapsulated addresses are set).
>
> RFCv3 -> v4:
>   rebase on net-next
>   add copyright text in the new netns.h file
>
> RFCv2 -> RFCv3:
>   ids are now defined by userland (via netlink). Ids are stored in each netns
>   (and they are local to this netns).
>   add get_link_net support for ip6 tunnels
>   netnsid is now a s32 instead of a u32
>
> RFCv1 -> RFCv2:
>   remove useless ()
>   ids are now stored in the user ns. It's possible to get an id for a peer netns
>   only if the current netns and the peer netns have the same user ns parent.
>
>  MAINTAINERS                  |   1 +
>  include/net/ip6_tunnel.h     |   1 +
>  include/net/ip_tunnels.h     |   1 +
>  include/net/net_namespace.h  |   5 ++
>  include/net/rtnetlink.h      |   2 +
>  include/uapi/linux/Kbuild    |   1 +
>  include/uapi/linux/if_link.h |   1 +
>  include/uapi/linux/netns.h   |  38 +++++++++
>  net/core/net_namespace.c     | 195 +++++++++++++++++++++++++++++++++++++++++++
>  net/core/rtnetlink.c         |  38 ++++++++-
>  net/ipv4/ip_gre.c            |   2 +
>  net/ipv4/ip_tunnel.c         |   8 ++
>  net/ipv4/ip_vti.c            |   1 +
>  net/ipv4/ipip.c              |   1 +
>  net/ipv6/ip6_gre.c           |   1 +
>  net/ipv6/ip6_tunnel.c        |   9 ++
>  net/ipv6/ip6_vti.c           |   1 +
>  net/ipv6/sit.c               |   1 +
>  net/netlink/genetlink.c      |   4 +
>  19 files changed, 308 insertions(+), 3 deletions(-)
>
> Comments are welcome.
>
> Regards,
> Nicolas

  parent reply	other threads:[~2014-10-30 18:41 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-23 13:20 [RFC PATCH net-next v2 0/5] netns: allow to identify peer netns Nicolas Dichtel
2014-09-23 13:20 ` [RFC PATCH net-next v2 1/5] netns: allocate netns ids Nicolas Dichtel
2014-09-23 13:20 ` [RFC PATCH net-next v2 2/5] netns: add genl cmd to get the id of a netns Nicolas Dichtel
2014-09-23 13:20 ` [RFC PATCH net-next v2 3/5] rtnl: add link netns id to interface messages Nicolas Dichtel
2014-09-23 13:20 ` [RFC PATCH net-next v2 4/5] iptunnels: advertise link netns via netlink Nicolas Dichtel
     [not found] ` <1411478430-4989-1-git-send-email-nicolas.dichtel-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2014-09-23 13:20   ` [RFC PATCH net-next v2 5/5] rtnl: allow to create device with IFLA_LINK_NETNSID set Nicolas Dichtel
2014-09-23 19:22   ` [RFC PATCH net-next v2 0/5] netns: allow to identify peer netns Cong Wang
     [not found]     ` <CAHA+R7NnBJ=T3sukzzp-OD2am1nd318XbrXCX84LfSL=nu9ojw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-09-24  9:23       ` Nicolas Dichtel
     [not found]         ` <54228D87.3070309-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2014-09-24 16:01           ` Cong Wang
     [not found]             ` <CAHA+R7NfJYzCsZx0E9YVXKVCQbCm_thPSi+80tix8Z9nVA82Ug-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-09-24 16:15               ` Cong Wang
     [not found]                 ` <CAHA+R7MVL=WpepRy8iz6iT6Kkq1RHG+b9TxJothP94ixyAj-3Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-09-24 16:31                   ` Nicolas Dichtel
     [not found]                     ` <5422F1F7.8010308-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2014-09-24 16:48                       ` Cong Wang
     [not found]                         ` <CAHA+R7MM04ew=J8sHfSQERwoCAgEDfrGgtgRORqs3ePgtjVYWg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-09-25  8:53                           ` Nicolas Dichtel
     [not found]                             ` <5423D808.7050800-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2014-09-26  1:58                               ` Cong Wang
     [not found]                                 ` <CAHA+R7OdOUMShX6Nphdfh8+fGiXyO+sGNHy0ch_XYh5dpURcmQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-09-26 13:38                                   ` Nicolas Dichtel
2014-09-24 16:27               ` Nicolas Dichtel
     [not found]                 ` <5422F0F4.6000709-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2014-09-24 16:45                   ` Cong Wang
     [not found]                     ` <CAHA+R7Ot2kLHb+ne5AW3bFNc87qkFOiEHEyDh9sFrsHqXgrY3g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-09-25  8:53                       ` Nicolas Dichtel
     [not found]                         ` <5423D80B.9060500-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2014-09-26  2:09                           ` Cong Wang
2014-09-26 13:40                             ` Nicolas Dichtel
     [not found]                               ` <54256CCB.4000709-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2014-09-26 19:15                                 ` David Ahern
     [not found]                                   ` <5425BB3E.10700-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-09-26 19:34                                     ` Eric W. Biederman
     [not found]                                       ` <87mw9myy4n.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>
2014-09-26 19:44                                         ` David Ahern
     [not found]                                           ` <5425C22F.7050301-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-09-26 20:45                                             ` Eric W. Biederman
     [not found]                                               ` <87tx3uun4q.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>
2014-09-26 20:56                                                 ` David Ahern
2014-09-23 19:26   ` Andy Lutomirski
     [not found]     ` <CALCETrWnZtWstBviDxcHpLpjHF3R+sgS48RYf2pbKBYeExZVOQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-09-24  9:31       ` Nicolas Dichtel
     [not found]         ` <54228F8B.2030804-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2014-09-24 17:05           ` Andy Lutomirski
     [not found]             ` <CALCETrXMkV_1XR2mXOoO_2_vpB=6cPbWAAOhPFhPbDa_1P+zxw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-09-25  7:54               ` Nicolas Dichtel
2014-09-26 18:10   ` Eric W. Biederman
     [not found]     ` <87ppei45ig.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>
2014-09-26 18:26       ` Andy Lutomirski
     [not found]         ` <CALCETrX5e0cp4QFCv1eAqR1hjoROU9Rh=cRos9U35DaR-py3Eg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-09-26 18:57           ` Eric W. Biederman
2014-09-29 12:06             ` Nicolas Dichtel
     [not found]               ` <54294B4E.70501-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2014-09-29 18:43                 ` Eric W. Biederman
     [not found]                   ` <87y4t2gtd0.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>
2014-10-02 13:46                     ` Nicolas Dichtel
     [not found]                       ` <542D5726.8070308-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2014-10-02 13:48                         ` [RFC PATCH net-next v3 0/4] " Nicolas Dichtel
     [not found]                           ` <1412257690-31253-1-git-send-email-nicolas.dichtel-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2014-10-02 13:48                             ` [RFC PATCH net-next v3 1/4] netns: add genl cmd to add and get peer netns ids Nicolas Dichtel
     [not found]                               ` <1412257690-31253-2-git-send-email-nicolas.dichtel-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2014-10-02 19:33                                 ` Eric W. Biederman
     [not found]                                   ` <87tx3mmflp.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>
2014-10-03 12:22                                     ` Nicolas Dichtel
2014-10-02 13:48                             ` [RFC PATCH net-next v3 2/4] rtnl: add link netns id to interface messages Nicolas Dichtel
2014-10-02 13:48                             ` [RFC PATCH net-next v3 3/4] iptunnels: advertise link netns via netlink Nicolas Dichtel
2014-10-02 13:48                             ` [RFC PATCH net-next v3 4/4] rtnl: allow to create device with IFLA_LINK_NETNSID set Nicolas Dichtel
2014-10-30 15:25                             ` [PATCH net-next v4 0/4] netns: allow to identify peer netns Nicolas Dichtel
2014-10-30 15:25                               ` [PATCH net-next v4 1/4] netns: add genl cmd to add and get peer netns ids Nicolas Dichtel
     [not found]                                 ` <1414682728-4532-2-git-send-email-nicolas.dichtel-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2014-10-30 18:35                                   ` Eric W. Biederman
     [not found]                                     ` <874mulh0cs.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>
2014-10-31  9:41                                       ` Nicolas Dichtel
     [not found]                               ` <1414682728-4532-1-git-send-email-nicolas.dichtel-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2014-10-30 15:25                                 ` [PATCH net-next v4 2/4] rtnl: add link netns id to interface messages Nicolas Dichtel
2014-10-30 15:25                                 ` [PATCH net-next v4 3/4] iptunnels: advertise link netns via netlink Nicolas Dichtel
2014-10-30 15:25                                 ` [PATCH net-next v4 4/4] rtnl: allow to create device with IFLA_LINK_NETNSID set Nicolas Dichtel
2014-10-30 18:41                                 ` Eric W. Biederman [this message]
     [not found]                                   ` <871tpph03k.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>
2014-10-31  9:48                                     ` [PATCH net-next v4 0/4] netns: allow to identify peer netns Nicolas Dichtel
     [not found]                                       ` <54535B00.5090708-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2014-10-31 19:14                                         ` Eric W. Biederman
     [not found]                                           ` <87wq7g831b.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>
2014-11-05 14:23                                             ` Nicolas Dichtel
     [not found]                                               ` <545A32C4.7070108-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2014-12-04 16:21                                                 ` Nicolas Dichtel
2015-01-15 14:11                                           ` [PATCH net-next v5 " Nicolas Dichtel
2015-01-15 14:11                                             ` [PATCH net-next v5 1/4] netns: add rtnl cmd to add and get peer netns ids Nicolas Dichtel
2015-01-15 14:11                                             ` [PATCH net-next v5 2/4] rtnl: add link netns id to interface messages Nicolas Dichtel
2015-01-15 14:11                                             ` [PATCH net-next v5 3/4] tunnels: advertise link netns via netlink Nicolas Dichtel
2015-01-15 14:11                                             ` [PATCH net-next v5 4/4] rtnl: allow to create device with IFLA_LINK_NETNSID set Nicolas Dichtel
     [not found]                                             ` <1421331078-21622-1-git-send-email-nicolas.dichtel-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2015-01-19 19:16                                               ` [PATCH net-next v5 0/4] netns: allow to identify peer netns David Miller
2014-11-01 21:08                                     ` [PATCH net-next v4 " David Miller
2014-11-24 13:45                                     ` Nicolas Dichtel
2014-10-02 19:20                         ` [RFC PATCH net-next v2 0/5] " Eric W. Biederman
     [not found]                           ` <8761g2nurx.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>
2014-10-02 19:31                             ` Andy Lutomirski
     [not found]                               ` <CALCETrWxqzUF1x+TmW5G4kuHPP+sUtiRaT6dpZ0mQTJ217QB5w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-10-02 19:45                                 ` Eric W. Biederman
     [not found]                                   ` <877g0il0gd.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>
2014-10-02 19:48                                     ` Andy Lutomirski
2014-10-03 12:22                             ` Nicolas Dichtel

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=871tpph03k.fsf@x220.int.ebiederm.org \
    --to=ebiederm-as9lmozglivwk0htik3j/w@public$(echo .)gmane.org \
    --cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public$(echo .)gmane.org \
    --cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public$(echo .)gmane.org \
    --cc=cwang-xCSkyg8dI+0RB7SZvlqPiA@public$(echo .)gmane.org \
    --cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public$(echo .)gmane.org \
    --cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public$(echo .)gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public$(echo .)gmane.org \
    --cc=luto-kltTT9wpgjJwATOyAt5JVQ@public$(echo .)gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public$(echo .)gmane.org \
    --cc=nicolas.dichtel-pdR9zngts4EAvxtiuMwx3w@public$(echo .)gmane.org \
    --cc=stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public$(echo .)gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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