[lxc-devel] [patch -lxc 2/2] keep the name of the physical interface

Daniel Lezcano dlezcano at fr.ibm.com
Thu Jul 22 14:31:28 UTC 2010


From: Daniel Lezcano <daniel.lezcano at free.fr>

When the interface used in the container is a physical
interface from the host, we keep the initial name.

Signed-off-by: Daniel Lezcano <dlezcano at fr.ibm.com>
Reported-by: Sabdar <sabdar at wellspringsys.com>
---
 src/lxc/conf.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/lxc/conf.c b/src/lxc/conf.c
index 3aaf31c..a118ae1 100644
--- a/src/lxc/conf.c
+++ b/src/lxc/conf.c
@@ -1025,7 +1025,8 @@ static int setup_netdev(struct lxc_netdev *netdev)
 
 	/* default: let the system to choose one interface name */
 	if (!netdev->name)
-		netdev->name = "eth%d";
+		netdev->name = netdev->type == LXC_NET_PHYS ?
+			netdev->link : "eth%d";
 
 	/* rename the interface name */
 	err = lxc_device_rename(ifname, netdev->name);
-- 
1.7.0.4





More information about the lxc-devel mailing list