[lxc-devel] [lxc/master] tree-wide: remove legacy codepaths
brauner on Github
lxc-bot at linuxcontainers.org
Sat Feb 10 23:13:31 UTC 2018
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 364 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180210/6baacaa0/attachment.bin>
-------------- next part --------------
From df0e4b7f1e9ee22f0f02bbb2261d9957c516b565 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Sun, 11 Feb 2018 00:12:36 +0100
Subject: [PATCH] tree-wide: remove legacy codepaths
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
src/lxc/Makefile.am | 2 -
src/lxc/conf.h | 6 -
src/lxc/confile.c | 271 +++------
src/lxc/confile.h | 1 -
src/lxc/confile_legacy.c | 1244 ----------------------------------------
src/lxc/confile_legacy.h | 91 ---
src/lxc/lxccontainer.c | 25 +-
src/lxc/network.c | 7 -
src/lxc/tools/lxc_attach.c | 3 -
src/lxc/tools/lxc_autostart.c | 3 -
src/lxc/tools/lxc_cgroup.c | 3 -
src/lxc/tools/lxc_checkpoint.c | 3 -
src/lxc/tools/lxc_clone.c | 2 -
src/lxc/tools/lxc_config.c | 2 -
src/lxc/tools/lxc_console.c | 3 -
src/lxc/tools/lxc_copy.c | 3 -
src/lxc/tools/lxc_create.c | 3 -
src/lxc/tools/lxc_destroy.c | 3 -
src/lxc/tools/lxc_device.c | 3 -
src/lxc/tools/lxc_execute.c | 3 -
src/lxc/tools/lxc_freeze.c | 3 -
src/lxc/tools/lxc_info.c | 3 -
src/lxc/tools/lxc_ls.c | 8 -
src/lxc/tools/lxc_monitor.c | 3 -
src/lxc/tools/lxc_snapshot.c | 3 -
src/lxc/tools/lxc_start.c | 3 -
src/lxc/tools/lxc_stop.c | 3 -
src/lxc/tools/lxc_unfreeze.c | 3 -
src/lxc/tools/lxc_wait.c | 3 -
29 files changed, 83 insertions(+), 1630 deletions(-)
delete mode 100644 src/lxc/confile_legacy.c
delete mode 100644 src/lxc/confile_legacy.h
diff --git a/src/lxc/Makefile.am b/src/lxc/Makefile.am
index 8f9a7ab29..6f6e2d4e0 100644
--- a/src/lxc/Makefile.am
+++ b/src/lxc/Makefile.am
@@ -23,7 +23,6 @@ noinst_HEADERS = \
caps.h \
conf.h \
confile.h \
- confile_legacy.h \
confile_utils.h \
console.h \
error.h \
@@ -111,7 +110,6 @@ liblxc_la_SOURCES = \
namespace.h namespace.c \
conf.c conf.h \
confile.c confile.h \
- confile_legacy.c confile_legacy.h \
confile_utils.c confile_utils.h \
list.h \
state.c state.h \
diff --git a/src/lxc/conf.h b/src/lxc/conf.h
index 2e90976a9..c5f27336a 100644
--- a/src/lxc/conf.h
+++ b/src/lxc/conf.h
@@ -391,12 +391,6 @@ struct lxc_conf {
/* RLIMIT_* limits */
struct lxc_list limits;
- /* REMOVE IN LXC 3.0
- * Indicator whether the current config file we're using contained any
- * legacy configuration keys.
- */
- bool contains_legacy_key;
-
/* Contains generic info about the cgroup configuration for this
* container. Note that struct lxc_cgroup contains a union. It is only
* valid to access the members of the anonymous "meta" struct within
diff --git a/src/lxc/confile.c b/src/lxc/confile.c
index 5ae613969..73c0b2f10 100644
--- a/src/lxc/confile.c
+++ b/src/lxc/confile.c
@@ -47,7 +47,6 @@
#include "conf.h"
#include "config.h"
#include "confile.h"
-#include "confile_legacy.h"
#include "confile_utils.h"
#include "log.h"
#include "lxcseccomp.h"
@@ -128,11 +127,9 @@ lxc_config_define(net_type);
lxc_config_define(net_veth_pair);
lxc_config_define(net_vlan_id);
lxc_config_define(no_new_privs);
-lxc_config_define(noop);
lxc_config_define(personality);
lxc_config_define(prlimit);
lxc_config_define(pty_max);
-lxc_config_define(rootfs_backend);
lxc_config_define(rootfs_mount);
lxc_config_define(rootfs_options);
lxc_config_define(rootfs_path);
@@ -149,138 +146,88 @@ lxc_config_define(sysctl);
lxc_config_define(proc);
static struct lxc_config_t config[] = {
- /* REMOVE in LXC 3.0 */
- { "lxc.arch", false, set_config_personality, get_config_personality, clr_config_personality, },
- { "lxc.apparmor.profile", false, set_config_apparmor_profile, get_config_apparmor_profile, clr_config_apparmor_profile, },
- { "lxc.apparmor.allow_incomplete", false, set_config_apparmor_allow_incomplete, get_config_apparmor_allow_incomplete, clr_config_apparmor_allow_incomplete, },
- { "lxc.autodev", false, set_config_autodev, get_config_autodev, clr_config_autodev, },
- { "lxc.cap.drop", false, set_config_cap_drop, get_config_cap_drop, clr_config_cap_drop, },
- { "lxc.cap.keep", false, set_config_cap_keep, get_config_cap_keep, clr_config_cap_keep, },
- { "lxc.cgroup2", false, set_config_cgroup2_controller, get_config_cgroup2_controller, clr_config_cgroup2_controller, },
- { "lxc.cgroup.dir", false, set_config_cgroup_dir, get_config_cgroup_dir, clr_config_cgroup_dir, },
- { "lxc.cgroup", false, set_config_cgroup_controller, get_config_cgroup_controller, clr_config_cgroup_controller, },
- { "lxc.console.buffer.logfile", false, set_config_console_buffer_logfile, get_config_console_buffer_logfile, clr_config_console_buffer_logfile, },
- { "lxc.console.buffer.size", false, set_config_console_buffer_size, get_config_console_buffer_size, clr_config_console_buffer_size, },
- { "lxc.console.logfile", false, set_config_console_logfile, get_config_console_logfile, clr_config_console_logfile, },
- { "lxc.console.path", false, set_config_console_path, get_config_console_path, clr_config_console_path, },
- { "lxc.console.rotate", false, set_config_console_rotate, get_config_console_rotate, clr_config_console_rotate, },
- { "lxc.environment", false, set_config_environment, get_config_environment, clr_config_environment, },
- { "lxc.ephemeral", false, set_config_ephemeral, get_config_ephemeral, clr_config_ephemeral, },
- { "lxc.execute.cmd", false, set_config_execute_cmd, get_config_execute_cmd, clr_config_execute_cmd, },
- { "lxc.group", false, set_config_group, get_config_group, clr_config_group, },
- { "lxc.hook.autodev", false, set_config_hooks, get_config_hooks, clr_config_hooks, },
- { "lxc.hook.clone", false, set_config_hooks, get_config_hooks, clr_config_hooks, },
- { "lxc.hook.destroy", false, set_config_hooks, get_config_hooks, clr_config_hooks, },
- { "lxc.hook.mount", false, set_config_hooks, get_config_hooks, clr_config_hooks, },
- { "lxc.hook.post-stop", false, set_config_hooks, get_config_hooks, clr_config_hooks, },
- { "lxc.hook.pre-mount", false, set_config_hooks, get_config_hooks, clr_config_hooks, },
- { "lxc.hook.pre-start", false, set_config_hooks, get_config_hooks, clr_config_hooks, },
- { "lxc.hook.start", false, set_config_hooks, get_config_hooks, clr_config_hooks, },
- { "lxc.hook.start-host", false, set_config_hooks, get_config_hooks, clr_config_hooks, },
- { "lxc.hook.stop", false, set_config_hooks, get_config_hooks, clr_config_hooks, },
- { "lxc.hook.version", false, set_config_hooks_version, get_config_hooks_version, clr_config_hooks_version, },
- { "lxc.hook", false, set_config_hooks, get_config_hooks, clr_config_hooks, },
- { "lxc.idmap", false, set_config_idmaps, get_config_idmaps, clr_config_idmaps, },
- { "lxc.include", false, set_config_includefiles, get_config_includefiles, clr_config_includefiles, },
- { "lxc.init.cmd", false, set_config_init_cmd, get_config_init_cmd, clr_config_init_cmd, },
- { "lxc.init.gid", false, set_config_init_gid, get_config_init_gid, clr_config_init_gid, },
- { "lxc.init.uid", false, set_config_init_uid, get_config_init_uid, clr_config_init_uid, },
- { "lxc.init.cwd", false, set_config_init_cwd, get_config_init_cwd, clr_config_init_cwd, },
- { "lxc.log.file", false, set_config_log_file, get_config_log_file, clr_config_log_file, },
- { "lxc.log.level", false, set_config_log_level, get_config_log_level, clr_config_log_level, },
- { "lxc.log.syslog", false, set_config_log_syslog, get_config_log_syslog, clr_config_log_syslog, },
- { "lxc.monitor.unshare", false, set_config_monitor, get_config_monitor, clr_config_monitor, },
- { "lxc.mount.auto", false, set_config_mount_auto, get_config_mount_auto, clr_config_mount_auto, },
- { "lxc.mount.entry", false, set_config_mount, get_config_mount, clr_config_mount, },
- { "lxc.mount.fstab", false, set_config_mount_fstab, get_config_mount_fstab, clr_config_mount_fstab, },
- { "lxc.namespace.clone", false, set_config_namespace_clone, get_config_namespace_clone, clr_config_namespace_clone, },
- { "lxc.namespace.keep", false, set_config_namespace_keep, get_config_namespace_keep, clr_config_namespace_keep, },
- { "lxc.namespace.share", false, set_config_namespace_share, get_config_namespace_share, clr_config_namespace_share, },
-
- /* [START]: REMOVE IN LXC 3.0 */
- { "lxc.network.type", true, set_config_network_legacy_type, get_config_network_legacy_item, clr_config_network_legacy_item, },
- { "lxc.network.flags", true, set_config_network_legacy_flags, get_config_network_legacy_item, clr_config_network_legacy_item, },
- { "lxc.network.link", true, set_config_network_legacy_link, get_config_network_legacy_item, clr_config_network_legacy_item, },
- { "lxc.network.name", true, set_config_network_legacy_name, get_config_network_legacy_item, clr_config_network_legacy_item, },
- { "lxc.network.macvlan.mode", true, set_config_network_legacy_macvlan_mode, get_config_network_legacy_item, clr_config_network_legacy_item, },
- { "lxc.network.veth.pair", true, set_config_network_legacy_veth_pair, get_config_network_legacy_item, clr_config_network_legacy_item, },
- { "lxc.network.script.up", true, set_config_network_legacy_script_up, get_config_network_legacy_item, clr_config_network_legacy_item, },
- { "lxc.network.script.down", true, set_config_network_legacy_script_down, get_config_network_legacy_item, clr_config_network_legacy_item, },
- { "lxc.network.hwaddr", true, set_config_network_legacy_hwaddr, get_config_network_legacy_item, clr_config_network_legacy_item, },
- { "lxc.network.mtu", true, set_config_network_legacy_mtu, get_config_network_legacy_item, clr_config_network_legacy_item, },
- { "lxc.network.vlan.id", true, set_config_network_legacy_vlan_id, get_config_network_legacy_item, clr_config_network_legacy_item, },
- { "lxc.network.ipv4.gateway", true, set_config_network_legacy_ipv4_gateway, get_config_network_legacy_item, clr_config_network_legacy_item, },
- { "lxc.network.ipv4", true, set_config_network_legacy_ipv4, get_config_network_legacy_item, clr_config_network_legacy_item, },
- { "lxc.network.ipv6.gateway", true, set_config_network_legacy_ipv6_gateway, get_config_network_legacy_item, clr_config_network_legacy_item, },
- { "lxc.network.ipv6", true, set_config_network_legacy_ipv6, get_config_network_legacy_item, clr_config_network_legacy_item, },
- { "lxc.network.", true, set_config_network_legacy_nic, get_config_network_legacy_item, clr_config_network_legacy_item, },
- { "lxc.network", true, set_config_network_legacy, get_config_network_legacy, clr_config_network_legacy, },
- /* [END]: REMOVE IN LXC 3.0 */
-
- { "lxc.net.flags", false, set_config_net_flags, get_config_net_flags, clr_config_net_flags, },
- { "lxc.net.hwaddr", false, set_config_net_hwaddr, get_config_net_hwaddr, clr_config_net_hwaddr, },
- { "lxc.net.ipv4.address", false, set_config_net_ipv4_address, get_config_net_ipv4_address, clr_config_net_ipv4_address, },
- { "lxc.net.ipv4.gateway", false, set_config_net_ipv4_gateway, get_config_net_ipv4_gateway, clr_config_net_ipv4_gateway, },
- { "lxc.net.ipv6.address", false, set_config_net_ipv6_address, get_config_net_ipv6_address, clr_config_net_ipv6_address, },
- { "lxc.net.ipv6.gateway", false, set_config_net_ipv6_gateway, get_config_net_ipv6_gateway, clr_config_net_ipv6_gateway, },
- { "lxc.net.link", false, set_config_net_link, get_config_net_link, clr_config_net_link, },
- { "lxc.net.macvlan.mode", false, set_config_net_macvlan_mode, get_config_net_macvlan_mode, clr_config_net_macvlan_mode, },
- { "lxc.net.mtu", false, set_config_net_mtu, get_config_net_mtu, clr_config_net_mtu, },
- { "lxc.net.name", false, set_config_net_name, get_config_net_name, clr_config_net_name, },
- { "lxc.net.script.down", false, set_config_net_script_down, get_config_net_script_down, clr_config_net_script_down, },
- { "lxc.net.script.up", false, set_config_net_script_up, get_config_net_script_up, clr_config_net_script_up, },
- { "lxc.net.type", false, set_config_net_type, get_config_net_type, clr_config_net_type, },
- { "lxc.net.vlan.id", false, set_config_net_vlan_id, get_config_net_vlan_id, clr_config_net_vlan_id, },
- { "lxc.net.veth.pair", false, set_config_net_veth_pair, get_config_net_veth_pair, clr_config_net_veth_pair, },
- { "lxc.net.", false, set_config_net_nic, get_config_net_nic, clr_config_net_nic, },
- { "lxc.net", false, set_config_net, get_config_net, clr_config_net, },
- { "lxc.no_new_privs", false, set_config_no_new_privs, get_config_no_new_privs, clr_config_no_new_privs, },
- { "lxc.prlimit", false, set_config_prlimit, get_config_prlimit, clr_config_prlimit, },
- { "lxc.pty.max", false, set_config_pty_max, get_config_pty_max, clr_config_pty_max, },
- { "lxc.rootfs.mount", false, set_config_rootfs_mount, get_config_rootfs_mount, clr_config_rootfs_mount, },
- { "lxc.rootfs.options", false, set_config_rootfs_options, get_config_rootfs_options, clr_config_rootfs_options, },
- { "lxc.rootfs.path", false, set_config_rootfs_path, get_config_rootfs_path, clr_config_rootfs_path, },
- { "lxc.seccomp.profile", false, set_config_seccomp_profile, get_config_seccomp_profile, clr_config_seccomp_profile, },
- { "lxc.selinux.context", false, set_config_selinux_context, get_config_selinux_context, clr_config_selinux_context, },
- { "lxc.signal.halt", false, set_config_signal_halt, get_config_signal_halt, clr_config_signal_halt, },
- { "lxc.signal.reboot", false, set_config_signal_reboot, get_config_signal_reboot, clr_config_signal_reboot, },
- { "lxc.signal.stop", false, set_config_signal_stop, get_config_signal_stop, clr_config_signal_stop, },
- { "lxc.start.auto", false, set_config_start, get_config_start, clr_config_start, },
- { "lxc.start.delay", false, set_config_start, get_config_start, clr_config_start, },
- { "lxc.start.order", false, set_config_start, get_config_start, clr_config_start, },
- { "lxc.tty.dir", false, set_config_tty_dir, get_config_tty_dir, clr_config_tty_dir, },
- { "lxc.tty.max", false, set_config_tty_max, get_config_tty_max, clr_config_tty_max, },
- { "lxc.uts.name", false, set_config_uts_name, get_config_uts_name, clr_config_uts_name, },
- { "lxc.sysctl", false, set_config_sysctl, get_config_sysctl, clr_config_sysctl, },
- { "lxc.proc", false, set_config_proc, get_config_proc, clr_config_proc, },
-
- /* [START]: REMOVE IN LXC 3.0 */
- { "lxc.pts", true, set_config_pty_max, get_config_pty_max, clr_config_pty_max, },
- { "lxc.devttydir", true, set_config_tty_dir, get_config_tty_dir, clr_config_tty_dir, },
- { "lxc.tty", true, set_config_tty_max, get_config_tty_max, clr_config_tty_max, },
- { "lxc.aa_profile", true, set_config_lsm_aa_profile, get_config_lsm_aa_profile, clr_config_lsm_aa_profile, },
- { "lxc.aa_allow_incomplete", true, set_config_lsm_aa_incomplete, get_config_lsm_aa_incomplete, clr_config_lsm_aa_incomplete, },
- { "lxc.se_context", true, set_config_lsm_se_context, get_config_lsm_se_context, clr_config_lsm_se_context, },
- { "lxc.id_map", true, set_config_idmaps, get_config_idmaps, clr_config_idmaps, },
- { "lxc.mount", true, set_config_mount_fstab, get_config_mount_fstab, clr_config_mount_fstab, },
- { "lxc.rootfs.backend", true, set_config_rootfs_backend, get_config_rootfs_backend, clr_config_rootfs_backend, },
- { "lxc.rootfs", true, set_config_rootfs_path, get_config_rootfs_path, clr_config_rootfs_path, },
- { "lxc.utsname", true, set_config_uts_name, get_config_uts_name, clr_config_uts_name, },
- { "lxc.seccomp", true, set_config_seccomp_profile, get_config_seccomp_profile, clr_config_seccomp_profile, },
- { "lxc.console", true, set_config_console_path, get_config_console_path, clr_config_console_path, },
- { "lxc.haltsignal", true, set_config_signal_halt, get_config_signal_halt, clr_config_signal_halt, },
- { "lxc.rebootsignal", true, set_config_signal_reboot, get_config_signal_reboot, clr_config_signal_reboot, },
- { "lxc.stopsignal", true, set_config_signal_stop, get_config_signal_stop, clr_config_signal_stop, },
- { "lxc.syslog", true, set_config_log_syslog, get_config_log_syslog, clr_config_log_syslog, },
- { "lxc.kmsg", true, set_config_noop, get_config_noop, clr_config_noop, },
- { "lxc.loglevel", true, set_config_log_level, get_config_log_level, clr_config_log_level, },
- { "lxc.logfile", true, set_config_log_file, get_config_log_file, clr_config_log_file, },
- { "lxc.init_cmd", true, set_config_init_cmd, get_config_init_cmd, clr_config_init_cmd, },
- { "lxc.init_uid", true, set_config_init_uid, get_config_init_uid, clr_config_init_uid, },
- { "lxc.init_gid", true, set_config_init_gid, get_config_init_gid, clr_config_init_gid, },
- { "lxc.limit", true, set_config_limit, get_config_limit, clr_config_limit, },
- { "lxc.pivotdir", true, set_config_noop, get_config_noop, clr_config_noop, },
- /* [END]: REMOVE IN LXC 3.0 */
+ { "lxc.arch", set_config_personality, get_config_personality, clr_config_personality, },
+ { "lxc.apparmor.profile", set_config_apparmor_profile, get_config_apparmor_profile, clr_config_apparmor_profile, },
+ { "lxc.apparmor.allow_incomplete", set_config_apparmor_allow_incomplete, get_config_apparmor_allow_incomplete, clr_config_apparmor_allow_incomplete, },
+ { "lxc.autodev", set_config_autodev, get_config_autodev, clr_config_autodev, },
+ { "lxc.cap.drop", set_config_cap_drop, get_config_cap_drop, clr_config_cap_drop, },
+ { "lxc.cap.keep", set_config_cap_keep, get_config_cap_keep, clr_config_cap_keep, },
+ { "lxc.cgroup2", set_config_cgroup2_controller, get_config_cgroup2_controller, clr_config_cgroup2_controller, },
+ { "lxc.cgroup.dir", set_config_cgroup_dir, get_config_cgroup_dir, clr_config_cgroup_dir, },
+ { "lxc.cgroup", set_config_cgroup_controller, get_config_cgroup_controller, clr_config_cgroup_controller, },
+ { "lxc.console.buffer.logfile", set_config_console_buffer_logfile, get_config_console_buffer_logfile, clr_config_console_buffer_logfile, },
+ { "lxc.console.buffer.size", set_config_console_buffer_size, get_config_console_buffer_size, clr_config_console_buffer_size, },
+ { "lxc.console.logfile", set_config_console_logfile, get_config_console_logfile, clr_config_console_logfile, },
+ { "lxc.console.path", set_config_console_path, get_config_console_path, clr_config_console_path, },
+ { "lxc.console.rotate", set_config_console_rotate, get_config_console_rotate, clr_config_console_rotate, },
+ { "lxc.environment", set_config_environment, get_config_environment, clr_config_environment, },
+ { "lxc.ephemeral", set_config_ephemeral, get_config_ephemeral, clr_config_ephemeral, },
+ { "lxc.execute.cmd", set_config_execute_cmd, get_config_execute_cmd, clr_config_execute_cmd, },
+ { "lxc.group", set_config_group, get_config_group, clr_config_group, },
+ { "lxc.hook.autodev", set_config_hooks, get_config_hooks, clr_config_hooks, },
+ { "lxc.hook.clone", set_config_hooks, get_config_hooks, clr_config_hooks, },
+ { "lxc.hook.destroy", set_config_hooks, get_config_hooks, clr_config_hooks, },
+ { "lxc.hook.mount", set_config_hooks, get_config_hooks, clr_config_hooks, },
+ { "lxc.hook.post-stop", set_config_hooks, get_config_hooks, clr_config_hooks, },
+ { "lxc.hook.pre-mount", set_config_hooks, get_config_hooks, clr_config_hooks, },
+ { "lxc.hook.pre-start", set_config_hooks, get_config_hooks, clr_config_hooks, },
+ { "lxc.hook.start", set_config_hooks, get_config_hooks, clr_config_hooks, },
+ { "lxc.hook.start-host", set_config_hooks, get_config_hooks, clr_config_hooks, },
+ { "lxc.hook.stop", set_config_hooks, get_config_hooks, clr_config_hooks, },
+ { "lxc.hook.version", set_config_hooks_version, get_config_hooks_version, clr_config_hooks_version, },
+ { "lxc.hook", set_config_hooks, get_config_hooks, clr_config_hooks, },
+ { "lxc.idmap", set_config_idmaps, get_config_idmaps, clr_config_idmaps, },
+ { "lxc.include", set_config_includefiles, get_config_includefiles, clr_config_includefiles, },
+ { "lxc.init.cmd", set_config_init_cmd, get_config_init_cmd, clr_config_init_cmd, },
+ { "lxc.init.gid", set_config_init_gid, get_config_init_gid, clr_config_init_gid, },
+ { "lxc.init.uid", set_config_init_uid, get_config_init_uid, clr_config_init_uid, },
+ { "lxc.init.cwd", set_config_init_cwd, get_config_init_cwd, clr_config_init_cwd, },
+ { "lxc.log.file", set_config_log_file, get_config_log_file, clr_config_log_file, },
+ { "lxc.log.level", set_config_log_level, get_config_log_level, clr_config_log_level, },
+ { "lxc.log.syslog", set_config_log_syslog, get_config_log_syslog, clr_config_log_syslog, },
+ { "lxc.monitor.unshare", set_config_monitor, get_config_monitor, clr_config_monitor, },
+ { "lxc.mount.auto", set_config_mount_auto, get_config_mount_auto, clr_config_mount_auto, },
+ { "lxc.mount.entry", set_config_mount, get_config_mount, clr_config_mount, },
+ { "lxc.mount.fstab", set_config_mount_fstab, get_config_mount_fstab, clr_config_mount_fstab, },
+ { "lxc.namespace.clone", set_config_namespace_clone, get_config_namespace_clone, clr_config_namespace_clone, },
+ { "lxc.namespace.keep", set_config_namespace_keep, get_config_namespace_keep, clr_config_namespace_keep, },
+ { "lxc.namespace.share", set_config_namespace_share, get_config_namespace_share, clr_config_namespace_share, },
+ { "lxc.net.flags", set_config_net_flags, get_config_net_flags, clr_config_net_flags, },
+ { "lxc.net.hwaddr", set_config_net_hwaddr, get_config_net_hwaddr, clr_config_net_hwaddr, },
+ { "lxc.net.ipv4.address", set_config_net_ipv4_address, get_config_net_ipv4_address, clr_config_net_ipv4_address, },
+ { "lxc.net.ipv4.gateway", set_config_net_ipv4_gateway, get_config_net_ipv4_gateway, clr_config_net_ipv4_gateway, },
+ { "lxc.net.ipv6.address", set_config_net_ipv6_address, get_config_net_ipv6_address, clr_config_net_ipv6_address, },
+ { "lxc.net.ipv6.gateway", set_config_net_ipv6_gateway, get_config_net_ipv6_gateway, clr_config_net_ipv6_gateway, },
+ { "lxc.net.link", set_config_net_link, get_config_net_link, clr_config_net_link, },
+ { "lxc.net.macvlan.mode", set_config_net_macvlan_mode, get_config_net_macvlan_mode, clr_config_net_macvlan_mode, },
+ { "lxc.net.mtu", set_config_net_mtu, get_config_net_mtu, clr_config_net_mtu, },
+ { "lxc.net.name", set_config_net_name, get_config_net_name, clr_config_net_name, },
+ { "lxc.net.script.down", set_config_net_script_down, get_config_net_script_down, clr_config_net_script_down, },
+ { "lxc.net.script.up", set_config_net_script_up, get_config_net_script_up, clr_config_net_script_up, },
+ { "lxc.net.type", set_config_net_type, get_config_net_type, clr_config_net_type, },
+ { "lxc.net.vlan.id", set_config_net_vlan_id, get_config_net_vlan_id, clr_config_net_vlan_id, },
+ { "lxc.net.veth.pair", set_config_net_veth_pair, get_config_net_veth_pair, clr_config_net_veth_pair, },
+ { "lxc.net.", set_config_net_nic, get_config_net_nic, clr_config_net_nic, },
+ { "lxc.net", set_config_net, get_config_net, clr_config_net, },
+ { "lxc.no_new_privs", set_config_no_new_privs, get_config_no_new_privs, clr_config_no_new_privs, },
+ { "lxc.prlimit", set_config_prlimit, get_config_prlimit, clr_config_prlimit, },
+ { "lxc.pty.max", set_config_pty_max, get_config_pty_max, clr_config_pty_max, },
+ { "lxc.rootfs.mount", set_config_rootfs_mount, get_config_rootfs_mount, clr_config_rootfs_mount, },
+ { "lxc.rootfs.options", set_config_rootfs_options, get_config_rootfs_options, clr_config_rootfs_options, },
+ { "lxc.rootfs.path", set_config_rootfs_path, get_config_rootfs_path, clr_config_rootfs_path, },
+ { "lxc.seccomp.profile", set_config_seccomp_profile, get_config_seccomp_profile, clr_config_seccomp_profile, },
+ { "lxc.selinux.context", set_config_selinux_context, get_config_selinux_context, clr_config_selinux_context, },
+ { "lxc.signal.halt", set_config_signal_halt, get_config_signal_halt, clr_config_signal_halt, },
+ { "lxc.signal.reboot", set_config_signal_reboot, get_config_signal_reboot, clr_config_signal_reboot, },
+ { "lxc.signal.stop", set_config_signal_stop, get_config_signal_stop, clr_config_signal_stop, },
+ { "lxc.start.auto", set_config_start, get_config_start, clr_config_start, },
+ { "lxc.start.delay", set_config_start, get_config_start, clr_config_start, },
+ { "lxc.start.order", set_config_start, get_config_start, clr_config_start, },
+ { "lxc.tty.dir", set_config_tty_dir, get_config_tty_dir, clr_config_tty_dir, },
+ { "lxc.tty.max", set_config_tty_max, get_config_tty_max, clr_config_tty_max, },
+ { "lxc.uts.name", set_config_uts_name, get_config_uts_name, clr_config_uts_name, },
+ { "lxc.sysctl", set_config_sysctl, get_config_sysctl, clr_config_sysctl, },
+ { "lxc.proc", set_config_proc, get_config_proc, clr_config_proc, },
};
struct signame {
@@ -2152,12 +2099,6 @@ static int set_config_rootfs_options(const char *key, const char *value,
return set_config_string_item(&lxc_conf->rootfs.options, value);
}
-static int set_config_rootfs_backend(const char *key, const char *value,
- struct lxc_conf *lxc_conf, void *data)
-{
- return 0;
-}
-
static int set_config_uts_name(const char *key, const char *value,
struct lxc_conf *lxc_conf, void *data)
{
@@ -2352,24 +2293,6 @@ static int parse_line(char *buffer, void *data)
goto on_error;
}
- /* [START]: REMOVE IN LXC 3.0 */
- if (config->is_legacy_key && !plc->conf->contains_legacy_key) {
- plc->conf->contains_legacy_key = true;
- if (getenv("LXC_UPDATE_CONFIG_FORMAT")) {
- /* Warn the user once loud and clear that there is at
- * least one legacy configuration item in the
- * configuration file and then an update is required.
- */
- fprintf(stderr, "The configuration file contains "
- "legacy configuration keys.\nPlease "
- "update your configuration file!\nThe "
- "update script lxc-update-config -c "
- "<path-to-config> can be used for "
- "this.\n");
- }
- }
- /* [END]: REMOVE IN LXC 3.0 */
-
ret = config->set(key, value, plc->conf, NULL);
on_error:
@@ -2934,12 +2857,6 @@ static int set_config_no_new_privs(const char *key, const char *value,
return 0;
}
-static int set_config_noop(const char *key, const char *value,
- struct lxc_conf *lxc_conf, void *data)
-{
- return 0;
-}
-
/* Callbacks to get configuration items. */
static int get_config_personality(const char *key, char *retv, int inlen,
struct lxc_conf *c, void *data)
@@ -3278,12 +3195,6 @@ static int get_config_rootfs_options(const char *key, char *retv, int inlen,
return lxc_get_conf_str(retv, inlen, c->rootfs.options);
}
-static int get_config_rootfs_backend(const char *key, char *retv, int inlen,
- struct lxc_conf *c, void *data)
-{
- return 0;
-}
-
static int get_config_uts_name(const char *key, char *retv, int inlen,
struct lxc_conf *c, void *data)
{
@@ -3684,12 +3595,6 @@ static int get_config_proc(const char *key, char *retv, int inlen,
return fulllen;
}
-static int get_config_noop(const char *key, char *retv, int inlen,
- struct lxc_conf *c, void *data)
-{
- return 0;
-}
-
static int get_config_namespace_clone(const char *key, char *retv, int inlen,
struct lxc_conf *c, void *data)
{
@@ -3892,12 +3797,6 @@ static inline int clr_config_rootfs_options(const char *key, struct lxc_conf *c,
return 0;
}
-static inline int clr_config_rootfs_backend(const char *key, struct lxc_conf *c,
- void *data)
-{
- return 0;
-}
-
static inline int clr_config_uts_name(const char *key, struct lxc_conf *c,
void *data)
{
@@ -4132,12 +4031,6 @@ static inline int clr_config_includefiles(const char *key, struct lxc_conf *c,
return 0;
}
-static inline int clr_config_noop(const char *key, struct lxc_conf *c,
- void *data)
-{
- return 0;
-}
-
static int clr_config_namespace_clone(const char *key,
struct lxc_conf *lxc_conf, void *data)
{
diff --git a/src/lxc/confile.h b/src/lxc/confile.h
index d50217860..fb9fec8b5 100644
--- a/src/lxc/confile.h
+++ b/src/lxc/confile.h
@@ -53,7 +53,6 @@ typedef int (*config_clr_cb)(const char *key, struct lxc_conf *conf,
struct lxc_config_t {
char *name;
- bool is_legacy_key; /* REMOVE in LXC 3.0 */
config_set_cb set;
config_get_cb get;
config_clr_cb clr;
diff --git a/src/lxc/confile_legacy.c b/src/lxc/confile_legacy.c
deleted file mode 100644
index df419e640..000000000
--- a/src/lxc/confile_legacy.c
+++ /dev/null
@@ -1,1244 +0,0 @@
-/*
- * lxc: linux Container library
- * (C) Copyright IBM Corp. 2007, 2008
- *
- * Authors:
- * Daniel Lezcano <daniel.lezcano at free.fr>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#define _GNU_SOURCE
-#define __STDC_FORMAT_MACROS /* Required for PRIu64 to work. */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <ctype.h>
-#include <inttypes.h> /* Required for PRIu64 to work. */
-#include <signal.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/utsname.h>
-#include <arpa/inet.h>
-#include <netinet/in.h>
-#include <net/if.h>
-#include <time.h>
-#include <dirent.h>
-#include <syslog.h>
-
-#include "parse.h"
-#include "config.h"
-#include "confile.h"
-#include "confile_utils.h"
-#include "confile_legacy.h"
-#include "utils.h"
-#include "log.h"
-#include "conf.h"
-#include "network.h"
-#include "lxcseccomp.h"
-#include "storage.h"
-
-#if HAVE_IFADDRS_H
-#include <ifaddrs.h>
-#else
-#include <../include/ifaddrs.h>
-#endif
-
-lxc_log_define(lxc_confile_legacy, lxc);
-
-/*
- * Config entry is something like "lxc.network.0.ipv4" the key 'lxc.network.'
- * was found. So we make sure next comes an integer, find the right callback
- * (by rewriting the key), and call it.
- */
-int set_config_network_legacy_nic(const char *key, const char *value,
- struct lxc_conf *lxc_conf, void *data)
-{
- char *copy = strdup(key), *p;
- int ret = -1;
- struct lxc_config_t *config;
-
- if (!copy) {
- SYSERROR("failed to allocate memory");
- return -1;
- }
- /*
- * Ok we know that to get here we've got "lxc.network."
- * and it isn't any of the other network entries. So
- * after the second . Should come an integer (# of defined
- * nic) followed by a valid entry.
- */
- if (*(key + 12) < '0' || *(key + 12) > '9')
- goto out;
-
- p = strchr(key + 12, '.');
- if (!p)
- goto out;
-
- if (strlen(p + 1) == 0) {
- ERROR("No subkey in network configuration key \"%s\"", key);
- goto out;
- }
- strcpy(copy + 12, p + 1);
- config = lxc_get_config(copy);
- if (!config) {
- ERROR("unknown key %s", key);
- goto out;
- }
- ret = config->set(key, value, lxc_conf, NULL);
-
-out:
- free(copy);
- return ret;
-}
-
-static void lxc_remove_nic(struct lxc_list *it)
-{
- struct lxc_netdev *netdev = it->elem;
- struct lxc_list *it2,*next;
-
- lxc_list_del(it);
-
- free(netdev->upscript);
- free(netdev->downscript);
- free(netdev->hwaddr);
- free(netdev->mtu);
- free(netdev->ipv4_gateway);
- free(netdev->ipv6_gateway);
- lxc_list_for_each_safe(it2, &netdev->ipv4, next) {
- lxc_list_del(it2);
- free(it2->elem);
- free(it2);
- }
- lxc_list_for_each_safe(it2, &netdev->ipv6, next) {
- lxc_list_del(it2);
- free(it2->elem);
- free(it2);
- }
- free(netdev);
- free(it);
-}
-
-static int lxc_clear_config_network(struct lxc_conf *c)
-{
- struct lxc_list *it,*next;
- lxc_list_for_each_safe(it, &c->network, next) {
- lxc_remove_nic(it);
- }
- return 0;
-}
-
-int set_config_network_legacy(const char *key, const char *value,
- struct lxc_conf *lxc_conf, void *data)
-{
- if (!lxc_config_value_empty(value)) {
- ERROR("lxc.network must not have a value");
- return -1;
- }
-
- return lxc_clear_config_network(lxc_conf);
-}
-
-/*
- * If you have p="lxc.network.0.link", pass it p+12
- * to get back '0' (the index of the nic).
- */
-static int get_network_netdev_idx(const char *key)
-{
- int ret, idx;
-
- if (*key < '0' || *key > '9')
- return EINVAL;
-
- ret = sscanf(key, "%d", &idx);
- if (ret != 1)
- return EINVAL;
-
- /* Since we've implemented the new network parser legacy networks are
- * recorded using a negative index starting from -1. To preserve the old
- * behavior we need this function to return the appropriate negative
- * index.
- */
- return -(++idx);
-}
-
-/*
- * If you have p="lxc.network.0", pass this p+12 and it will return
- * the netdev of the first configured nic.
- */
-static struct lxc_netdev *get_netdev_from_key(const char *key,
- struct lxc_list *network)
-{
- int idx;
- struct lxc_list *it;
- struct lxc_netdev *netdev = NULL;
-
- idx = get_network_netdev_idx(key);
- if (idx == EINVAL)
- return NULL;
-
- lxc_list_for_each(it, network) {
- netdev = it->elem;
- if (idx == netdev->idx)
- return netdev;
- }
-
- return NULL;
-}
-
-int set_config_network_legacy_type(const char *key, const char *value,
- struct lxc_conf *lxc_conf, void *data)
-{
- struct lxc_list *network = &lxc_conf->network;
- struct lxc_netdev *netdev, *prevnetdev;
- struct lxc_list *list;
-
- if (lxc_config_value_empty(value))
- return lxc_clear_config_network(lxc_conf);
-
- netdev = get_netdev_from_key(key + 12, network);
- if (netdev) {
- ERROR("Network already exists");
- return -EEXIST;
- }
-
- netdev = malloc(sizeof(*netdev));
- if (!netdev) {
- SYSERROR("failed to allocate memory");
- return -1;
- }
-
- memset(netdev, 0, sizeof(*netdev));
- lxc_list_init(&netdev->ipv4);
- lxc_list_init(&netdev->ipv6);
-
- list = malloc(sizeof(*list));
- if (!list) {
- SYSERROR("failed to allocate memory");
- free(netdev);
- return -1;
- }
-
- lxc_list_init(list);
- lxc_list_add_elem(list, netdev);
-
- /* We maintain a negative count for legacy networks. */
- netdev->idx = -1;
- if (!lxc_list_empty(network)) {
- prevnetdev = lxc_list_first_elem(network);
- netdev->idx = prevnetdev->idx;
- if (netdev->idx == INT_MIN) {
- ERROR("number of requested networks would underflow "
- "counter");
- free(netdev);
- free(list);
- return -1;
- }
- netdev->idx--;
- }
-
- lxc_list_add(network, list);
-
- if (!strcmp(value, "veth"))
- netdev->type = LXC_NET_VETH;
- else if (!strcmp(value, "macvlan")) {
- netdev->type = LXC_NET_MACVLAN;
- lxc_macvlan_mode_to_flag(&netdev->priv.macvlan_attr.mode, "private");
- } else if (!strcmp(value, "vlan"))
- netdev->type = LXC_NET_VLAN;
- else if (!strcmp(value, "phys"))
- netdev->type = LXC_NET_PHYS;
- else if (!strcmp(value, "empty"))
- netdev->type = LXC_NET_EMPTY;
- else if (!strcmp(value, "none"))
- netdev->type = LXC_NET_NONE;
- else {
- ERROR("invalid network type %s", value);
- return -1;
- }
- return 0;
-}
-
-int lxc_list_nicconfigs_legacy(struct lxc_conf *c, const char *key, char *retv,
- int inlen)
-{
- struct lxc_netdev *netdev;
- int len;
- int fulllen = 0;
-
- netdev = get_netdev_from_key(key + 12, &c->network);
- if (!netdev)
- return -1;
-
- if (!retv)
- inlen = 0;
- else
- memset(retv, 0, inlen);
-
- strprint(retv, inlen, "type\n");
- strprint(retv, inlen, "script.up\n");
- strprint(retv, inlen, "script.down\n");
- if (netdev->type != LXC_NET_EMPTY) {
- strprint(retv, inlen, "flags\n");
- strprint(retv, inlen, "link\n");
- strprint(retv, inlen, "name\n");
- strprint(retv, inlen, "hwaddr\n");
- strprint(retv, inlen, "mtu\n");
- strprint(retv, inlen, "ipv6\n");
- strprint(retv, inlen, "ipv6.gateway\n");
- strprint(retv, inlen, "ipv4\n");
- strprint(retv, inlen, "ipv4.gateway\n");
- }
-
- switch (netdev->type) {
- case LXC_NET_VETH:
- strprint(retv, inlen, "veth.pair\n");
- break;
- case LXC_NET_MACVLAN:
- strprint(retv, inlen, "macvlan.mode\n");
- break;
- case LXC_NET_VLAN:
- strprint(retv, inlen, "vlan.id\n");
- break;
- case LXC_NET_PHYS:
- break;
- }
-
- return fulllen;
-}
-
-static struct lxc_netdev *network_netdev(const char *key, const char *value,
- struct lxc_list *network)
-{
- struct lxc_netdev *netdev = NULL;
-
- if (lxc_list_empty(network)) {
- ERROR("network is not created for '%s' = '%s' option", key,
- value);
- return NULL;
- }
-
- if (get_network_netdev_idx(key + 12) == EINVAL)
- netdev = lxc_list_first_elem(network);
- else
- netdev = get_netdev_from_key(key + 12, network);
-
- if (!netdev) {
- ERROR("no network device defined for '%s' = '%s' option", key,
- value);
- return NULL;
- }
-
- return netdev;
-}
-
-int set_config_network_legacy_flags(const char *key, const char *value,
- struct lxc_conf *lxc_conf, void *data)
-{
- struct lxc_netdev *netdev;
-
- netdev = network_netdev(key, value, &lxc_conf->network);
- if (!netdev)
- return -1;
-
- netdev->flags |= IFF_UP;
-
- return 0;
-}
-
-static int create_matched_ifnames(const char *value, struct lxc_conf *lxc_conf,
- struct lxc_netdev *netdev)
-{
- struct ifaddrs *ifaddr, *ifa;
- int n;
- int ret = 0;
- const char *type_key = "lxc.network.type";
- const char *link_key = "lxc.network.link";
- const char *tmpvalue = "phys";
-
- if (getifaddrs(&ifaddr) == -1) {
- SYSERROR("Get network interfaces failed");
- return -1;
- }
-
- for (ifa = ifaddr, n = 0; ifa != NULL; ifa = ifa->ifa_next, n++) {
- if (!ifa->ifa_addr)
- continue;
- if (ifa->ifa_addr->sa_family != AF_PACKET)
- continue;
-
- if (!strncmp(value, ifa->ifa_name, strlen(value) - 1)) {
- ret = set_config_network_legacy_type(type_key, tmpvalue,
- lxc_conf, netdev);
- if (!ret) {
- ret = set_config_network_legacy_link(
- link_key, ifa->ifa_name, lxc_conf, netdev);
- if (ret) {
- ERROR("failed to create matched ifnames");
- break;
- }
- } else {
- ERROR("failed to create matched ifnames");
- break;
- }
- }
- }
-
- freeifaddrs(ifaddr);
- ifaddr = NULL;
-
- return ret;
-}
-
-int set_config_network_legacy_link(const char *key, const char *value,
- struct lxc_conf *lxc_conf, void *data)
-{
- struct lxc_netdev *netdev;
- struct lxc_list *it;
- int ret = 0;
-
- netdev = network_netdev(key, value, &lxc_conf->network);
- if (!netdev)
- return -1;
-
- if (value[strlen(value) - 1] == '+' && netdev->type == LXC_NET_PHYS) {
- /* Get the last network list and remove it. */
- it = lxc_conf->network.prev;
- if (((struct lxc_netdev *)(it->elem))->type != LXC_NET_PHYS) {
- ERROR("lxc config cannot support string pattern "
- "matching for this link type");
- return -1;
- }
-
- lxc_list_del(it);
- free(it);
- ret = create_matched_ifnames(value, lxc_conf, NULL);
- } else {
- ret = network_ifname(netdev->link, value);
- }
-
- return ret;
-}
-
-int set_config_network_legacy_name(const char *key, const char *value,
- struct lxc_conf *lxc_conf, void *data)
-{
- struct lxc_netdev *netdev;
-
- netdev = network_netdev(key, value, &lxc_conf->network);
- if (!netdev)
- return -1;
-
- return network_ifname(netdev->name, value);
-}
-
-int set_config_network_legacy_veth_pair(const char *key, const char *value,
- struct lxc_conf *lxc_conf, void *data)
-{
- struct lxc_netdev *netdev;
-
- netdev = network_netdev(key, value, &lxc_conf->network);
- if (!netdev)
- return -1;
-
- if (netdev->type != LXC_NET_VETH) {
- ERROR("Invalid veth pair for a non-veth netdev");
- return -1;
- }
-
- return network_ifname(netdev->priv.veth_attr.pair, value);
-}
-
-int set_config_network_legacy_macvlan_mode(const char *key, const char *value,
- struct lxc_conf *lxc_conf,
- void *data)
-{
- struct lxc_netdev *netdev;
-
- netdev = network_netdev(key, value, &lxc_conf->network);
- if (!netdev)
- return -1;
-
- if (netdev->type != LXC_NET_MACVLAN) {
- ERROR("Invalid macvlan.mode for a non-macvlan netdev");
- return -1;
- }
-
- return lxc_macvlan_mode_to_flag(&netdev->priv.macvlan_attr.mode, value);
-}
-
-int set_config_network_legacy_hwaddr(const char *key, const char *value,
- struct lxc_conf *lxc_conf, void *data)
-{
- struct lxc_netdev *netdev;
- char *new_value;
-
- new_value = strdup(value);
- if (!new_value) {
- SYSERROR("failed to strdup \"%s\"", value);
- return -1;
- }
- rand_complete_hwaddr(new_value);
-
- netdev = network_netdev(key, new_value, &lxc_conf->network);
- if (!netdev) {
- free(new_value);
- return -1;
- };
-
- if (lxc_config_value_empty(new_value)) {
- free(new_value);
- netdev->hwaddr = NULL;
- return 0;
- }
-
- netdev->hwaddr = new_value;
- return 0;
-}
-
-int set_config_network_legacy_vlan_id(const char *key, const char *value,
- struct lxc_conf *lxc_conf, void *data)
-{
- struct lxc_netdev *netdev;
-
- netdev = network_netdev(key, value, &lxc_conf->network);
- if (!netdev)
- return -1;
-
- if (netdev->type != LXC_NET_VLAN) {
- ERROR("Invalid vlan.id for a non-macvlan netdev");
- return -1;
- }
-
- if (get_u16(&netdev->priv.vlan_attr.vid, value, 0))
- return -1;
-
- return 0;
-}
-
-int set_config_network_legacy_mtu(const char *key, const char *value,
- struct lxc_conf *lxc_conf, void *data)
-{
- struct lxc_netdev *netdev;
-
- netdev = network_netdev(key, value, &lxc_conf->network);
- if (!netdev)
- return -1;
-
- return set_config_string_item(&netdev->mtu, value);
-}
-
-int set_config_network_legacy_ipv4(const char *key, const char *value,
- struct lxc_conf *lxc_conf, void *data)
-{
- struct lxc_netdev *netdev;
- struct lxc_inetdev *inetdev;
- struct lxc_list *list;
- char *cursor, *slash;
- char *addr = NULL, *bcast = NULL, *prefix = NULL;
-
- if (lxc_config_value_empty(value))
- return clr_config_network_legacy_item(key, lxc_conf, NULL);
-
- netdev = network_netdev(key, value, &lxc_conf->network);
- if (!netdev)
- return -1;
-
- inetdev = malloc(sizeof(*inetdev));
- if (!inetdev) {
- SYSERROR("failed to allocate ipv4 address");
- return -1;
- }
- memset(inetdev, 0, sizeof(*inetdev));
-
- list = malloc(sizeof(*list));
- if (!list) {
- SYSERROR("failed to allocate memory");
- free(inetdev);
- return -1;
- }
-
- lxc_list_init(list);
- lxc_list_add_elem(list, inetdev);
-
- addr = strdup(value);
- if (!addr) {
- ERROR("no address specified");
- free(inetdev);
- free(list);
- return -1;
- }
-
- cursor = strstr(addr, " ");
- if (cursor) {
- *cursor = '\0';
- bcast = cursor + 1;
- }
-
- slash = strstr(addr, "/");
- if (slash) {
- *slash = '\0';
- prefix = slash + 1;
- }
-
- if (inet_pton(AF_INET, addr, &inetdev->addr) != 1) {
- SYSERROR("invalid ipv4 address: %s", value);
- free(inetdev);
- free(addr);
- free(list);
- return -1;
- }
-
- if (bcast && inet_pton(AF_INET, bcast, &inetdev->bcast) != 1) {
- SYSERROR("invalid ipv4 broadcast address: %s", value);
- free(inetdev);
- free(list);
- free(addr);
- return -1;
- }
-
- /* No prefix specified, determine it from the network class. */
- if (prefix) {
- if (lxc_safe_uint(prefix, &inetdev->prefix) < 0)
- return -1;
- } else {
- inetdev->prefix = config_ip_prefix(&inetdev->addr);
- }
-
- /* If no broadcast address, let compute one from the
- * prefix and address.
- */
- if (!bcast) {
- inetdev->bcast.s_addr = inetdev->addr.s_addr;
- inetdev->bcast.s_addr |=
- htonl(INADDR_BROADCAST >> inetdev->prefix);
- }
-
- lxc_list_add_tail(&netdev->ipv4, list);
-
- free(addr);
- return 0;
-}
-
-int set_config_network_legacy_ipv4_gateway(const char *key, const char *value,
- struct lxc_conf *lxc_conf,
- void *data)
-{
- struct lxc_netdev *netdev;
-
- netdev = network_netdev(key, value, &lxc_conf->network);
- if (!netdev)
- return -1;
-
- free(netdev->ipv4_gateway);
-
- if (lxc_config_value_empty(value)) {
- netdev->ipv4_gateway = NULL;
- } else if (!strcmp(value, "auto")) {
- netdev->ipv4_gateway = NULL;
- netdev->ipv4_gateway_auto = true;
- } else {
- struct in_addr *gw;
-
- gw = malloc(sizeof(*gw));
- if (!gw) {
- SYSERROR("failed to allocate ipv4 gateway address");
- return -1;
- }
-
- if (inet_pton(AF_INET, value, gw) != 1) {
- SYSERROR("invalid ipv4 gateway address: %s", value);
- free(gw);
- return -1;
- }
-
- netdev->ipv4_gateway = gw;
- netdev->ipv4_gateway_auto = false;
- }
-
- return 0;
-}
-
-int set_config_network_legacy_ipv6(const char *key, const char *value,
- struct lxc_conf *lxc_conf, void *data)
-{
- struct lxc_netdev *netdev;
- struct lxc_inet6dev *inet6dev;
- struct lxc_list *list;
- char *slash, *valdup, *netmask;
-
- if (lxc_config_value_empty(value))
- return clr_config_network_legacy_item(key, lxc_conf, NULL);
-
- netdev = network_netdev(key, value, &lxc_conf->network);
- if (!netdev)
- return -1;
-
- inet6dev = malloc(sizeof(*inet6dev));
- if (!inet6dev) {
- SYSERROR("failed to allocate ipv6 address");
- return -1;
- }
- memset(inet6dev, 0, sizeof(*inet6dev));
-
- list = malloc(sizeof(*list));
- if (!list) {
- SYSERROR("failed to allocate memory");
- free(inet6dev);
- return -1;
- }
-
- lxc_list_init(list);
- list->elem = inet6dev;
-
- valdup = strdup(value);
- if (!valdup) {
- ERROR("no address specified");
- free(list);
- free(inet6dev);
- return -1;
- }
-
- inet6dev->prefix = 64;
- slash = strstr(valdup, "/");
- if (slash) {
- *slash = '\0';
- netmask = slash + 1;
- if (lxc_safe_uint(netmask, &inet6dev->prefix) < 0) {
- free(list);
- free(inet6dev);
- free(valdup);
- return -1;
- }
- }
-
- if (inet_pton(AF_INET6, valdup, &inet6dev->addr) != 1) {
- SYSERROR("invalid ipv6 address: %s", valdup);
- free(list);
- free(inet6dev);
- free(valdup);
- return -1;
- }
-
- lxc_list_add_tail(&netdev->ipv6, list);
-
- free(valdup);
- return 0;
-}
-
-int set_config_network_legacy_ipv6_gateway(const char *key, const char *value,
- struct lxc_conf *lxc_conf,
- void *data)
-{
- struct lxc_netdev *netdev;
-
- netdev = network_netdev(key, value, &lxc_conf->network);
- if (!netdev)
- return -1;
-
- free(netdev->ipv6_gateway);
-
- if (lxc_config_value_empty(value)) {
- netdev->ipv6_gateway = NULL;
- } else if (!strcmp(value, "auto")) {
- netdev->ipv6_gateway = NULL;
- netdev->ipv6_gateway_auto = true;
- } else {
- struct in6_addr *gw;
-
- gw = malloc(sizeof(*gw));
- if (!gw) {
- SYSERROR("failed to allocate ipv6 gateway address");
- return -1;
- }
-
- if (inet_pton(AF_INET6, value, gw) != 1) {
- SYSERROR("invalid ipv6 gateway address: %s", value);
- free(gw);
- return -1;
- }
-
- netdev->ipv6_gateway = gw;
- netdev->ipv6_gateway_auto = false;
- }
-
- return 0;
-}
-
-int set_config_network_legacy_script_up(const char *key, const char *value,
- struct lxc_conf *lxc_conf, void *data)
-{
- struct lxc_netdev *netdev;
-
- netdev = network_netdev(key, value, &lxc_conf->network);
- if (!netdev)
- return -1;
-
- return set_config_string_item(&netdev->upscript, value);
-}
-
-int set_config_network_legacy_script_down(const char *key, const char *value,
- struct lxc_conf *lxc_conf, void *data)
-{
- struct lxc_netdev *netdev;
-
- netdev = network_netdev(key, value, &lxc_conf->network);
- if (!netdev)
- return -1;
-
- return set_config_string_item(&netdev->downscript, value);
-}
-
-int get_config_network_legacy(const char *key, char *retv, int inlen,
- struct lxc_conf *c, void *data)
-{
- int len, fulllen = 0;
- struct lxc_list *it;
-
- if (!retv)
- inlen = 0;
- else
- memset(retv, 0, inlen);
-
- lxc_list_for_each(it, &c->network) {
- struct lxc_netdev *n = it->elem;
- const char *t = lxc_net_type_to_str(n->type);
- strprint(retv, inlen, "%s\n", t ? t : "(invalid)");
- }
-
- return fulllen;
-}
-
-/*
- * lxc.network.0.XXX, where XXX can be: name, type, link, flags, type,
- * macvlan.mode, veth.pair, vlan, ipv4, ipv6, script.up, hwaddr, mtu,
- * ipv4.gateway, ipv6.gateway. ipvX.gateway can return 'auto' instead
- * of an address. ipv4 and ipv6 return lists (newline-separated).
- * things like veth.pair return '' if invalid (i.e. if called for vlan
- * type).
- */
-int get_config_network_legacy_item(const char *key, char *retv, int inlen,
- struct lxc_conf *c, void *data)
-{
- char *p1;
- int len, fulllen = 0;
- struct lxc_netdev *netdev;
-
- if (!retv)
- inlen = 0;
- else
- memset(retv, 0, inlen);
-
- if (strncmp(key, "lxc.network.", 12) != 0)
- return -1;
-
- p1 = strchr(key + 12, '.');
- if (!p1 || *(p1 + 1) == '\0')
- return -1;
- p1++;
-
- netdev = network_netdev(key, "", &c->network);
- if (!netdev)
- return -1;
-
- if (strcmp(p1, "name") == 0) {
- if (netdev->name[0] != '\0')
- strprint(retv, inlen, "%s", netdev->name);
- } else if (strcmp(p1, "type") == 0) {
- strprint(retv, inlen, "%s", lxc_net_type_to_str(netdev->type));
- } else if (strcmp(p1, "link") == 0) {
- if (netdev->link[0] != '\0')
- strprint(retv, inlen, "%s", netdev->link);
- } else if (strcmp(p1, "flags") == 0) {
- if (netdev->flags & IFF_UP)
- strprint(retv, inlen, "up");
- } else if (strcmp(p1, "script.up") == 0) {
- if (netdev->upscript)
- strprint(retv, inlen, "%s", netdev->upscript);
- } else if (strcmp(p1, "script.down") == 0) {
- if (netdev->downscript)
- strprint(retv, inlen, "%s", netdev->downscript);
- } else if (strcmp(p1, "hwaddr") == 0) {
- if (netdev->hwaddr)
- strprint(retv, inlen, "%s", netdev->hwaddr);
- } else if (strcmp(p1, "mtu") == 0) {
- if (netdev->mtu)
- strprint(retv, inlen, "%s", netdev->mtu);
- } else if (strcmp(p1, "macvlan.mode") == 0) {
- if (netdev->type == LXC_NET_MACVLAN) {
- const char *mode;
- switch (netdev->priv.macvlan_attr.mode) {
- case MACVLAN_MODE_PRIVATE:
- mode = "private";
- break;
- case MACVLAN_MODE_VEPA:
- mode = "vepa";
- break;
- case MACVLAN_MODE_BRIDGE:
- mode = "bridge";
- break;
- case MACVLAN_MODE_PASSTHRU:
- mode = "passthru";
- break;
- default:
- mode = "(invalid)";
- break;
- }
- strprint(retv, inlen, "%s", mode);
- }
- } else if (strcmp(p1, "veth.pair") == 0) {
- if (netdev->type == LXC_NET_VETH) {
- strprint(retv, inlen, "%s",
- netdev->priv.veth_attr.pair[0] != '\0'
- ? netdev->priv.veth_attr.pair
- : netdev->priv.veth_attr.veth1);
- }
- } else if (strcmp(p1, "vlan") == 0) {
- if (netdev->type == LXC_NET_VLAN) {
- strprint(retv, inlen, "%d", netdev->priv.vlan_attr.vid);
- }
- } else if (strcmp(p1, "ipv4.gateway") == 0) {
- if (netdev->ipv4_gateway_auto) {
- strprint(retv, inlen, "auto");
- } else if (netdev->ipv4_gateway) {
- char buf[INET_ADDRSTRLEN];
- inet_ntop(AF_INET, netdev->ipv4_gateway, buf,
- sizeof(buf));
- strprint(retv, inlen, "%s", buf);
- }
- } else if (strcmp(p1, "ipv4") == 0) {
- struct lxc_list *it2;
- lxc_list_for_each(it2, &netdev->ipv4) {
- struct lxc_inetdev *i = it2->elem;
- char buf[INET_ADDRSTRLEN];
- inet_ntop(AF_INET, &i->addr, buf, sizeof(buf));
- strprint(retv, inlen, "%s/%u\n", buf, i->prefix);
- }
- } else if (strcmp(p1, "ipv6.gateway") == 0) {
- if (netdev->ipv6_gateway_auto) {
- strprint(retv, inlen, "auto");
- } else if (netdev->ipv6_gateway) {
- char buf[INET6_ADDRSTRLEN];
- inet_ntop(AF_INET6, netdev->ipv6_gateway, buf,
- sizeof(buf));
- strprint(retv, inlen, "%s", buf);
- }
- } else if (strcmp(p1, "ipv6") == 0) {
- struct lxc_list *it2;
- lxc_list_for_each(it2, &netdev->ipv6) {
- struct lxc_inet6dev *i = it2->elem;
- char buf[INET6_ADDRSTRLEN];
- inet_ntop(AF_INET6, &i->addr, buf, sizeof(buf));
- strprint(retv, inlen, "%s/%u\n", buf, i->prefix);
- }
- }
- return fulllen;
-}
-
-/* we get passed in something like '0', '0.ipv4' or '1.ipv6' */
-static int lxc_clear_nic(struct lxc_conf *c, const char *key)
-{
- char *p1;
- int idx;
- struct lxc_list *it = NULL;
- struct lxc_netdev *netdev = NULL;
-
- if (lxc_list_empty(&c->network)) {
- ERROR("network is not created for %s", key);
- return -1;
- }
-
- if ((idx = get_network_netdev_idx(key)) == EINVAL)
- netdev = lxc_list_first_elem(&c->network);
- else {
- lxc_list_for_each(it, &c->network) {
- netdev = it->elem;
- if (idx == netdev->idx)
- break;
- netdev = NULL;
- }
- }
- if (!netdev)
- return -1;
-
- p1 = strchr(key, '.');
- if (!p1 && it) {
- lxc_remove_nic(it);
- } else if (strcmp(p1, ".ipv4") == 0) {
- struct lxc_list *it2,*next;
- lxc_list_for_each_safe(it2, &netdev->ipv4, next) {
- lxc_list_del(it2);
- free(it2->elem);
- free(it2);
- }
- } else if (strcmp(p1, ".ipv6") == 0) {
- struct lxc_list *it2,*next;
- lxc_list_for_each_safe(it2, &netdev->ipv6, next) {
- lxc_list_del(it2);
- free(it2->elem);
- free(it2);
- }
- } else {
- return -1;
- }
-
- return 0;
-}
-
-inline int clr_config_network_legacy_item(const char *key, struct lxc_conf *c,
- void *data)
-{
- return lxc_clear_nic(c, key + 12);
-}
-
-inline int clr_config_network_legacy(const char *key, struct lxc_conf *c, void *data)
-{
- return lxc_clear_config_network(c);
-}
-
-inline int clr_config_lsm_aa_profile(const char *key, struct lxc_conf *c,
- void *data)
-{
- free(c->lsm_aa_profile);
- c->lsm_aa_profile = NULL;
- return 0;
-}
-
-inline int clr_config_lsm_aa_incomplete(const char *key, struct lxc_conf *c,
- void *data)
-{
- c->lsm_aa_allow_incomplete = 0;
- return 0;
-}
-
-int get_config_lsm_aa_profile(const char *key, char *retv, int inlen,
- struct lxc_conf *c, void *data)
-{
- return lxc_get_conf_str(retv, inlen, c->lsm_aa_profile);
-}
-
-int get_config_lsm_aa_incomplete(const char *key, char *retv, int inlen,
- struct lxc_conf *c, void *data)
-{
- return lxc_get_conf_int(c, retv, inlen,
- c->lsm_aa_allow_incomplete);
-}
-
-int set_config_lsm_aa_profile(const char *key, const char *value,
- struct lxc_conf *lxc_conf, void *data)
-{
- return set_config_string_item(&lxc_conf->lsm_aa_profile, value);
-}
-
-int set_config_lsm_aa_incomplete(const char *key, const char *value,
- struct lxc_conf *lxc_conf, void *data)
-{
- /* Set config value to default. */
- if (lxc_config_value_empty(value)) {
- lxc_conf->lsm_aa_allow_incomplete = 0;
- return 0;
- }
-
- /* Parse new config value. */
- if (lxc_safe_uint(value, &lxc_conf->lsm_aa_allow_incomplete) < 0)
- return -1;
-
- if (lxc_conf->lsm_aa_allow_incomplete > 1) {
- ERROR("Wrong value for lxc.lsm_aa_allow_incomplete. Can only "
- "be set to 0 or 1");
- return -1;
- }
-
- return 0;
-}
-
-int set_config_lsm_se_context(const char *key, const char *value,
- struct lxc_conf *lxc_conf, void *data)
-{
- return set_config_string_item(&lxc_conf->lsm_se_context, value);
-}
-
-int get_config_lsm_se_context(const char *key, char *retv, int inlen,
- struct lxc_conf *c, void *data)
-{
- return lxc_get_conf_str(retv, inlen, c->lsm_se_context);
-}
-
-inline int clr_config_lsm_se_context(const char *key, struct lxc_conf *c,
- void *data)
-{
- free(c->lsm_se_context);
- c->lsm_se_context = NULL;
- return 0;
-}
-
-extern int set_config_limit(const char *key, const char *value,
- struct lxc_conf *lxc_conf, void *data)
-{
- struct lxc_list *iter;
- struct rlimit limit;
- rlim_t limit_value;
- struct lxc_list *limlist = NULL;
- struct lxc_limit *limelem = NULL;
-
- if (lxc_config_value_empty(value))
- return lxc_clear_limits(lxc_conf, key);
-
- if (strncmp(key, "lxc.limit.", sizeof("lxc.limit.") - 1) != 0)
- return -1;
-
- key += sizeof("lxc.limit.") - 1;
-
- /* soft limit comes first in the value */
- if (!parse_limit_value(&value, &limit_value))
- return -1;
- limit.rlim_cur = limit_value;
-
- /* skip spaces and a colon */
- while (isspace(*value))
- ++value;
-
- if (*value == ':')
- ++value;
- else if (*value) /* any other character is an error here */
- return -1;
-
- while (isspace(*value))
- ++value;
-
- /* optional hard limit */
- if (*value) {
- if (!parse_limit_value(&value, &limit_value))
- return -1;
- limit.rlim_max = limit_value;
-
- /* check for trailing garbage */
- while (isspace(*value))
- ++value;
-
- if (*value)
- return -1;
- } else {
- /* a single value sets both hard and soft limit */
- limit.rlim_max = limit.rlim_cur;
- }
-
- /* find existing list element */
- lxc_list_for_each(iter, &lxc_conf->limits)
- {
- limelem = iter->elem;
- if (!strcmp(key, limelem->resource)) {
- limelem->limit = limit;
- return 0;
- }
- }
-
- /* allocate list element */
- limlist = malloc(sizeof(*limlist));
- if (!limlist)
- goto out;
-
- limelem = malloc(sizeof(*limelem));
- if (!limelem)
- goto out;
- memset(limelem, 0, sizeof(*limelem));
-
- limelem->resource = strdup(key);
- if (!limelem->resource)
- goto out;
- limelem->limit = limit;
-
- limlist->elem = limelem;
-
- lxc_list_add_tail(&lxc_conf->limits, limlist);
-
- return 0;
-
-out:
- free(limlist);
- if (limelem) {
- free(limelem->resource);
- free(limelem);
- }
- return -1;
-}
-
-/*
- * If you ask for a specific value, i.e. lxc.limit.nofile, then just the value
- * will be printed. If you ask for 'lxc.limit', then all limit entries will be
- * printed, in 'lxc.limit.resource = value' format.
- */
-extern int get_config_limit(const char *key, char *retv, int inlen,
- struct lxc_conf *c, void *data)
-{
- int fulllen = 0, len;
- bool get_all = false;
- struct lxc_list *it;
-
- if (!retv)
- inlen = 0;
- else
- memset(retv, 0, inlen);
-
- if (!strcmp(key, "lxc.limit"))
- get_all = true;
- else if (strncmp(key, "lxc.limit.", 10) == 0)
- key += 10;
- else
- return -1;
-
- lxc_list_for_each(it, &c->limits) {
- char buf[LXC_NUMSTRLEN64 * 2 + 2]; /* 2 colon separated 64 bit
- integers or the word
- 'unlimited' */
- int partlen;
- struct lxc_limit *lim = it->elem;
-
- if (lim->limit.rlim_cur == RLIM_INFINITY) {
- memcpy(buf, "unlimited", sizeof("unlimited"));
- partlen = sizeof("unlimited") - 1;
- } else {
- partlen = sprintf(buf, "%" PRIu64,
- (uint64_t)lim->limit.rlim_cur);
- }
- if (lim->limit.rlim_cur != lim->limit.rlim_max) {
- if (lim->limit.rlim_max == RLIM_INFINITY) {
- memcpy(buf + partlen, ":unlimited",
- sizeof(":unlimited"));
- } else {
- sprintf(buf + partlen, ":%" PRIu64,
- (uint64_t)lim->limit.rlim_max);
- }
- }
-
- if (get_all) {
- strprint(retv, inlen, "lxc.limit.%s = %s\n",
- lim->resource, buf);
- } else if (strcmp(lim->resource, key) == 0) {
- strprint(retv, inlen, "%s", buf);
- }
- }
-
- return fulllen;
-}
-
-extern int clr_config_limit(const char *key, struct lxc_conf *c,
- void *data)
-{
- return lxc_clear_limits(c, key);
-}
diff --git a/src/lxc/confile_legacy.h b/src/lxc/confile_legacy.h
deleted file mode 100644
index ab64a0e8a..000000000
--- a/src/lxc/confile_legacy.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * lxc: linux Container library
- *
- * (C) Copyright IBM Corp. 2007, 2008
- *
- * Authors:
- * Daniel Lezcano <daniel.lezcano at free.fr>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __LXC_CONFILE_LEGACY_H
-#define __LXC_CONFILE_LEGACY_H
-
-#include <stdio.h>
-#include <lxc/attach_options.h>
-#include <stdbool.h>
-
-struct lxc_conf;
-struct lxc_list;
-
-extern int set_config_network_legacy_type(const char *, const char *,
- struct lxc_conf *, void *);
-extern int set_config_network_legacy_flags(const char *, const char *,
- struct lxc_conf *, void *);
-extern int set_config_network_legacy_link(const char *, const char *,
- struct lxc_conf *, void *);
-extern int set_config_network_legacy_name(const char *, const char *,
- struct lxc_conf *, void *);
-extern int set_config_network_legacy_veth_pair(const char *, const char *,
- struct lxc_conf *, void *);
-extern int set_config_network_legacy_macvlan_mode(const char *, const char *,
- struct lxc_conf *, void *);
-extern int set_config_network_legacy_hwaddr(const char *, const char *,
- struct lxc_conf *, void *);
-extern int set_config_network_legacy_vlan_id(const char *, const char *,
- struct lxc_conf *, void *);
-extern int set_config_network_legacy_mtu(const char *, const char *,
- struct lxc_conf *, void *);
-extern int set_config_network_legacy_ipv4(const char *, const char *,
- struct lxc_conf *, void *);
-extern int set_config_network_legacy_ipv4_gateway(const char *, const char *,
- struct lxc_conf *, void *);
-extern int set_config_network_legacy_script_up(const char *, const char *,
- struct lxc_conf *, void *);
-extern int set_config_network_legacy_script_down(const char *, const char *,
- struct lxc_conf *, void *);
-extern int set_config_network_legacy_ipv6(const char *, const char *,
- struct lxc_conf *, void *);
-extern int set_config_network_legacy_ipv6_gateway(const char *, const char *,
- struct lxc_conf *, void *);
-extern int set_config_network_legacy_nic(const char *, const char *,
- struct lxc_conf *, void *);
-extern int get_config_network_legacy_item(const char *, char *, int,
- struct lxc_conf *, void *);
-extern int clr_config_network_legacy_item(const char *, struct lxc_conf *,
- void *);
-
-extern int lxc_list_nicconfigs_legacy(struct lxc_conf *c, const char *key,
- char *retv, int inlen);
-extern int lxc_listconfigs(char *retv, int inlen);
-
-extern bool network_new_hwaddrs(struct lxc_conf *conf);
-
-#define lxc_config_legacy_define(name) \
- extern int set_config_##name(const char *, const char *, \
- struct lxc_conf *, void *); \
- extern int get_config_##name(const char *, char *, int, \
- struct lxc_conf *, void *); \
- extern int clr_config_##name(const char *, struct lxc_conf *, \
- void *);
-
-lxc_config_legacy_define(network_legacy);
-lxc_config_legacy_define(lsm_aa_profile);
-lxc_config_legacy_define(lsm_aa_incomplete);
-lxc_config_legacy_define(lsm_se_context);
-lxc_config_legacy_define(limit);
-
-#endif /* __LXC_CONFILE_LEGACY_H */
diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
index f0191c177..8eab554ed 100644
--- a/src/lxc/lxccontainer.c
+++ b/src/lxc/lxccontainer.c
@@ -46,7 +46,6 @@
#include "commands.h"
#include "commands_utils.h"
#include "confile.h"
-#include "confile_legacy.h"
#include "confile_utils.h"
#include "console.h"
#include "criu.h"
@@ -2380,10 +2379,8 @@ static int do_lxcapi_get_keys(struct lxc_container *c, const char *key, char *re
* This is an intelligent result to show which keys are valid given the
* type of nic it is.
*/
- if (!strncmp(key, "lxc.net.", 8))
+ if (strncmp(key, "lxc.net.", 8) == 0)
ret = lxc_list_net(c->lxc_conf, key, retv, inlen);
- else if (strncmp(key, "lxc.network.", 12) == 0)
- ret = lxc_list_nicconfigs_legacy(c->lxc_conf, key, retv, inlen);
else
ret = lxc_list_subkeys(c->lxc_conf, key, retv, inlen);
@@ -3192,11 +3189,6 @@ static int copy_fstab(struct lxc_container *oldc, struct lxc_container *c)
if (!oldpath)
return 0;
- /* REMOVE IN LXC 3.0
- legacy mount key
- */
- clear_unexp_config_line(c->lxc_conf, "lxc.mount", false);
-
clear_unexp_config_line(c->lxc_conf, "lxc.mount.fstab", false);
char *p = strrchr(oldpath, '/');
@@ -3330,11 +3322,6 @@ static int copy_storage(struct lxc_container *c0, struct lxc_container *c,
return -1;
}
- /* REMOVE IN LXC 3.0
- * legacy rootfs key
- */
- clear_unexp_config_line(c->lxc_conf, "lxc.rootfs", false);
-
/* Append a new lxc.rootfs.path entry to the unexpanded config. */
clear_unexp_config_line(c->lxc_conf, "lxc.rootfs.path", false);
if (!do_append_unexp_config_line(c->lxc_conf, "lxc.rootfs.path",
@@ -3343,11 +3330,6 @@ static int copy_storage(struct lxc_container *c0, struct lxc_container *c,
return -1;
}
- /* REMOVE IN LXC 3.0
- * legacy rootfs.backend key
- */
- clear_unexp_config_line(c->lxc_conf, "lxc.rootfs.backend", false);
-
if (flags & LXC_CLONE_SNAPSHOT)
copy_rdepends(c, c0);
if (need_rdep) {
@@ -3569,11 +3551,6 @@ static struct lxc_container *do_lxcapi_clone(struct lxc_container *c, const char
goto out;
}
- /* REMOVE IN LXC 3.0
- * legacy rootfs key
- */
- clear_unexp_config_line(c->lxc_conf, "lxc.rootfs", false);
-
clear_unexp_config_line(c->lxc_conf, "lxc.rootfs.path", false);
write_config(fout, c->lxc_conf);
fclose(fout);
diff --git a/src/lxc/network.c b/src/lxc/network.c
index bf06e6f4a..5780e489a 100644
--- a/src/lxc/network.c
+++ b/src/lxc/network.c
@@ -3014,13 +3014,6 @@ int lxc_setup_network_in_child_namespaces(const struct lxc_conf *conf,
lxc_list_for_each(iterator, network) {
netdev = iterator->elem;
- /* REMOVE in LXC 3.0 */
- if (netdev->idx < 0) {
- ERROR("WARNING: using \"lxc.network.*\" keys to define "
- "networks is DEPRECATED, please switch to using "
- "\"lxc.net.[i].* keys\"");
- }
-
if (lxc_setup_netdev_in_child_namespaces(netdev)) {
ERROR("failed to setup netdev");
return -1;
diff --git a/src/lxc/tools/lxc_attach.c b/src/lxc/tools/lxc_attach.c
index 926bf079e..2eeb5dddf 100644
--- a/src/lxc/tools/lxc_attach.c
+++ b/src/lxc/tools/lxc_attach.c
@@ -300,9 +300,6 @@ int main(int argc, char *argv[])
}
}
- /* REMOVE IN LXC 3.0 */
- setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
-
struct lxc_container *c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
if (!c)
exit(EXIT_FAILURE);
diff --git a/src/lxc/tools/lxc_autostart.c b/src/lxc/tools/lxc_autostart.c
index 48727b9f1..17301ca4f 100644
--- a/src/lxc/tools/lxc_autostart.c
+++ b/src/lxc/tools/lxc_autostart.c
@@ -367,9 +367,6 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE);
lxc_log_options_no_override();
- /* REMOVE IN LXC 3.0 */
- setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
-
count = list_defined_containers(my_args.lxcpath[0], NULL, &containers);
if (count < 0)
diff --git a/src/lxc/tools/lxc_cgroup.c b/src/lxc/tools/lxc_cgroup.c
index cfd14bd8f..26eb460ec 100644
--- a/src/lxc/tools/lxc_cgroup.c
+++ b/src/lxc/tools/lxc_cgroup.c
@@ -85,9 +85,6 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE);
lxc_log_options_no_override();
- /* REMOVE IN LXC 3.0 */
- setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
-
state_object = my_args.argv[0];
c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
diff --git a/src/lxc/tools/lxc_checkpoint.c b/src/lxc/tools/lxc_checkpoint.c
index 8f93934b3..19c63f8d3 100644
--- a/src/lxc/tools/lxc_checkpoint.c
+++ b/src/lxc/tools/lxc_checkpoint.c
@@ -255,9 +255,6 @@ int main(int argc, char *argv[])
lxc_log_options_no_override();
- /* REMOVE IN LXC 3.0 */
- setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
-
c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
if (!c) {
fprintf(stderr, "System error loading %s\n", my_args.name);
diff --git a/src/lxc/tools/lxc_clone.c b/src/lxc/tools/lxc_clone.c
index 3aed40739..b570c0853 100644
--- a/src/lxc/tools/lxc_clone.c
+++ b/src/lxc/tools/lxc_clone.c
@@ -174,8 +174,6 @@ int main(int argc, char *argv[])
usage(argv[0]);
}
- setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
-
c1 = lxc_container_new(orig, lxcpath);
if (!c1)
exit(EXIT_FAILURE);
diff --git a/src/lxc/tools/lxc_config.c b/src/lxc/tools/lxc_config.c
index 86187bd57..0350dbaf4 100644
--- a/src/lxc/tools/lxc_config.c
+++ b/src/lxc/tools/lxc_config.c
@@ -62,8 +62,6 @@ int main(int argc, char *argv[])
struct lxc_config_items *i;
const char *value;
- setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
-
if (argc < 2 || strcmp(argv[1], "-h") == 0 ||
strcmp(argv[1], "--help") == 0)
usage(argv[0]);
diff --git a/src/lxc/tools/lxc_console.c b/src/lxc/tools/lxc_console.c
index 876cbce58..e544f37f4 100644
--- a/src/lxc/tools/lxc_console.c
+++ b/src/lxc/tools/lxc_console.c
@@ -117,9 +117,6 @@ int main(int argc, char *argv[])
return EXIT_FAILURE;
lxc_log_options_no_override();
- /* REMOVE IN LXC 3.0 */
- setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
-
c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
if (!c) {
fprintf(stderr, "System error loading container\n");
diff --git a/src/lxc/tools/lxc_copy.c b/src/lxc/tools/lxc_copy.c
index 1718f84a7..185824639 100644
--- a/src/lxc/tools/lxc_copy.c
+++ b/src/lxc/tools/lxc_copy.c
@@ -188,9 +188,6 @@ int main(int argc, char *argv[])
exit(ret);
lxc_log_options_no_override();
- /* REMOVE IN LXC 3.0 */
- setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
-
if (geteuid()) {
if (access(my_args.lxcpath[0], O_RDONLY) < 0) {
if (!my_args.quiet)
diff --git a/src/lxc/tools/lxc_create.c b/src/lxc/tools/lxc_create.c
index f702c2ba7..039a291eb 100644
--- a/src/lxc/tools/lxc_create.c
+++ b/src/lxc/tools/lxc_create.c
@@ -227,9 +227,6 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE);
lxc_log_options_no_override();
- /* REMOVE IN LXC 3.0 */
- setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
-
if (!my_args.template) {
fprintf(stderr, "A template must be specified.\n");
fprintf(stderr, "Use \"none\" if you really want a container without a rootfs.\n");
diff --git a/src/lxc/tools/lxc_destroy.c b/src/lxc/tools/lxc_destroy.c
index 1c3f7dc50..94ee86418 100644
--- a/src/lxc/tools/lxc_destroy.c
+++ b/src/lxc/tools/lxc_destroy.c
@@ -87,9 +87,6 @@ int main(int argc, char *argv[])
if (my_args.quiet)
quiet = true;
- /* REMOVE IN LXC 3.0 */
- setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
-
c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
if (!c) {
if (!quiet)
diff --git a/src/lxc/tools/lxc_device.c b/src/lxc/tools/lxc_device.c
index f73e8c2cb..bee18a210 100644
--- a/src/lxc/tools/lxc_device.c
+++ b/src/lxc/tools/lxc_device.c
@@ -125,9 +125,6 @@ int main(int argc, char *argv[])
goto err;
lxc_log_options_no_override();
- /* REMOVE IN LXC 3.0 */
- setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
-
c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
if (!c) {
fprintf(stderr, "%s doesn't exist\n", my_args.name);
diff --git a/src/lxc/tools/lxc_execute.c b/src/lxc/tools/lxc_execute.c
index 3348d7c1c..a77296879 100644
--- a/src/lxc/tools/lxc_execute.c
+++ b/src/lxc/tools/lxc_execute.c
@@ -158,9 +158,6 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE);
lxc_log_options_no_override();
- /* REMOVE IN LXC 3.0 */
- setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
-
c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
if (!c) {
fprintf(stderr, "Failed to create lxc_container\n");
diff --git a/src/lxc/tools/lxc_freeze.c b/src/lxc/tools/lxc_freeze.c
index aab2b6fe3..d6dcf1597 100644
--- a/src/lxc/tools/lxc_freeze.c
+++ b/src/lxc/tools/lxc_freeze.c
@@ -74,9 +74,6 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE);
lxc_log_options_no_override();
- /* REMOVE IN LXC 3.0 */
- setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
-
c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
if (!c) {
fprintf(stderr, "No such container: %s:%s\n", my_args.lxcpath[0], my_args.name);
diff --git a/src/lxc/tools/lxc_info.c b/src/lxc/tools/lxc_info.c
index 3c7f6b398..a8c39b3c3 100644
--- a/src/lxc/tools/lxc_info.c
+++ b/src/lxc/tools/lxc_info.c
@@ -411,9 +411,6 @@ int main(int argc, char *argv[])
exit(ret);
lxc_log_options_no_override();
- /* REMOVE IN LXC 3.0 */
- setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
-
if (print_info(my_args.name, my_args.lxcpath[0]) == 0)
ret = EXIT_SUCCESS;
diff --git a/src/lxc/tools/lxc_ls.c b/src/lxc/tools/lxc_ls.c
index 216eb3c47..66a85acf1 100644
--- a/src/lxc/tools/lxc_ls.c
+++ b/src/lxc/tools/lxc_ls.c
@@ -233,9 +233,6 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE);
lxc_log_options_no_override();
- /* REMOVE IN LXC 3.0 */
- setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
-
struct lengths max_len = {
/* default header length */
.name_length = 4, /* NAME */
@@ -564,11 +561,6 @@ static int ls_get(struct ls **m, size_t *size, const struct lxc_arguments *args,
* problem with the ovl_mkdir() function in
* lxcoverlay.{c,h}. */
char *curr_path = ls_get_config_item(c, "lxc.rootfs.path", running);
- /* REMOVE IN LXC 3.0
- legacy rootfs key
- */
- if (!curr_path)
- curr_path = ls_get_config_item(c, "lxc.rootfs", running);
if (!curr_path)
goto put_and_next;
diff --git a/src/lxc/tools/lxc_monitor.c b/src/lxc/tools/lxc_monitor.c
index 0b094af11..683df6461 100644
--- a/src/lxc/tools/lxc_monitor.c
+++ b/src/lxc/tools/lxc_monitor.c
@@ -111,9 +111,6 @@ int main(int argc, char *argv[])
exit(rc_main);
lxc_log_options_no_override();
- /* REMOVE IN LXC 3.0 */
- setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
-
if (quit_monitord) {
int ret = EXIT_SUCCESS;
for (i = 0; i < my_args.lxcpath_cnt; i++) {
diff --git a/src/lxc/tools/lxc_snapshot.c b/src/lxc/tools/lxc_snapshot.c
index 0c0ea3ada..5bbb5aad6 100644
--- a/src/lxc/tools/lxc_snapshot.c
+++ b/src/lxc/tools/lxc_snapshot.c
@@ -99,9 +99,6 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE);
lxc_log_options_no_override();
- /* REMOVE IN LXC 3.0 */
- setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
-
if (geteuid()) {
if (access(my_args.lxcpath[0], O_RDONLY) < 0) {
fprintf(stderr, "You lack access to %s\n",
diff --git a/src/lxc/tools/lxc_start.c b/src/lxc/tools/lxc_start.c
index 5a422923f..9c5f4e0e9 100644
--- a/src/lxc/tools/lxc_start.c
+++ b/src/lxc/tools/lxc_start.c
@@ -190,9 +190,6 @@ int main(int argc, char *argv[])
exit(err);
}
- /* REMOVE IN LXC 3.0 */
- setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
-
/*
* rcfile possibilities:
* 1. rcfile from random path specified in cli option
diff --git a/src/lxc/tools/lxc_stop.c b/src/lxc/tools/lxc_stop.c
index 9d2ba6ed1..d5efb9d20 100644
--- a/src/lxc/tools/lxc_stop.c
+++ b/src/lxc/tools/lxc_stop.c
@@ -115,9 +115,6 @@ int main(int argc, char *argv[])
exit(ret);
lxc_log_options_no_override();
- /* REMOVE IN LXC 3.0 */
- setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
-
/* Set default timeout */
if (my_args.timeout == -2) {
if (my_args.hardstop)
diff --git a/src/lxc/tools/lxc_unfreeze.c b/src/lxc/tools/lxc_unfreeze.c
index 5027d28e6..c00addb85 100644
--- a/src/lxc/tools/lxc_unfreeze.c
+++ b/src/lxc/tools/lxc_unfreeze.c
@@ -73,9 +73,6 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE);
lxc_log_options_no_override();
- /* REMOVE IN LXC 3.0 */
- setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
-
c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
if (!c) {
fprintf(stderr, "No such container: %s:%s\n", my_args.lxcpath[0], my_args.name);
diff --git a/src/lxc/tools/lxc_wait.c b/src/lxc/tools/lxc_wait.c
index 62b7c01b5..f429ab1de 100644
--- a/src/lxc/tools/lxc_wait.c
+++ b/src/lxc/tools/lxc_wait.c
@@ -100,9 +100,6 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE);
lxc_log_options_no_override();
- /* REMOVE IN LXC 3.0 */
- setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
-
c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
if (!c)
exit(EXIT_FAILURE);
More information about the lxc-devel
mailing list