[lxc-devel] [lxc/master] confile: clear lxc.network.<n>.ipv{4, 6} when empty

brauner on Github lxc-bot at linuxcontainers.org
Mon Feb 6 22:09:35 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 382 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170206/8eef6f45/attachment.bin>
-------------- next part --------------
From 0797e123e0b489fed5fadcb4ab06ab5277468b85 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Mon, 6 Feb 2017 23:08:26 +0100
Subject: [PATCH] confile: clear lxc.network.<n>.ipv{4,6} when empty

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 src/lxc/confile.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/lxc/confile.c b/src/lxc/confile.c
index 7ed3bf0..db0aa33 100644
--- a/src/lxc/confile.c
+++ b/src/lxc/confile.c
@@ -870,6 +870,9 @@ static int config_network_ipv4(const char *key, const char *value,
 	struct lxc_list *list;
 	char *cursor, *slash, *addr = NULL, *bcast = NULL, *prefix = NULL;
 
+	if (!value || !strlen(value))
+		return lxc_clear_config_item(lxc_conf, key);
+
 	netdev = network_netdev(key, value, &lxc_conf->network);
 	if (!netdev)
 		return -1;
@@ -997,6 +1000,9 @@ static int config_network_ipv6(const char *key, const char *value,
 	char *slash,*valdup;
 	char *netmask;
 
+	if (!value || !strlen(value))
+		return lxc_clear_config_item(lxc_conf, key);
+
 	netdev = network_netdev(key, value, &lxc_conf->network);
 	if (!netdev)
 		return -1;


More information about the lxc-devel mailing list