Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
b3c723c4
Commit
b3c723c4
authored
Aug 22, 2017
by
Serge Hallyn
Committed by
GitHub
Aug 22, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1756 from brauner/2017-08-10/further_lxc_2.1_preparations
further lxc 2.1 preparations
parents
ed07dfa9
d6259d36
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
242 additions
and
314 deletions
+242
-314
confile.c
src/lxc/confile.c
+207
-310
confile.h
src/lxc/confile.h
+1
-1
lxc-checkconfig.in
src/lxc/tools/lxc-checkconfig.in
+34
-3
No files found.
src/lxc/confile.c
View file @
b3c723c4
...
...
@@ -68,14 +68,12 @@
lxc_log_define
(
lxc_confile
,
lxc
);
#define lxc_config_define(name) \
static int set_config_##name(const char *, const char *, \
struct lxc_conf *, void *); \
static int get_config_##name(const char *, char *, int, \
struct lxc_conf *, void *); \
static int clr_config_##name(const char *, struct lxc_conf *, \
void *);
#define lxc_config_define(name) \
static int set_config_##name(const char *, const char *, \
struct lxc_conf *, void *); \
static int get_config_##name(const char *, char *, int, \
struct lxc_conf *, void *); \
static int clr_config_##name(const char *, struct lxc_conf *, void *);
lxc_config_define
(
personality
);
lxc_config_define
(
pty_max
);
...
...
@@ -139,54 +137,39 @@ lxc_config_define(prlimit);
static
struct
lxc_config_t
config
[]
=
{
/* REMOVE in LXC 3.0 */
{
"lxc.arch"
,
false
,
set_config_personality
,
get_config_personality
,
clr_config_personality
,
},
{
"lxc.pty.max"
,
false
,
set_config_pty_max
,
get_config_pty_max
,
clr_config_pty_max
,
},
{
"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
,
},
/* [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
,
},
/* [END]: REMOVE IN LXC 3.0 */
{
"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.selinux.context"
,
false
,
set_config_selinux_context
,
get_config_selinux_context
,
clr_config_selinux_context
,
},
/* [START]: REMOVE IN LXC 3.0 */
{
"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
,
},
/* [END]: REMOVE IN LXC 3.0 */
{
"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.cgroup"
,
false
,
set_config_cgroup
,
get_config_cgroup
,
clr_config_cgroup
,
},
{
"lxc.idmap"
,
false
,
set_config_idmaps
,
get_config_idmaps
,
clr_config_idmaps
,
},
{
"lxc.mount.entry"
,
false
,
set_config_mount
,
get_config_mount
,
clr_config_mount
,
},
{
"lxc.mount.auto"
,
false
,
set_config_mount_auto
,
get_config_mount_auto
,
clr_config_mount_auto
,
},
{
"lxc.mount.fstab"
,
false
,
set_config_mount_fstab
,
get_config_mount_fstab
,
clr_config_mount_fstab
,
},
{
"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
,
},
/* [START]: REMOVE IN LXC 3.0 */
{
"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
,
},
/* [END]: REMOVE IN LXC 3.0 */
{
"lxc.uts.name"
,
false
,
set_config_uts_name
,
get_config_uts_name
,
clr_config_uts_name
,
},
{
"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.environment"
,
false
,
set_config_environment
,
get_config_environment
,
clr_config_environment
,
},
{
"lxc.ephemeral"
,
false
,
set_config_ephemeral
,
get_config_ephemeral
,
clr_config_ephemeral
,
},
{
"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-start"
,
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.mount"
,
false
,
set_config_hooks
,
get_config_hooks
,
clr_config_hooks
,
},
{
"lxc.hook.autodev"
,
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.stop"
,
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.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"
,
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.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
,
},
/* [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
,
},
...
...
@@ -208,52 +191,58 @@ static struct lxc_config_t config[] = {
{
"lxc.network"
,
true
,
set_config_network_legacy
,
get_config_network_legacy
,
clr_config_network_legacy
,
},
/* [END]: REMOVE IN LXC 3.0 */
{
"lxc.net.type"
,
false
,
set_config_net_type
,
get_config_net_type
,
clr_config_net_type
,
},
{
"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.name"
,
false
,
set_config_net_name
,
get_config_net_name
,
clr_config_net_name
,
},
{
"lxc.net.macvlan.mode"
,
false
,
set_config_net_macvlan_mode
,
get_config_net_macvlan_mode
,
clr_config_net_macvlan_mode
,
},
{
"lxc.net.veth.pair"
,
false
,
set_config_net_veth_pair
,
get_config_net_veth_pair
,
clr_config_net_veth_pair
,
},
{
"lxc.net.script.up"
,
false
,
set_config_net_script_up
,
get_config_net_script_up
,
clr_config_net_script_up
,
},
{
"lxc.net.script.down"
,
false
,
set_config_net_script_down
,
get_config_net_script_down
,
clr_config_net_script_down
,
},
{
"lxc.net.hwaddr"
,
false
,
set_config_net_hwaddr
,
get_config_net_hwaddr
,
clr_config_net_hwaddr
,
},
{
"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.ipv4.gateway"
,
false
,
set_config_net_ipv4_gateway
,
get_config_net_ipv4_gateway
,
clr_config_net_ipv4_gateway
,
},
{
"lxc.net.ipv4.address"
,
false
,
set_config_net_ipv4_address
,
get_config_net_ipv4_address
,
clr_config_net_ipv4_address
,
},
{
"lxc.net.ipv6.gateway"
,
false
,
set_config_net_ipv6_gateway
,
get_config_net_ipv6_gateway
,
clr_config_net_ipv6_gateway
,
},
{
"lxc.net.ipv6.address"
,
false
,
set_config_net_ipv6_address
,
get_config_net_ipv6_address
,
clr_config_net_ipv6_address
,
},
{
"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.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.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.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.include"
,
false
,
set_config_includefiles
,
get_config_includefiles
,
clr_config_includefiles
,
},
{
"lxc.autodev"
,
false
,
set_config_autodev
,
get_config_autodev
,
clr_config_autodev
,
},
/* [START]: REMOVE IN LXC 3.0 */
{
"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
,
},
/* [END]: REMOVE IN LXC 3.0 */
{
"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.monitor.unshare"
,
false
,
set_config_monitor
,
get_config_monitor
,
clr_config_monitor
,
},
{
"lxc.group"
,
false
,
set_config_group
,
get_config_group
,
clr_config_group
,
},
{
"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.no_new_privs"
,
false
,
set_config_no_new_privs
,
get_config_no_new_privs
,
clr_config_no_new_privs
,
},
{
"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
,
},
/* [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.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
,
},
...
...
@@ -262,14 +251,6 @@ static struct lxc_config_t config[] = {
{
"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
,
},
/* [END]: REMOVE IN LXC 3.0 */
{
"lxc.log.syslog"
,
false
,
set_config_log_syslog
,
get_config_log_syslog
,
clr_config_log_syslog
,
},
{
"lxc.log.level"
,
false
,
set_config_log_level
,
get_config_log_level
,
clr_config_log_level
,
},
{
"lxc.log.file"
,
false
,
set_config_log_file
,
get_config_log_file
,
clr_config_log_file
,
},
{
"lxc.init.cmd"
,
false
,
set_config_init_cmd
,
get_config_init_cmd
,
clr_config_init_cmd
,
},
{
"lxc.init.uid"
,
false
,
set_config_init_uid
,
get_config_init_uid
,
clr_config_init_uid
,
},
{
"lxc.init.gid"
,
false
,
set_config_init_gid
,
get_config_init_gid
,
clr_config_init_gid
,
},
{
"lxc.prlimit"
,
false
,
set_config_prlimit
,
get_config_prlimit
,
clr_config_prlimit
,
},
};
struct
signame
{
...
...
@@ -438,7 +419,7 @@ static int set_config_net_flags(const char *key, const char *value,
}
static
int
create_matched_ifnames
(
const
char
*
value
,
struct
lxc_conf
*
lxc_conf
,
struct
lxc_netdev
*
netdev
)
struct
lxc_netdev
*
netdev
)
{
struct
ifaddrs
*
ifaddr
,
*
ifa
;
int
n
;
...
...
@@ -576,10 +557,9 @@ static int set_config_net_hwaddr(const char *key, const char *value,
return
-
1
;
new_value
=
strdup
(
value
);
if
(
!
new_value
)
{
SYSERROR
(
"failed to strdup
\"
%s
\"
"
,
value
);
if
(
!
new_value
)
return
-
1
;
}
rand_complete_hwaddr
(
new_value
);
if
(
lxc_config_value_empty
(
new_value
))
{
...
...
@@ -595,6 +575,7 @@ static int set_config_net_hwaddr(const char *key, const char *value,
static
int
set_config_net_vlan_id
(
const
char
*
key
,
const
char
*
value
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
int
ret
;
struct
lxc_netdev
*
netdev
;
if
(
lxc_config_value_empty
(
value
))
...
...
@@ -607,7 +588,8 @@ static int set_config_net_vlan_id(const char *key, const char *value,
if
(
!
netdev
)
return
-
1
;
if
(
get_u16
(
&
netdev
->
priv
.
vlan_attr
.
vid
,
value
,
0
))
ret
=
get_u16
(
&
netdev
->
priv
.
vlan_attr
.
vid
,
value
,
0
);
if
(
ret
<
0
)
return
-
1
;
return
0
;
...
...
@@ -634,6 +616,7 @@ static int set_config_net_mtu(const char *key, const char *value,
static
int
set_config_net_ipv4_address
(
const
char
*
key
,
const
char
*
value
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
int
ret
;
struct
lxc_netdev
*
netdev
;
struct
lxc_inetdev
*
inetdev
;
struct
lxc_list
*
list
;
...
...
@@ -651,15 +634,13 @@ static int set_config_net_ipv4_address(const char *key, const char *value,
return
-
1
;
inetdev
=
malloc
(
sizeof
(
*
inetdev
));
if
(
!
inetdev
)
{
SYSERROR
(
"failed to allocate ipv4 address"
);
if
(
!
inetdev
)
return
-
1
;
}
memset
(
inetdev
,
0
,
sizeof
(
*
inetdev
));
list
=
malloc
(
sizeof
(
*
list
));
if
(
!
list
)
{
SYSERROR
(
"failed to allocate memory"
);
free
(
inetdev
);
return
-
1
;
}
...
...
@@ -669,7 +650,6 @@ static int set_config_net_ipv4_address(const char *key, const char *value,
addr
=
strdup
(
value
);
if
(
!
addr
)
{
ERROR
(
"no address specified"
);
free
(
inetdev
);
free
(
list
);
return
-
1
;
...
...
@@ -687,25 +667,31 @@ static int set_config_net_ipv4_address(const char *key, const char *value,
prefix
=
slash
+
1
;
}
if
(
!
inet_pton
(
AF_INET
,
addr
,
&
inetdev
->
addr
))
{
SYSERROR
(
"invalid ipv4 address: %s"
,
value
);
ret
=
inet_pton
(
AF_INET
,
addr
,
&
inetdev
->
addr
);
if
(
!
ret
||
ret
<
0
)
{
SYSERROR
(
"Invalid ipv4 address
\"
%s
\"
"
,
value
);
free
(
inetdev
);
free
(
addr
);
free
(
list
);
return
-
1
;
}
if
(
bcast
&&
!
inet_pton
(
AF_INET
,
bcast
,
&
inetdev
->
bcast
))
{
SYSERROR
(
"invalid ipv4 broadcast address: %s"
,
value
);
free
(
inetdev
);
free
(
list
);
free
(
addr
);
return
-
1
;
if
(
bcast
)
{
ret
=
inet_pton
(
AF_INET
,
bcast
,
&
inetdev
->
bcast
);
if
(
!
ret
||
ret
<
0
)
{
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
)
ret
=
lxc_safe_uint
(
prefix
,
&
inetdev
->
prefix
);
if
(
ret
<
0
)
return
-
1
;
}
else
{
inetdev
->
prefix
=
config_ip_prefix
(
&
inetdev
->
addr
);
...
...
@@ -716,8 +702,7 @@ static int set_config_net_ipv4_address(const char *key, const char *value,
*/
if
(
!
bcast
)
{
inetdev
->
bcast
.
s_addr
=
inetdev
->
addr
.
s_addr
;
inetdev
->
bcast
.
s_addr
|=
htonl
(
INADDR_BROADCAST
>>
inetdev
->
prefix
);
inetdev
->
bcast
.
s_addr
|=
htonl
(
INADDR_BROADCAST
>>
inetdev
->
prefix
);
}
lxc_list_add_tail
(
&
netdev
->
ipv4
,
list
);
...
...
@@ -747,16 +732,16 @@ static int set_config_net_ipv4_gateway(const char *key, const char *value,
netdev
->
ipv4_gateway
=
NULL
;
netdev
->
ipv4_gateway_auto
=
true
;
}
else
{
int
ret
;
struct
in_addr
*
gw
;
gw
=
malloc
(
sizeof
(
*
gw
));
if
(
!
gw
)
{
SYSERROR
(
"failed to allocate ipv4 gateway address"
);
if
(
!
gw
)
return
-
1
;
}
if
(
!
inet_pton
(
AF_INET
,
value
,
gw
))
{
SYSERROR
(
"invalid ipv4 gateway address: %s"
,
value
);
ret
=
inet_pton
(
AF_INET
,
value
,
gw
);
if
(
!
ret
||
ret
<
0
)
{
SYSERROR
(
"Invalid ipv4 gateway address
\"
%s
\"
"
,
value
);
free
(
gw
);
return
-
1
;
}
...
...
@@ -771,6 +756,7 @@ static int set_config_net_ipv4_gateway(const char *key, const char *value,
static
int
set_config_net_ipv6_address
(
const
char
*
key
,
const
char
*
value
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
int
ret
;
struct
lxc_netdev
*
netdev
;
struct
lxc_inet6dev
*
inet6dev
;
struct
lxc_list
*
list
;
...
...
@@ -787,15 +773,13 @@ static int set_config_net_ipv6_address(const char *key, const char *value,
return
-
1
;
inet6dev
=
malloc
(
sizeof
(
*
inet6dev
));
if
(
!
inet6dev
)
{
SYSERROR
(
"failed to allocate ipv6 address"
);
if
(
!
inet6dev
)
return
-
1
;
}
memset
(
inet6dev
,
0
,
sizeof
(
*
inet6dev
));
list
=
malloc
(
sizeof
(
*
list
));
if
(
!
list
)
{
SYSERROR
(
"failed to allocate memory"
);
free
(
inet6dev
);
return
-
1
;
}
...
...
@@ -805,7 +789,6 @@ static int set_config_net_ipv6_address(const char *key, const char *value,
valdup
=
strdup
(
value
);
if
(
!
valdup
)
{
ERROR
(
"no address specified"
);
free
(
list
);
free
(
inet6dev
);
return
-
1
;
...
...
@@ -820,8 +803,9 @@ static int set_config_net_ipv6_address(const char *key, const char *value,
return
-
1
;
}
if
(
!
inet_pton
(
AF_INET6
,
valdup
,
&
inet6dev
->
addr
))
{
SYSERROR
(
"invalid ipv6 address: %s"
,
valdup
);
ret
=
inet_pton
(
AF_INET6
,
valdup
,
&
inet6dev
->
addr
);
if
(
!
ret
||
ret
<
0
)
{
SYSERROR
(
"Invalid ipv6 address
\"
%s
\"
"
,
valdup
);
free
(
list
);
free
(
inet6dev
);
free
(
valdup
);
...
...
@@ -855,16 +839,16 @@ static int set_config_net_ipv6_gateway(const char *key, const char *value,
netdev
->
ipv6_gateway
=
NULL
;
netdev
->
ipv6_gateway_auto
=
true
;
}
else
{
int
ret
;
struct
in6_addr
*
gw
;
gw
=
malloc
(
sizeof
(
*
gw
));
if
(
!
gw
)
{
SYSERROR
(
"failed to allocate ipv6 gateway address"
);
if
(
!
gw
)
return
-
1
;
}
if
(
!
inet_pton
(
AF_INET6
,
value
,
gw
))
{
SYSERROR
(
"invalid ipv6 gateway address: %s"
,
value
);
ret
=
inet_pton
(
AF_INET6
,
value
,
gw
);
if
(
!
ret
||
ret
<
0
)
{
SYSERROR
(
"Invalid ipv6 gateway address
\"
%s
\"
"
,
value
);
free
(
gw
);
return
-
1
;
}
...
...
@@ -944,15 +928,14 @@ static int set_config_init_uid(const char *key, const char *value,
{
unsigned
int
init_uid
;
/* Set config value to default. */
if
(
lxc_config_value_empty
(
value
))
{
lxc_conf
->
init_uid
=
0
;
return
0
;
}
/* Parse new config value. */
if
(
lxc_safe_uint
(
value
,
&
init_uid
)
<
0
)
return
-
1
;
lxc_conf
->
init_uid
=
init_uid
;
return
0
;
...
...
@@ -963,15 +946,14 @@ static int set_config_init_gid(const char *key, const char *value,
{
unsigned
int
init_gid
;
/* Set config value to default. */
if
(
lxc_config_value_empty
(
value
))
{
lxc_conf
->
init_gid
=
0
;
return
0
;
}
/* Parse new config value. */
if
(
lxc_safe_uint
(
value
,
&
init_gid
)
<
0
)
return
-
1
;
lxc_conf
->
init_gid
=
init_gid
;
return
0
;
...
...
@@ -986,14 +968,13 @@ static int set_config_hooks(const char *key, const char *value,
return
lxc_clear_hooks
(
lxc_conf
,
key
);
if
(
strcmp
(
key
+
4
,
"hook"
)
==
0
)
{
ERROR
(
"lxc.hook
cannot tak
e a value"
);
ERROR
(
"lxc.hook
must not hav
e a value"
);
return
-
1
;
}
copy
=
strdup
(
value
);
if
(
!
copy
)
{
SYSERROR
(
"failed to dup string '%s'"
,
value
);
if
(
!
copy
)
return
-
1
;
}
if
(
strcmp
(
key
+
9
,
"pre-start"
)
==
0
)
return
add_hook
(
lxc_conf
,
LXCHOOK_PRESTART
,
copy
);
...
...
@@ -1014,7 +995,6 @@ static int set_config_hooks(const char *key, const char *value,
else
if
(
strcmp
(
key
+
9
,
"destroy"
)
==
0
)
return
add_hook
(
lxc_conf
,
LXCHOOK_DESTROY
,
copy
);
SYSERROR
(
"Unknown key: %s"
,
key
);
free
(
copy
);
return
-
1
;
}
...
...
@@ -1027,7 +1007,7 @@ static int set_config_personality(const char *key, const char *value,
if
(
personality
>=
0
)
lxc_conf
->
personality
=
personality
;
else
WARN
(
"
unsupported personality '%s'
"
,
value
);
WARN
(
"
Unsupported personality
\"
%s
\"
"
,
value
);
return
0
;
}
...
...
@@ -1035,13 +1015,11 @@ static int set_config_personality(const char *key, const char *value,
static
int
set_config_pty_max
(
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
->
pts
=
0
;
return
0
;
}
/* Parse new config value. */
if
(
lxc_safe_uint
(
value
,
&
lxc_conf
->
pts
)
<
0
)
return
-
1
;
...
...
@@ -1061,13 +1039,11 @@ static int set_config_start(const char *key, const char *value,
is_empty
=
lxc_config_value_empty
(
value
);
if
(
*
(
key
+
10
)
==
'a'
)
{
/* lxc.start.auto */
/* Set config value to default. */
if
(
is_empty
)
{
lxc_conf
->
start_auto
=
0
;
return
0
;
}
/* Parse new config value. */
if
(
lxc_safe_uint
(
value
,
&
lxc_conf
->
start_auto
)
<
0
)
return
-
1
;
...
...
@@ -1076,43 +1052,35 @@ static int set_config_start(const char *key, const char *value,
return
0
;
}
else
if
(
*
(
key
+
10
)
==
'd'
)
{
/* lxc.start.delay */
/* Set config value to default. */
if
(
is_empty
)
{
lxc_conf
->
start_delay
=
0
;
return
0
;
}
/* Parse new config value. */
return
lxc_safe_uint
(
value
,
&
lxc_conf
->
start_delay
);
}
else
if
(
*
(
key
+
10
)
==
'o'
)
{
/* lxc.start.order */
/* Set config value to default. */
if
(
is_empty
)
{
lxc_conf
->
start_order
=
0
;
return
0
;
}
/* Parse new config value. */
return
lxc_safe_int
(
value
,
&
lxc_conf
->
start_order
);
}
SYSERROR
(
"Unknown key: %s"
,
key
);
return
-
1
;
}
static
int
set_config_monitor
(
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
->
monitor_unshare
=
0
;
return
0
;
}
/* Parse new config value. */
if
(
strcmp
(
key
+
12
,
"unshare"
)
==
0
)
return
lxc_safe_uint
(
value
,
&
lxc_conf
->
monitor_unshare
);
SYSERROR
(
"Unknown key: %s"
,
key
);
return
-
1
;
}
...
...
@@ -1127,13 +1095,11 @@ static int set_config_group(const char *key, const char *value,
return
lxc_clear_groups
(
lxc_conf
);
groups
=
strdup
(
value
);
if
(
!
groups
)
{
SYSERROR
(
"failed to dup '%s'"
,
value
);
if
(
!
groups
)
return
-
1
;
}
/* In case several groups are specified in a single line
*
split these
groups in a single element for the list.
/* In case several groups are specified in a single line
split these
* groups in a single element for the list.
*/
for
(
groupptr
=
groups
;;
groupptr
=
NULL
)
{
token
=
strtok_r
(
groupptr
,
"
\t
"
,
&
sptr
);
...
...
@@ -1143,14 +1109,11 @@ static int set_config_group(const char *key, const char *value,
}
grouplist
=
malloc
(
sizeof
(
*
grouplist
));
if
(
!
grouplist
)
{
SYSERROR
(
"failed to allocate groups list"
);
if
(
!
grouplist
)
break
;
}
grouplist
->
elem
=
strdup
(
token
);
if
(
!
grouplist
->
elem
)
{
SYSERROR
(
"failed to dup '%s'"
,
token
);
free
(
grouplist
);
break
;
}
...
...
@@ -1191,13 +1154,11 @@ on_error:
static
int
set_config_tty_max
(
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
->
tty
=
0
;
return
0
;
}
/* Parse new config value. */
return
lxc_safe_uint
(
value
,
&
lxc_conf
->
tty
);
}
...
...
@@ -1219,21 +1180,16 @@ static int set_config_apparmor_allow_incomplete(const char *key,
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.apparmor.allow_incomplete. Can only "
"be set to 0 or 1"
);
if
(
lxc_conf
->
lsm_aa_allow_incomplete
>
1
)
return
-
1
;
}
return
0
;
}
...
...
@@ -1261,6 +1217,7 @@ static int set_config_log_file(const char *key, const char *value,
ret
=
set_config_path_item
(
&
c
->
logfile
,
value
);
if
(
ret
==
0
)
ret
=
lxc_log_set_file
(
&
c
->
logfd
,
c
->
logfile
);
return
ret
;
}
...
...
@@ -1269,13 +1226,11 @@ static int set_config_log_level(const char *key, const char *value,
{
int
newlevel
;
/* Set config value to default. */
if
(
lxc_config_value_empty
(
value
))
{
lxc_conf
->
loglevel
=
LXC_LOG_LEVEL_NOTSET
;
return
0
;
}
/* Parse new config value. */
if
(
value
[
0
]
>=
'0'
&&
value
[
0
]
<=
'9'
)
{
if
(
lxc_safe_int
(
value
,
&
newlevel
)
<
0
)
return
-
1
;
...
...
@@ -1293,20 +1248,16 @@ static int set_config_log_level(const char *key, const char *value,
static
int
set_config_autodev
(
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
->
autodev
=
0
;
return
0
;
}
/* Parse new config value. */
if
(
lxc_safe_uint
(
value
,
&
lxc_conf
->
autodev
)
<
0
)
return
-
1
;
if
(
lxc_conf
->
autodev
>
1
)
{
ERROR
(
"Wrong value for lxc.autodev. Can only be set to 0 or 1"
);
if
(
lxc_conf
->
autodev
>
1
)
return
-
1
;
}
return
0
;
}
...
...
@@ -1365,17 +1316,15 @@ static int set_config_signal_halt(const char *key, const char *value,
{
int
sig_n
;
/* Set config value to default. */
if
(
lxc_config_value_empty
(
value
))
{
lxc_conf
->
haltsignal
=
0
;
return
0
;
}
/* Parse new config value. */
sig_n
=
sig_parse
(
value
);
if
(
sig_n
<
0
)
return
-
1
;
lxc_conf
->
haltsignal
=
sig_n
;
return
0
;
...
...
@@ -1386,16 +1335,15 @@ static int set_config_signal_reboot(const char *key, const char *value,
{
int
sig_n
;
/* Set config value to default. */
if
(
lxc_config_value_empty
(
value
))
{
lxc_conf
->
rebootsignal
=
0
;
return
0
;
}
/* Parse new config value. */
sig_n
=
sig_parse
(
value
);
if
(
sig_n
<
0
)
return
-
1
;
lxc_conf
->
rebootsignal
=
sig_n
;
return
0
;
...
...
@@ -1406,16 +1354,15 @@ static int set_config_signal_stop(const char *key, const char *value,
{
int
sig_n
;
/* Set config value to default. */
if
(
lxc_config_value_empty
(
value
))
{
lxc_conf
->
stopsignal
=
0
;
return
0
;
}
/* Parse new config value. */
sig_n
=
sig_parse
(
value
);
if
(
sig_n
<
0
)
return
-
1
;
lxc_conf
->
stopsignal
=
sig_n
;
return
0
;
...
...
@@ -1467,12 +1414,9 @@ static int set_config_cgroup(const char *key, const char *value,
out:
free
(
cglist
);
if
(
cgelem
)
{
free
(
cgelem
->
subsystem
);
free
(
cgelem
->
value
);
free
(
cgelem
);
}
...
...
@@ -1595,7 +1539,7 @@ static int set_config_idmaps(const char *key, const char *value,
if
(
ret
<
0
)
goto
on_error
;
INFO
(
"
r
ead uid map: type %c nsid %lu hostid %lu range %lu"
,
type
,
nsid
,
hostid
,
range
);
INFO
(
"
R
ead uid map: type %c nsid %lu hostid %lu range %lu"
,
type
,
nsid
,
hostid
,
range
);
if
(
type
==
'u'
)
idmap
->
idtype
=
ID_TYPE_UID
;
else
if
(
type
==
'g'
)
...
...
@@ -1656,9 +1600,9 @@ static int set_config_mount_auto(const char *key, const char *value,
{
"cgroup-full:mixed"
,
LXC_AUTO_CGROUP_MASK
,
LXC_AUTO_CGROUP_FULL_MIXED
},
{
"cgroup-full:ro"
,
LXC_AUTO_CGROUP_MASK
,
LXC_AUTO_CGROUP_FULL_RO
},
{
"cgroup-full:rw"
,
LXC_AUTO_CGROUP_MASK
,
LXC_AUTO_CGROUP_FULL_RW
},
/*
NB: For adding anything that is just a single on/off, but has
*
no options: keep mask and flag identical and just define the
*
enum
value as an unused bit so far
/*
For adding anything that is just a single on/off, but has no
*
options: keep mask and flag identical and just define the enum
* value as an unused bit so far
*/
{
NULL
,
0
,
0
}
};
...
...
@@ -1669,10 +1613,8 @@ static int set_config_mount_auto(const char *key, const char *value,
}
autos
=
strdup
(
value
);
if
(
!
autos
)
{
SYSERROR
(
"failed to dup '%s'"
,
value
);
if
(
!
autos
)
return
-
1
;
}
for
(
autoptr
=
autos
;;
autoptr
=
NULL
)
{
token
=
strtok_r
(
autoptr
,
"
\t
"
,
&
sptr
);
...
...
@@ -1687,7 +1629,7 @@ static int set_config_mount_auto(const char *key, const char *value,
}
if
(
!
allowed_auto_mounts
[
i
].
token
)
{
ERROR
(
"Invalid filesystem to automount
: %s
"
,
token
);
ERROR
(
"Invalid filesystem to automount
\"
%s
\"
"
,
token
);
break
;
}
...
...
@@ -1735,10 +1677,8 @@ static int set_config_cap_keep(const char *key, const char *value,
return
lxc_clear_config_keepcaps
(
lxc_conf
);
keepcaps
=
strdup
(
value
);
if
(
!
keepcaps
)
{
SYSERROR
(
"failed to dup '%s'"
,
value
);
if
(
!
keepcaps
)
return
-
1
;
}
/* In case several capability keep is specified in a single line
* split these caps in a single element for the list.
...
...
@@ -1754,14 +1694,11 @@ static int set_config_cap_keep(const char *key, const char *value,
lxc_clear_config_keepcaps
(
lxc_conf
);
keeplist
=
malloc
(
sizeof
(
*
keeplist
));
if
(
!
keeplist
)
{
SYSERROR
(
"failed to allocate keepcap list"
);
if
(
!
keeplist
)
break
;
}
keeplist
->
elem
=
strdup
(
token
);
if
(
!
keeplist
->
elem
)
{
SYSERROR
(
"failed to dup '%s'"
,
token
);
free
(
keeplist
);
break
;
}
...
...
@@ -1785,10 +1722,8 @@ static int set_config_cap_drop(const char *key, const char *value,
return
lxc_clear_config_caps
(
lxc_conf
);
dropcaps
=
strdup
(
value
);
if
(
!
dropcaps
)
{
SYSERROR
(
"failed to dup '%s'"
,
value
);
if
(
!
dropcaps
)
return
-
1
;
}
/* In case several capability drop is specified in a single line
* split these caps in a single element for the list.
...
...
@@ -1801,14 +1736,11 @@ static int set_config_cap_drop(const char *key, const char *value,
}
droplist
=
malloc
(
sizeof
(
*
droplist
));
if
(
!
droplist
)
{
SYSERROR
(
"failed to allocate drop list"
);
if
(
!
droplist
)
break
;
}
droplist
->
elem
=
strdup
(
token
);
if
(
!
droplist
->
elem
)
{
SYSERROR
(
"failed to dup '%s'"
,
token
);
free
(
droplist
);
break
;
}
...
...
@@ -1856,6 +1788,7 @@ int append_unexp_config_line(const char *line, struct lxc_conf *conf)
strcat
(
conf
->
unexpanded_config
,
"
\n
"
);
conf
->
unexpanded_len
++
;
}
return
0
;
}
...
...
@@ -1868,10 +1801,8 @@ static int do_includedir(const char *dirp, struct lxc_conf *lxc_conf)
int
ret
=
-
1
;
dir
=
opendir
(
dirp
);
if
(
!
dir
)
{
SYSERROR
(
"failed to open '%s'"
,
dirp
);
if
(
!
dir
)
return
-
1
;
}
while
((
direntp
=
readdir
(
dir
)))
{
const
char
*
fnam
;
...
...
@@ -1888,9 +1819,9 @@ static int do_includedir(const char *dirp, struct lxc_conf *lxc_conf)
len
=
strlen
(
fnam
);
if
(
len
<
6
||
strncmp
(
fnam
+
len
-
5
,
".conf"
,
5
)
!=
0
)
continue
;
len
=
snprintf
(
path
,
MAXPATHLEN
,
"%s/%s"
,
dirp
,
fnam
);
if
(
len
<
0
||
len
>=
MAXPATHLEN
)
{
ERROR
(
"lxc.include filename too long under '%s'"
,
dirp
);
ret
=
-
1
;
goto
out
;
}
...
...
@@ -1902,8 +1833,7 @@ static int do_includedir(const char *dirp, struct lxc_conf *lxc_conf)
ret
=
0
;
out:
if
(
closedir
(
dir
))
WARN
(
"lxc.include dir: failed to close directory"
);
closedir
(
dir
);
return
ret
;
}
...
...
@@ -1911,13 +1841,11 @@ out:
static
int
set_config_includefiles
(
const
char
*
key
,
const
char
*
value
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
/* Set config value to default. */
if
(
lxc_config_value_empty
(
value
))
{
clr_config_includefiles
(
key
,
lxc_conf
,
NULL
);
return
0
;
}
/* Parse new config value. */
if
(
is_dir
(
value
))
return
do_includedir
(
value
,
lxc_conf
);
...
...
@@ -1959,13 +1887,10 @@ static int set_config_uts_name(const char *key, const char *value,
}
utsname
=
malloc
(
sizeof
(
*
utsname
));
if
(
!
utsname
)
{
SYSERROR
(
"failed to allocate memory"
);
if
(
!
utsname
)
return
-
1
;
}
if
(
strlen
(
value
)
>=
sizeof
(
utsname
->
nodename
))
{
ERROR
(
"node name '%s' is too long"
,
value
);
free
(
utsname
);
return
-
1
;
}
...
...
@@ -1992,15 +1917,13 @@ static int parse_line(char *buffer, void *data)
if
(
lxc_is_line_empty
(
buffer
))
return
0
;
/*
we have to dup the buffer otherwise, at the re-exec for
*
reboot we modified the original string on the stack by
*
replacing '=' by '\0' below
/*
We have to dup the buffer otherwise, at the re-exec for reboot we
*
modified the original string on the stack by replacing '=' by '\0'
*
below.
*/
linep
=
line
=
strdup
(
buffer
);
if
(
!
line
)
{
SYSERROR
(
"failed to allocate memory for '%s'"
,
buffer
);
if
(
!
line
)
return
-
1
;
}
if
(
!
plc
->
from_include
)
if
((
ret
=
append_unexp_config_line
(
line
,
plc
->
conf
)))
...
...
@@ -2034,7 +1957,9 @@ static int parse_line(char *buffer, void *data)
value
[
lxc_char_right_gc
(
value
,
strlen
(
value
))]
=
'\0'
;
if
(
*
value
==
'\''
||
*
value
==
'\"'
)
{
size_t
len
=
strlen
(
value
);
size_t
len
;
len
=
strlen
(
value
);
if
(
len
>
1
&&
value
[
len
-
1
]
==
*
value
)
{
value
[
len
-
1
]
=
'\0'
;
value
++
;
...
...
@@ -2043,7 +1968,7 @@ static int parse_line(char *buffer, void *data)
config
=
lxc_get_config
(
key
);
if
(
!
config
)
{
ERROR
(
"
unknown key %s
"
,
key
);
ERROR
(
"
Unknown configuration key
\"
%s
\"
"
,
key
);
goto
out
;
}
...
...
@@ -2054,8 +1979,9 @@ static int parse_line(char *buffer, void *data)
* legacy configuration item in the configuration file and then
* an update is required.
*/
fprintf
(
stderr
,
"The configuration file contains legacy configuration keys.
\n
"
"Please update your configuration file!
\n
"
);
fprintf
(
stderr
,
"The configuration file contains legacy "
"configuration keys.
\n
Please update your "
"configuration file!
\n
"
);
}
/* [END]: REMOVE IN LXC 3.0 */
...
...
@@ -2078,16 +2004,17 @@ static int lxc_config_readline(char *buffer, struct lxc_conf *conf)
int
lxc_config_read
(
const
char
*
file
,
struct
lxc_conf
*
conf
,
bool
from_include
)
{
int
ret
;
struct
parse_line_conf
c
;
c
.
conf
=
conf
;
c
.
from_include
=
from_include
;
if
(
access
(
file
,
R_OK
)
==
-
1
)
{
ret
=
access
(
file
,
R_OK
);
if
(
ret
<
0
)
return
-
1
;
}
/* Catch only the top level config file name in the structure */
/* Catch only the top level config file name in the structure
.
*/
if
(
!
conf
->
rcfile
)
conf
->
rcfile
=
strdup
(
file
);
...
...
@@ -2189,21 +2116,20 @@ int lxc_fill_elevated_privileges(char *flaglist, int *flags)
if
(
!
flaglist
)
{
/* For the sake of backward compatibility, drop all privileges
*
if none is specified.
*
if none is specified.
*/
for
(
i
=
0
;
all_privs
[
i
].
token
;
i
++
)
{
for
(
i
=
0
;
all_privs
[
i
].
token
;
i
++
)
*
flags
|=
all_privs
[
i
].
flag
;
}
return
0
;
}
token
=
strtok_r
(
flaglist
,
"|"
,
&
saveptr
);
while
(
token
)
{
aflag
=
-
1
;
for
(
i
=
0
;
all_privs
[
i
].
token
;
i
++
)
{
for
(
i
=
0
;
all_privs
[
i
].
token
;
i
++
)
if
(
!
strcmp
(
all_privs
[
i
].
token
,
token
))
aflag
=
all_privs
[
i
].
flag
;
}
if
(
aflag
<
0
)
return
-
1
;
...
...
@@ -2226,7 +2152,7 @@ void write_config(FILE *fout, struct lxc_conf *c)
ret
=
fwrite
(
c
->
unexpanded_config
,
1
,
len
,
fout
);
if
(
ret
!=
len
)
SYSERROR
(
"
Error writing
configuration file"
);
SYSERROR
(
"
Failed to write
configuration file"
);
}
bool
do_append_unexp_config_line
(
struct
lxc_conf
*
conf
,
const
char
*
key
,
...
...
@@ -2303,19 +2229,15 @@ bool clone_update_unexp_ovl_paths(struct lxc_conf *conf, const char *oldpath,
olddir
=
alloca
(
olddirlen
+
1
);
ret
=
snprintf
(
olddir
,
olddirlen
+
1
,
"%s=%s/%s"
,
ovldir
,
oldpath
,
oldname
);
if
(
ret
<
0
||
ret
>=
olddirlen
+
1
)
{
ERROR
(
"failed to create string"
);
if
(
ret
<
0
||
ret
>=
olddirlen
+
1
)
return
false
;
}
newdirlen
=
strlen
(
ovldir
)
+
strlen
(
newpath
)
+
strlen
(
newname
)
+
2
;
newdir
=
alloca
(
newdirlen
+
1
);
ret
=
snprintf
(
newdir
,
newdirlen
+
1
,
"%s=%s/%s"
,
ovldir
,
newpath
,
newname
);
if
(
ret
<
0
||
ret
>=
newdirlen
+
1
)
{
ERROR
(
"failed to create string"
);
if
(
ret
<
0
||
ret
>=
newdirlen
+
1
)
return
false
;
}
if
(
!
conf
->
unexpanded_config
)
return
true
;
...
...
@@ -2375,15 +2297,14 @@ bool clone_update_unexp_ovl_paths(struct lxc_conf *conf, const char *oldpath,
size_t
poffset
=
q
-
conf
->
unexpanded_config
;
new
=
realloc
(
conf
->
unexpanded_config
,
newlen
+
1
);
if
(
!
new
)
{
ERROR
(
"Out of memory"
);
if
(
!
new
)
return
false
;
}
conf
->
unexpanded_len
=
newlen
;
conf
->
unexpanded_alloced
=
newlen
+
1
;
new
[
newlen
-
1
]
=
'\0'
;
lend
=
new
+
(
lend
-
conf
->
unexpanded_config
);
/*
move over the remainder to make room for the newdir
/*
Move over the remainder to make room for the newdir.
*/
memmove
(
new
+
poffset
+
newdirlen
,
new
+
poffset
+
olddirlen
,
...
...
@@ -2412,20 +2333,18 @@ bool clone_update_unexp_hooks(struct lxc_conf *conf, const char *oldpath,
olddirlen
=
strlen
(
oldpath
)
+
strlen
(
oldname
)
+
1
;
olddir
=
alloca
(
olddirlen
+
1
);
ret
=
snprintf
(
olddir
,
olddirlen
+
1
,
"%s/%s"
,
oldpath
,
oldname
);
if
(
ret
<
0
||
ret
>=
olddirlen
+
1
)
{
ERROR
(
"failed to create string"
);
if
(
ret
<
0
||
ret
>=
olddirlen
+
1
)
return
false
;
}
newdirlen
=
strlen
(
newpath
)
+
strlen
(
newname
)
+
1
;
newdir
=
alloca
(
newdirlen
+
1
);
ret
=
snprintf
(
newdir
,
newdirlen
+
1
,
"%s/%s"
,
newpath
,
newname
);
if
(
ret
<
0
||
ret
>=
newdirlen
+
1
)
{
ERROR
(
"failed to create string"
);
if
(
ret
<
0
||
ret
>=
newdirlen
+
1
)
return
false
;
}
if
(
!
conf
->
unexpanded_config
)
return
true
;
while
(
*
lstart
)
{
lend
=
strchr
(
lstart
,
'\n'
);
if
(
!
lend
)
...
...
@@ -2468,15 +2387,14 @@ bool clone_update_unexp_hooks(struct lxc_conf *conf, const char *oldpath,
size_t
poffset
=
p
-
conf
->
unexpanded_config
;
new
=
realloc
(
conf
->
unexpanded_config
,
newlen
+
1
);
if
(
!
new
)
{
ERROR
(
"failed to allocate memory"
);
if
(
!
new
)
return
false
;
}
conf
->
unexpanded_len
=
newlen
;
conf
->
unexpanded_alloced
=
newlen
+
1
;
new
[
newlen
-
1
]
=
'\0'
;
lend
=
new
+
(
lend
-
conf
->
unexpanded_config
);
/*
move over the remainder to make room for the newdir
/*
Move over the remainder to make room for the newdir.
*/
memmove
(
new
+
poffset
+
newdirlen
,
new
+
poffset
+
olddirlen
,
...
...
@@ -2500,9 +2418,8 @@ bool clone_update_unexp_hooks(struct lxc_conf *conf, const char *oldpath,
} \
}
/*
* This is called only from clone. We wish to update all hwaddrs in the
* unexpanded config file. We can't/don't want to update any which come from
/* This is called only from clone. We wish to update all hwaddrs in the
* unexpanded config file. We can't/don't want to update any which come from
* lxc.includes (there shouldn't be any).
* We can't just walk the c->lxc-conf->network list because that includes netifs
* from the include files. So we update the ones which we find in the unexp
...
...
@@ -2560,9 +2477,9 @@ bool network_new_hwaddrs(struct lxc_conf *conf)
return
false
;
memcpy
(
p
,
newhwaddr
,
17
);
lxc_list_for_each
(
it
,
&
conf
->
network
)
{
lxc_list_for_each
(
it
,
&
conf
->
network
)
{
struct
lxc_netdev
*
n
=
it
->
elem
;
if
(
n
->
hwaddr
&&
memcmp
(
oldhwaddr
,
n
->
hwaddr
,
17
)
==
0
)
memcpy
(
n
->
hwaddr
,
newhwaddr
,
17
);
}
...
...
@@ -2576,21 +2493,16 @@ bool network_new_hwaddrs(struct lxc_conf *conf)
static
int
set_config_ephemeral
(
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
->
ephemeral
=
0
;
return
0
;
}
/* Parse new config value. */
if
(
lxc_safe_uint
(
value
,
&
lxc_conf
->
ephemeral
)
<
0
)
return
-
1
;
if
(
lxc_conf
->
ephemeral
>
1
)
{
ERROR
(
"Wrong value for lxc.ephemeral. Can only be set to 0 or 1"
);
if
(
lxc_conf
->
ephemeral
>
1
)
return
-
1
;
}
return
0
;
}
...
...
@@ -2600,22 +2512,17 @@ static int set_config_log_syslog(const char *key, const char *value,
{
int
facility
;
/* Clear any previously set value. */
if
(
lxc_conf
->
syslog
)
{
free
(
lxc_conf
->
syslog
);
lxc_conf
->
syslog
=
NULL
;
}
/* Check if value is empty. */
if
(
lxc_config_value_empty
(
value
))
return
0
;
/* Parse value. */
facility
=
lxc_syslog_priority_to_int
(
value
);
if
(
facility
==
-
EINVAL
)
{
ERROR
(
"Wrong value for lxc.log.syslog."
);
if
(
facility
==
-
EINVAL
)
return
-
1
;
}
lxc_log_syslog
(
facility
);
return
set_config_string_item
(
&
lxc_conf
->
syslog
,
value
);
...
...
@@ -2626,21 +2533,16 @@ static int set_config_no_new_privs(const char *key, const char *value,
{
unsigned
int
v
;
/* Set config value to default. */
if
(
lxc_config_value_empty
(
value
))
{
lxc_conf
->
no_new_privs
=
false
;
return
0
;
}
/* Parse new config value. */
if
(
lxc_safe_uint
(
value
,
&
v
)
<
0
)
return
-
1
;
if
(
v
>
1
)
{
ERROR
(
"Wrong value for lxc.no_new_privs. Can only be set to 0 "
"or 1"
);
if
(
v
>
1
)
return
-
1
;
}
lxc_conf
->
no_new_privs
=
v
?
true
:
false
;
...
...
@@ -2714,14 +2616,13 @@ static int get_config_selinux_context(const char *key, char *retv, int inlen,
return
lxc_get_conf_str
(
retv
,
inlen
,
c
->
lsm_se_context
);
}
/*
* If you ask for a specific cgroup value, i.e. lxc.cgroup.devices.list,
* then just the value(s) will be printed. Since there still could be
* more than one, it is newline-separated.
* (Maybe that's ambigous, since some values, i.e. devices.list, will
* already have newlines?)
* If you ask for 'lxc.cgroup", then all cgroup entries will be printed,
* in 'lxc.cgroup.subsystem.key = value' format.
/* If you ask for a specific cgroup value, i.e. lxc.cgroup.devices.list, then
* just the value(s) will be printed. Since there still could be more than one,
* it is newline-separated.
* (Maybe that's ambigous, since some values, i.e. devices.list, will already
* have newlines?)
* If you ask for 'lxc.cgroup", then all cgroup entries will be printed, in
* 'lxc.cgroup.subsystem.key = value' format.
*/
static
int
get_config_cgroup
(
const
char
*
key
,
char
*
retv
,
int
inlen
,
struct
lxc_conf
*
c
,
void
*
data
)
...
...
@@ -2745,8 +2646,10 @@ static int get_config_cgroup(const char *key, char *retv, int inlen,
lxc_list_for_each
(
it
,
&
c
->
cgroup
)
{
struct
lxc_cgroup
*
cg
=
it
->
elem
;
if
(
get_all
)
{
strprint
(
retv
,
inlen
,
"lxc.cgroup.%s = %s
\n
"
,
cg
->
subsystem
,
cg
->
value
);
strprint
(
retv
,
inlen
,
"lxc.cgroup.%s = %s
\n
"
,
cg
->
subsystem
,
cg
->
value
);
}
else
if
(
!
strcmp
(
cg
->
subsystem
,
key
))
{
strprint
(
retv
,
inlen
,
"%s
\n
"
,
cg
->
value
);
}
...
...
@@ -2919,8 +2822,7 @@ static int get_config_mount(const char *key, char *retv, int inlen,
else
memset
(
retv
,
0
,
inlen
);
lxc_list_for_each
(
it
,
&
c
->
mount_list
)
{
lxc_list_for_each
(
it
,
&
c
->
mount_list
)
{
strprint
(
retv
,
inlen
,
"%s
\n
"
,
(
char
*
)
it
->
elem
);
}
...
...
@@ -2967,7 +2869,6 @@ static int get_config_hooks(const char *key, char *retv, int inlen,
struct
lxc_list
*
it
;
int
i
;
/* "lxc.hook.mount" */
subkey
=
strchr
(
key
,
'.'
);
if
(
subkey
)
subkey
=
strchr
(
subkey
+
1
,
'.'
);
...
...
@@ -3030,6 +2931,7 @@ static int get_config_cap_drop(const char *key, char *retv, int inlen,
lxc_list_for_each
(
it
,
&
c
->
caps
)
{
strprint
(
retv
,
inlen
,
"%s
\n
"
,
(
char
*
)
it
->
elem
);
}
return
fulllen
;
}
...
...
@@ -3047,6 +2949,7 @@ static int get_config_cap_keep(const char *key, char *retv, int inlen,
lxc_list_for_each
(
it
,
&
c
->
keepcaps
)
{
strprint
(
retv
,
inlen
,
"%s
\n
"
,
(
char
*
)
it
->
elem
);
}
return
fulllen
;
}
...
...
@@ -3075,19 +2978,19 @@ static int get_config_autodev(const char *key, char *retv, int inlen,
}
static
int
get_config_signal_halt
(
const
char
*
key
,
char
*
retv
,
int
inlen
,
struct
lxc_conf
*
c
,
void
*
data
)
struct
lxc_conf
*
c
,
void
*
data
)
{
return
lxc_get_conf_int
(
c
,
retv
,
inlen
,
c
->
haltsignal
);
}
static
int
get_config_signal_reboot
(
const
char
*
key
,
char
*
retv
,
int
inlen
,
struct
lxc_conf
*
c
,
void
*
data
)
struct
lxc_conf
*
c
,
void
*
data
)
{
return
lxc_get_conf_int
(
c
,
retv
,
inlen
,
c
->
rebootsignal
);
}
static
int
get_config_signal_stop
(
const
char
*
key
,
char
*
retv
,
int
inlen
,
struct
lxc_conf
*
c
,
void
*
data
)
struct
lxc_conf
*
c
,
void
*
data
)
{
return
lxc_get_conf_int
(
c
,
retv
,
inlen
,
c
->
stopsignal
);
}
...
...
@@ -3106,7 +3009,7 @@ static int get_config_start(const char *key, char *retv, int inlen,
}
static
int
get_config_log_syslog
(
const
char
*
key
,
char
*
retv
,
int
inlen
,
struct
lxc_conf
*
c
,
void
*
data
)
struct
lxc_conf
*
c
,
void
*
data
)
{
return
lxc_get_conf_str
(
retv
,
inlen
,
c
->
syslog
);
}
...
...
@@ -3131,6 +3034,7 @@ static int get_config_group(const char *key, char *retv, int inlen,
lxc_list_for_each
(
it
,
&
c
->
groups
)
{
strprint
(
retv
,
inlen
,
"%s
\n
"
,
(
char
*
)
it
->
elem
);
}
return
fulllen
;
}
...
...
@@ -3148,6 +3052,7 @@ static int get_config_environment(const char *key, char *retv, int inlen,
lxc_list_for_each
(
it
,
&
c
->
environment
)
{
strprint
(
retv
,
inlen
,
"%s
\n
"
,
(
char
*
)
it
->
elem
);
}
return
fulllen
;
}
...
...
@@ -3181,8 +3086,7 @@ static int get_config_no_new_privs(const char *key, char *retv, int inlen,
return
lxc_get_conf_int
(
c
,
retv
,
inlen
,
c
->
no_new_privs
);
}
/*
* If you ask for a specific value, i.e. lxc.prlimit.nofile, then just the value
/* If you ask for a specific value, i.e. lxc.prlimit.nofile, then just the value
* will be printed. If you ask for 'lxc.prlimit', then all limit entries will be
* printed, in 'lxc.prlimit.resource = value' format.
*/
...
...
@@ -3220,19 +3124,18 @@ static int get_config_prlimit(const char *key, char *retv, int inlen,
(
uint64_t
)
lim
->
limit
.
rlim_cur
);
}
if
(
lim
->
limit
.
rlim_cur
!=
lim
->
limit
.
rlim_max
)
{
if
(
lim
->
limit
.
rlim_max
==
RLIM_INFINITY
)
{
if
(
lim
->
limit
.
rlim_max
==
RLIM_INFINITY
)
memcpy
(
buf
+
partlen
,
":unlimited"
,
sizeof
(
":unlimited"
));
}
else
{
else
sprintf
(
buf
+
partlen
,
":%"
PRIu64
,
(
uint64_t
)
lim
->
limit
.
rlim_max
);
}
}
if
(
get_all
)
{
strprint
(
retv
,
inlen
,
"lxc.prlimit.%s = %s
\n
"
,
lim
->
resource
,
buf
);
}
else
if
(
strcmp
(
lim
->
resource
,
key
)
==
0
)
{
}
else
if
(
!
strcmp
(
lim
->
resource
,
key
)
)
{
strprint
(
retv
,
inlen
,
"%s"
,
buf
);
}
}
...
...
@@ -3604,8 +3507,8 @@ static struct lxc_config_t *get_network_config_ops(const char *key,
* (Checking for INT_MAX here is intentional.)
*/
if
(
tmpidx
==
INT_MAX
)
{
SYSERROR
(
"
n
umber of configured networks would overflow the "
"counter
... what are you doing?
"
);
SYSERROR
(
"
N
umber of configured networks would overflow the "
"counter"
);
goto
on_error
;
}
*
idx
=
tmpidx
;
...
...
@@ -3624,7 +3527,7 @@ static struct lxc_config_t *get_network_config_ops(const char *key,
config
=
lxc_get_config
(
copy
);
if
(
!
config
)
{
ERROR
(
"
unknown network configuration key %s
"
,
key
);
ERROR
(
"
Unknown network configuration key
\"
%s
\"
"
,
key
);
goto
on_error
;
}
}
...
...
@@ -3639,10 +3542,9 @@ on_error:
return
NULL
;
}
/*
* Config entry is something like "lxc.net.0.ipv4" the key 'lxc.net.'
* was found. So we make sure next comes an integer, find the right callback
* (by rewriting the key), and call it.
/* Config entry is something like "lxc.net.0.ipv4" the key 'lxc.net.' was
* found. So we make sure next comes an integer, find the right callback (by
* rewriting the key), and call it.
*/
static
int
set_config_net_nic
(
const
char
*
key
,
const
char
*
value
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
...
...
@@ -3676,11 +3578,6 @@ static int set_config_net_nic(const char *key, const char *value,
return
ret
;
}
/*
* Config entry is something like "lxc.net.0.ipv4" the key 'lxc.net.'
* was found. So we make sure next comes an integer, find the right callback
* (by rewriting the key), and call it.
*/
static
int
clr_config_net_nic
(
const
char
*
key
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
...
...
src/lxc/confile.h
View file @
b3c723c4
...
...
@@ -26,9 +26,9 @@
#ifndef __LXC_CONFILE_H
#define __LXC_CONFILE_H
#include <stdbool.h>
#include <stdio.h>
#include <lxc/attach_options.h>
#include <stdbool.h>
struct
lxc_conf
;
struct
lxc_list
;
...
...
src/lxc/tools/lxc-checkconfig.in
View file @
b3c723c4
...
...
@@ -128,30 +128,59 @@ if ([ $KVER_MAJOR -lt 4 ]) || ([ $KVER_MAJOR -eq 4 ] && [ $KVER_MINOR -lt 7 ]);
echo
-n
"Multiple /dev/pts instances: "
&&
is_enabled DEVPTS_MULTIPLE_INSTANCES
fi
echo
echo
"--- Control groups ---"
echo
-n
"Cgroups: "
&&
is_enabled CONFIG_CGROUPS
echo
print_cgroups
()
{
# print all mountpoints for cgroup filesystems
awk
'$1 !~ /#/ && $3 == mp { print $2; } ; END { exit(0); } '
"mp=
$1
"
"
$2
"
;
}
CGROUP_MNT_PATH
=
`
print_cgroups cgroup /proc/self/mounts |
head
-n
1
`
CGROUP_V1_MNTS
=
`
print_cgroups cgroup /proc/self/mounts
`
echo
echo
"Cgroup v1 mount points: "
echo
"
$CGROUP_V1_MNTS
"
echo
echo
-n
"Cgroup: "
&&
is_enabled CONFIG_CGROUPS
CGROUP_V2_MNTS
=
`
print_cgroups cgroup2 /proc/self/mounts
`
echo
"Cgroup v2 mount points: "
echo
"
$CGROUP_V2_MNTS
"
echo
CGROUP_SYSTEMD_MNTPT
=
`
echo
"
$CGROUP_V1_MNTS
"
|
grep
"/systemd"
`
if
[
-z
"
$CGROUP_SYSTEMD_MNTPT
"
]
;
then
echo
-n
"Cgroup v1 systemd controller: "
"
$SETCOLOR_FAILURE
"
&&
echo
-n
"missing"
&&
$SETCOLOR_NORMAL
echo
fi
CGROUP_FREEZER_MNTPT
=
`
echo
"
$CGROUP_V1_MNTS
"
|
grep
"/freezer"
`
if
[
-z
"
$CGROUP_FREEZER_MNTPT
"
]
;
then
echo
-n
"Cgroup v1 freezer controller: "
"
$SETCOLOR_FAILURE
"
&&
echo
-n
"missing"
&&
$SETCOLOR_NORMAL
echo
fi
CGROUP_MNT_PATH
=
`
echo
"
$CGROUP_V1_MNTS
"
|
head
-n
1
`
if
[
-f
$CGROUP_MNT_PATH
/cgroup.clone_children
]
;
then
echo
-n
"Cgroup clone_children flag: "
&&
echo
-n
"Cgroup
v1
clone_children flag: "
&&
$SETCOLOR_SUCCESS
&&
echo
"enabled"
&&
$SETCOLOR_NORMAL
else
echo
-n
"Cgroup namespace: "
&&
is_enabled CONFIG_CGROUP_NS
yes
fi
echo
-n
"Cgroup device: "
&&
is_enabled CONFIG_CGROUP_DEVICE
echo
echo
-n
"Cgroup sched: "
&&
is_enabled CONFIG_CGROUP_SCHED
echo
echo
-n
"Cgroup cpu account: "
&&
is_enabled CONFIG_CGROUP_CPUACCT
echo
echo
-n
"Cgroup memory controller: "
if
([
$KVER_MAJOR
-ge
3
]
&&
[
$KVER_MINOR
-ge
6
])
||
([
$KVER_MAJOR
-gt
3
])
;
then
is_enabled CONFIG_MEMCG
...
...
@@ -159,8 +188,10 @@ else
is_enabled CONFIG_CGROUP_MEM_RES_CTLR
fi
echo
is_set CONFIG_SMP
&&
echo
-n
"Cgroup cpuset: "
&&
is_enabled CONFIG_CPUSETS
&&
echo
echo
echo
"--- Misc ---"
echo
-n
"Veth pair device: "
&&
is_enabled CONFIG_VETH
&&
is_probed veth
echo
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment