From 261658e80014c031852a024f8794dd7f2a2351ad Mon Sep 17 00:00:00 2001 From: Bogdan Purcareata Date: Fri, 28 Mar 2014 10:31:41 -0400 Subject: [PATCH] config_network_type: set macvlan default mode to private 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 Signed-off-by: Serge Hallyn --- 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 d6cf1511c..90fb34400 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")) -- 2.47.2