From: dlezcano Date: Fri, 14 Nov 2008 16:16:35 +0000 (+0000) Subject: Change at compilation time the destruction of the network devices X-Git-Tag: lxc_0_5_0~47 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b7c9b19991eba0499298a0848751629cd1ff5ec0;p=thirdparty%2Flxc.git Change at compilation time the destruction of the network devices From: Daniel Lezcano The future kernel version will automatically autodestroy the network devices when the network namespace exits. This is not the case for the current version. In order to handle the both cases, I added a configuration option to disable the network destruction when the container exits: --disable-network-destroy Signed-off-by: Daniel Lezcano --- diff --git a/configure.in b/configure.in index ebeca46d8..7a187f22a 100644 --- a/configure.in +++ b/configure.in @@ -1,7 +1,7 @@ # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. -AC_INIT([lxc], [0.4.0]) +AC_INIT([lxc], [0.4.1]) AC_CONFIG_SRCDIR([configure.in]) AC_CONFIG_AUX_DIR([config]) @@ -28,6 +28,11 @@ LXC_MAJOR_VERSION=$(echo $PACKAGE_VERSION | cut -d. -f1) LXC_MINOR_VERSION=$(echo $PACKAGE_VERSION | cut -d. -f2) LXC_MICRO_VERSION=$(echo $PACKAGE_VERSION | cut -d. -f3) +AC_ARG_ENABLE(network_destroy, [ --disable-network-destroy disable network destruction at exit [default=no]],, enable_network_destroy=yes) +if test "x$enable_network_destroy" = "xyes"; then + CFLAGS="$CFLAGS -DNETWORK_DESTROY" +fi + AC_SUBST(LXC_MAJOR_VERSION) AC_SUBST(LXC_MINOR_VERSION) AC_SUBST(LXC_MICRO_VERSION) diff --git a/src/lxc/start.c b/src/lxc/start.c index 225cb1a32..bf233cd2e 100644 --- a/src/lxc/start.c +++ b/src/lxc/start.c @@ -218,8 +218,10 @@ wait_again: if (lxc_setstate(name, STOPPING)) lxc_log_error("failed to set state %s", lxc_state2str(STOPPING)); +#ifdef NETWORK_DESTROY if (clone_flags & CLONE_NEWNET && conf_destroy_network(name)) lxc_log_error("failed to destroy the network"); +#endif err = 0; out: @@ -242,8 +244,10 @@ err_state_failed: err_child_failed: err_pipe_read2: err_pipe_write: +#ifdef NETWORK_DESTROY if (clone_flags & CLONE_NEWNET) conf_destroy_network(name); +#endif err_create_network: err_pipe_read: err_waitpid_failed: