netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Loopback and net namespace
@ 2009-04-24 21:55 emil
  2009-04-25  5:19 ` David Miller
  2009-04-25 14:00 ` Serge E. Hallyn
  0 siblings, 2 replies; 4+ messages in thread
From: emil @ 2009-04-24 21:55 UTC (permalink / raw)
  To: netdev


Currently it is impossible to use both net namespace and sysfs
because sysfs does not allow two devices with the same name
and each net namespace has to have loopback device.

To have this working there must be possibility to
create loopback devices with different names.

The easiest way to acomplish this seems to be with this patch below.

I know the devices will be seen in each namespace, but sometimes
the only thing that is needed is network environment separation.
For example when I need to run two different services on the same TCP port
bound to 0.0.0.0.

This patch will not break anything and allow people to test
net namespace functionality.


Emil Stepniewski



----------------------- CUT HERE ------------------------------

--- /usr/src/linux/drivers/net/loopback.c  2008-04-17 04:49:44.000000000 +0200
+++ /usr/src/linux/drivers/net/loopback.c.new      2009-04-24 23:27:43.000000000 +0200
@@ -254,7 +254,11 @@
         int err;

         err = -ENOMEM;
+#ifdef CONFIG_SYSFS
+       dev = alloc_netdev(0,  (net == &init_net) ? "lo" : "lo%d", loopback_setup);
+#else
         dev = alloc_netdev(0, "lo", loopback_setup);
+#endif
         if (!dev)
                 goto out;


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-04-25 19:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-24 21:55 Loopback and net namespace emil
2009-04-25  5:19 ` David Miller
2009-04-25 19:50   ` Daniel Lezcano
2009-04-25 14:00 ` Serge E. Hallyn

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).