netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Mahesh Bandewar (महेश बंडेवार)" <maheshb@google.com>
To: Eric Dumazet <edumazet@google.com>,
	ebiederm@xmission.com, adobriyan@gmail.com,
	David Miller <davem@davemloft.net>,
	xiyou.wangcong@gmail.com
Cc: linux-netdev <netdev@vger.kernel.org>
Subject: RFC: bring UP 'lo' by default after creating new netns
Date: Thu, 29 Jun 2017 16:57:39 -0700	[thread overview]
Message-ID: <CAF2d9jhTcVgLHs_iqw+RRS=WhMtRF0ra5SygGMymuYQUW6HP0A@mail.gmail.com> (raw)

Creation of new network namespace is almost always followed up by
bringing up the loopback device.

        ip netns add foo
        ip -netns foo link set lo up

I'm not sure if there are any consequences of bringing the device UP
at the creation of network-namespace.

thanks,
--mahesh..

diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 2178db8e47cd..ac0e86c9a17f 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -428,6 +428,11 @@ struct net *copy_net_ns(unsigned long flags,
                net_drop_ns(net);
                return ERR_PTR(rv);
        }
+       /* Set the loopback device UP */
+       rtnl_lock();
+       dev_open(net->loopback_dev);
+       rtnl_unlock();
+
        return net;
 }

             reply	other threads:[~2017-06-29 23:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-29 23:57 Mahesh Bandewar (महेश बंडेवार) [this message]
2017-06-30  1:08 ` RFC: bring UP 'lo' by default after creating new netns Eric W. Biederman
2017-06-30  6:26   ` Mahesh Bandewar (महेश बंडेवार)

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='CAF2d9jhTcVgLHs_iqw+RRS=WhMtRF0ra5SygGMymuYQUW6HP0A@mail.gmail.com' \
    --to=maheshb@google.com \
    --cc=adobriyan@gmail.com \
    --cc=davem@davemloft.net \
    --cc=ebiederm@xmission.com \
    --cc=edumazet@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=xiyou.wangcong@gmail.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).