[lxc-devel] [PATCH] config_network_type: set macvlan default mode to private

Bogdan Purcareata bogdan.purcareata at freescale.com
Fri Mar 28 14:31:41 UTC 2014


If a default mode is not set, the container requires an explicit
mode specified in the config file, otherwise creating the
container fails.

Signed-off-by: Bogdan Purcareata <bogdan.purcareata at freescale.com>
---
 src/lxc/confile.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/lxc/confile.c b/src/lxc/confile.c
index d6cf151..90fb344 100644
--- a/src/lxc/confile.c
+++ b/src/lxc/confile.c
@@ -303,6 +303,8 @@ out:
 	return ret;
 }
 
+static int macvlan_mode(int *valuep, const char *value);
+
 static int config_network_type(const char *key, const char *value,
 			       struct lxc_conf *lxc_conf)
 {
@@ -337,8 +339,10 @@ static int config_network_type(const char *key, const char *value,
 
 	if (!strcmp(value, "veth"))
 		netdev->type = LXC_NET_VETH;
-	else if (!strcmp(value, "macvlan"))
+	else if (!strcmp(value, "macvlan")) {
 		netdev->type = LXC_NET_MACVLAN;
+		macvlan_mode(&netdev->priv.macvlan_attr.mode, "private");
+	}
 	else if (!strcmp(value, "vlan"))
 		netdev->type = LXC_NET_VLAN;
 	else if (!strcmp(value, "phys"))
-- 
1.9.rc1




More information about the lxc-devel mailing list