]> git.ipfire.org Git - thirdparty/lxc.git/log
thirdparty/lxc.git
7 years agoconfile: error out if a network configuration key has no subkey
Felix Abecassis [Wed, 29 Nov 2017 04:27:44 +0000 (20:27 -0800)] 
confile: error out if a network configuration key has no subkey

This prevent an infinite recursion in the case of "lxc.net.0. = a"

Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
7 years agolog: fix infinite loop with multiple lxc.log.syslog keys
Felix Abecassis [Wed, 29 Nov 2017 04:27:39 +0000 (20:27 -0800)] 
log: fix infinite loop with multiple lxc.log.syslog keys

This caused the linked list of appenders to loop on itself, creating
an infinite logging loop in `__lxc_log_append`.

Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
7 years agotests: add a function for negative netdev tests
Felix Abecassis [Wed, 29 Nov 2017 04:27:34 +0000 (20:27 -0800)] 
tests: add a function for negative netdev tests

Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
7 years agoconfile: fix memory leak
Felix Abecassis [Wed, 29 Nov 2017 04:27:28 +0000 (20:27 -0800)] 
confile: fix memory leak

Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
7 years agoMerge pull request #1932 from 3XX0/dhclient-hook
Serge Hallyn [Wed, 29 Nov 2017 02:16:50 +0000 (20:16 -0600)] 
Merge pull request #1932 from 3XX0/dhclient-hook

hooks: add dhclient hooks

7 years agoMerge pull request #1958 from AustinReichert/tools-refactor-lxc-wait
Christian Brauner [Wed, 29 Nov 2017 01:32:35 +0000 (02:32 +0100)] 
Merge pull request #1958 from AustinReichert/tools-refactor-lxc-wait

tools/lxc_wait: removed internal logging

7 years agoMerge pull request #1959 from AustinReichert/tools-refactor-lxc-usernsexec
Christian Brauner [Wed, 29 Nov 2017 01:15:04 +0000 (02:15 +0100)] 
Merge pull request #1959 from AustinReichert/tools-refactor-lxc-usernsexec

tools/lxc_usernsexec: removed internal logging

7 years agoMerge pull request #1960 from AustinReichert/tools-refactor-lxc-unfreeze
Christian Brauner [Wed, 29 Nov 2017 01:03:01 +0000 (02:03 +0100)] 
Merge pull request #1960 from AustinReichert/tools-refactor-lxc-unfreeze

tools/lxc_unfreeze: removed internal logging

7 years agoMerge pull request #1961 from AustinReichert/tools-refactor-lxc-top
Christian Brauner [Wed, 29 Nov 2017 01:01:30 +0000 (02:01 +0100)] 
Merge pull request #1961 from AustinReichert/tools-refactor-lxc-top

tools/lxc_top: removed internal logging

7 years agoMerge pull request #1962 from AustinReichert/tools-refactor-lxc-stop
Christian Brauner [Wed, 29 Nov 2017 00:56:36 +0000 (01:56 +0100)] 
Merge pull request #1962 from AustinReichert/tools-refactor-lxc-stop

tools/lxc_stop: removed internal logging

7 years agoMerge pull request #1963 from AustinReichert/tools-refactor-lxc-start
Christian Brauner [Wed, 29 Nov 2017 00:55:47 +0000 (01:55 +0100)] 
Merge pull request #1963 from AustinReichert/tools-refactor-lxc-start

tools/lxc_start: removed internal logging

7 years agoMerge pull request #1964 from AustinReichert/tools-refactor-lxc-snapshot
Christian Brauner [Wed, 29 Nov 2017 00:54:47 +0000 (01:54 +0100)] 
Merge pull request #1964 from AustinReichert/tools-refactor-lxc-snapshot

tools/lxc_snapshot: removed internal logging

7 years agoMerge pull request #1966 from AustinReichert/tools-refactor-lxc-ls
Christian Brauner [Wed, 29 Nov 2017 00:54:16 +0000 (01:54 +0100)] 
Merge pull request #1966 from AustinReichert/tools-refactor-lxc-ls

tools/lxc_ls: remove internal logging

7 years agoMerge pull request #1965 from AustinReichert/tools-refactor-lxc-monitor
Christian Brauner [Wed, 29 Nov 2017 00:53:18 +0000 (01:53 +0100)] 
Merge pull request #1965 from AustinReichert/tools-refactor-lxc-monitor

tools/lxc_monitor: removed internal logging

7 years agoMerge pull request #1967 from AustinReichert/tools-refactor-lxc-info
Christian Brauner [Wed, 29 Nov 2017 00:52:47 +0000 (01:52 +0100)] 
Merge pull request #1967 from AustinReichert/tools-refactor-lxc-info

tools/lxc_info: removed internal logging

7 years agoMerge pull request #1968 from AustinReichert/tools-refactor-lxc-freeze
Christian Brauner [Wed, 29 Nov 2017 00:52:38 +0000 (01:52 +0100)] 
Merge pull request #1968 from AustinReichert/tools-refactor-lxc-freeze

tools/lxc_freeze: remove internal logging

7 years agoMerge pull request #1969 from AustinReichert/tools-refactor-lxc-execute
Christian Brauner [Wed, 29 Nov 2017 00:50:39 +0000 (01:50 +0100)] 
Merge pull request #1969 from AustinReichert/tools-refactor-lxc-execute

tools/lxc_execute: removed internal logging

7 years agoMerge pull request #1957 from AustinReichert/tools-refactor-lxc-unshare
Christian Brauner [Wed, 29 Nov 2017 00:50:07 +0000 (01:50 +0100)] 
Merge pull request #1957 from AustinReichert/tools-refactor-lxc-unshare

tools/lxc_unshare: removed internal logging

7 years agoMerge pull request #1970 from AustinReichert/tools-refactor-lxc-device
Christian Brauner [Wed, 29 Nov 2017 00:42:39 +0000 (01:42 +0100)] 
Merge pull request #1970 from AustinReichert/tools-refactor-lxc-device

tools/lxc_device: remove internal logging

7 years agoMerge pull request #1971 from AustinReichert/tools-refactor-lxc-destroy
Christian Brauner [Wed, 29 Nov 2017 00:42:00 +0000 (01:42 +0100)] 
Merge pull request #1971 from AustinReichert/tools-refactor-lxc-destroy

tools/lxc_destroy: remove internal logging

7 years agoMerge pull request #1972 from AustinReichert/tools-refactor-lxc-create
Christian Brauner [Wed, 29 Nov 2017 00:41:36 +0000 (01:41 +0100)] 
Merge pull request #1972 from AustinReichert/tools-refactor-lxc-create

tools/lxc_create: remove internal logging

7 years agoMerge pull request #1973 from AustinReichert/tools-refactor-lxc-copy
Christian Brauner [Wed, 29 Nov 2017 00:41:10 +0000 (01:41 +0100)] 
Merge pull request #1973 from AustinReichert/tools-refactor-lxc-copy

tools/lxc_copy: remove internal logging

7 years agoMerge pull request #1974 from AustinReichert/tools-refactor-lxc-console
Christian Brauner [Wed, 29 Nov 2017 00:40:05 +0000 (01:40 +0100)] 
Merge pull request #1974 from AustinReichert/tools-refactor-lxc-console

tools/lxc_console: remove internal logging

7 years agoMerge pull request #1975 from AustinReichert/tools-refactor-lxc-clone
Christian Brauner [Wed, 29 Nov 2017 00:39:42 +0000 (01:39 +0100)] 
Merge pull request #1975 from AustinReichert/tools-refactor-lxc-clone

tools/lxc_clone: remove internal logging

7 years agotools/lxc_wait: removed internal logging 1958/head
AustinReichert [Tue, 28 Nov 2017 23:55:53 +0000 (17:55 -0600)] 
tools/lxc_wait: removed internal logging

Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
7 years agotools/lxc_usernsexec: removed internal logging 1959/head
AustinReichert [Tue, 28 Nov 2017 23:54:11 +0000 (17:54 -0600)] 
tools/lxc_usernsexec: removed internal logging

Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
7 years agotools/lxc_unshare: removed internal logging 1957/head
AustinReichert [Tue, 28 Nov 2017 23:48:06 +0000 (17:48 -0600)] 
tools/lxc_unshare: removed internal logging

Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
7 years agotools/lxc_unfreeze: removed internal logging 1960/head
AustinReichert [Tue, 28 Nov 2017 23:38:48 +0000 (17:38 -0600)] 
tools/lxc_unfreeze: removed internal logging

Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
7 years agotools/lxc_top: removed internal logging 1961/head
AustinReichert [Tue, 28 Nov 2017 23:35:45 +0000 (17:35 -0600)] 
tools/lxc_top: removed internal logging

Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
7 years agotools/lxc_stop: removed internal logging 1962/head
AustinReichert [Tue, 28 Nov 2017 23:29:25 +0000 (17:29 -0600)] 
tools/lxc_stop: removed internal logging

Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
7 years agotools/lxc_start: removed internal logging 1963/head
AustinReichert [Tue, 28 Nov 2017 23:16:07 +0000 (17:16 -0600)] 
tools/lxc_start: removed internal logging

Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
7 years agotools/lxc_snapshot: removed internal logging 1964/head
AustinReichert [Tue, 28 Nov 2017 23:07:24 +0000 (17:07 -0600)] 
tools/lxc_snapshot: removed internal logging

Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
7 years agotools/lxc_monitor: removed internal logging 1965/head
AustinReichert [Tue, 28 Nov 2017 22:59:14 +0000 (16:59 -0600)] 
tools/lxc_monitor: removed internal logging

Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
7 years agotools/lxc_copy: remove internal logging 1973/head
AustinReichert [Tue, 28 Nov 2017 22:56:17 +0000 (16:56 -0600)] 
tools/lxc_copy: remove internal logging

Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
7 years agotools/lxc_ls: remove internal logging 1966/head
AustinReichert [Tue, 28 Nov 2017 22:50:16 +0000 (16:50 -0600)] 
tools/lxc_ls: remove internal logging

Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
7 years agotools/lxc_info: removed internal logging 1967/head
AustinReichert [Tue, 28 Nov 2017 09:34:42 +0000 (03:34 -0600)] 
tools/lxc_info: removed internal logging

Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
7 years agotools/lxc_freeze: remove internal logging 1968/head
AustinReichert [Tue, 28 Nov 2017 09:32:50 +0000 (03:32 -0600)] 
tools/lxc_freeze: remove internal logging

Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
7 years agotools/lxc_execute: removed internal logging 1969/head
AustinReichert [Tue, 28 Nov 2017 09:30:24 +0000 (03:30 -0600)] 
tools/lxc_execute: removed internal logging

Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
7 years agotools/lxc_device: remove internal logging 1970/head
AustinReichert [Tue, 28 Nov 2017 09:26:25 +0000 (03:26 -0600)] 
tools/lxc_device: remove internal logging

Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
7 years agotools/lxc_destroy: remove internal logging 1971/head
AustinReichert [Tue, 28 Nov 2017 09:19:29 +0000 (03:19 -0600)] 
tools/lxc_destroy: remove internal logging

Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
7 years agotools/lxc_create: remove internal logging 1972/head
AustinReichert [Tue, 28 Nov 2017 09:14:54 +0000 (03:14 -0600)] 
tools/lxc_create: remove internal logging

Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
7 years agotools/lxc_console: remove internal logging 1974/head
AustinReichert [Tue, 28 Nov 2017 08:52:16 +0000 (02:52 -0600)] 
tools/lxc_console: remove internal logging

Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
7 years agotools/lxc_clone: remove internal logging 1975/head
AustinReichert [Tue, 28 Nov 2017 08:41:23 +0000 (02:41 -0600)] 
tools/lxc_clone: remove internal logging

Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
7 years agoMerge pull request #1952 from marcosps/duplicated_sethostname
Christian Brauner [Tue, 28 Nov 2017 08:09:04 +0000 (09:09 +0100)] 
Merge pull request #1952 from marcosps/duplicated_sethostname

utils.h: Avoid duplicated sethostname implementation

7 years agoMerge pull request #1954 from AustinReichert/tools-refactor-lxc-autostart
Christian Brauner [Tue, 28 Nov 2017 08:07:35 +0000 (09:07 +0100)] 
Merge pull request #1954 from AustinReichert/tools-refactor-lxc-autostart

tools/lxc_autostart: remove internal logging

7 years agoMerge pull request #1953 from AustinReichert/tools-refactor-lxc-cgroup
Christian Brauner [Tue, 28 Nov 2017 08:07:03 +0000 (09:07 +0100)] 
Merge pull request #1953 from AustinReichert/tools-refactor-lxc-cgroup

tools/lxc_cgroup: remove internal logging

7 years agotools/lxc_autostart: remove internal logging 1954/head
AustinReichert [Tue, 28 Nov 2017 07:12:18 +0000 (01:12 -0600)] 
tools/lxc_autostart: remove internal logging

Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
7 years agotools/lxc_cgroup: remove internal logging 1953/head
AustinReichert [Tue, 28 Nov 2017 06:43:46 +0000 (00:43 -0600)] 
tools/lxc_cgroup: remove internal logging

Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
7 years agoutils.h: Avoid duplicated sethostname implementation 1952/head
Marcos Paulo de Souza [Tue, 28 Nov 2017 01:48:57 +0000 (23:48 -0200)] 
utils.h: Avoid duplicated sethostname implementation

Move duplicated implementatin of sethostname from conf.c and
lxc_unshare.c to utils.h

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
7 years agoMerge pull request #1949 from marcosps/issue_84
Serge Hallyn [Mon, 27 Nov 2017 23:58:35 +0000 (17:58 -0600)] 
Merge pull request #1949 from marcosps/issue_84

Use AX_PTHREAD config script to detect pthread api

7 years agoseccomp: filter syscalls based on arguments
LiFeng [Thu, 23 Nov 2017 19:15:23 +0000 (14:15 -0500)] 
seccomp: filter syscalls based on arguments

In order to support filtering syscalls based on arguments the seccomp version 2
specification is extended to the following form:

syscall_name action [index,value,op,valueTwo] [index,value,op]...

where the arguments of the tuple [index,value,valueTwo,op] have the following
meaning:
1. index (uint32_t):
   The index of the syscall argument.
2. value (uint64_t):
   The value for the syscall argument specified by "index".
3. valueTwo (uint64_t, optional):
   The value for the syscall argument specified by "index". This optional value
   is only valid in conjunction with SCMP_CMP_MASKED_EQ.
4. op (string):
   The operator for the syscall argument. Valid operators are the constants
   - SCMP_CMP_NE        (!=)
   - SCMP_CMP_LE        (<=)
   - SCMP_CMP_EQ        (==)
   - SCMP_CMP_GE        (>=)
   - SCMP_CMP_GT        (>)
   - SCMP_CMP_MASKED_EQ (&=)
   as defined by libseccomp >= v2.3.2.
   For convenience liblxc also understands the standard operator notation
   indicated in brackets after the libseccomp constants above as an equivalent
   notation.
Note that it is legal to specify multiple entries for the same syscall.

An example for an extended seccomp version 2 profile is:

2
blacklist allow
reject_force_umount  # comment this to allow umount -f;  not recommended
[all]
kexec_load errno 1 [0,1,SCMP_CMP_LE][3,1,==][5,1,SCMP_CMP_MASKED_EQ,1]
open_by_handle_at errno 1
init_module errno 1
finit_module errno 1
delete_module errno 1
unshare errno 9 [0,0x10000000,SCMP_CMP_EQ]
unshare errno 2 [0,0x20000000,SCMP_CMP_EQ]

Closes #1564.

Signed-off-by: LiFeng <lifeng68@huawei.com>
Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agoUse AX_PTHREAD config script to detect pthread api 1949/head
Marcos Paulo de Souza [Sun, 26 Nov 2017 18:45:22 +0000 (16:45 -0200)] 
Use AX_PTHREAD config script to detect pthread api

Closes: #84
Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
7 years agostart.c: always switch uid and gid
Yifeng Tan [Fri, 24 Nov 2017 12:03:47 +0000 (20:03 +0800)] 
start.c: always switch uid and gid

Signed-off-by: Yifeng Tan <tanyifeng1@huawei.com>
Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agoMerge pull request #1947 from brauner/2017-11-24/fix_cap_sys_admin_declaration
Stéphane Graber [Fri, 24 Nov 2017 16:00:06 +0000 (11:00 -0500)] 
Merge pull request #1947 from brauner/2017-11-24/fix_cap_sys_admin_declaration

conf: move CAP_SYS_* definitions to utils.h

7 years agoconf: move CAP_SYS_* definitions to utils.h 1947/head
Christian Brauner [Fri, 24 Nov 2017 12:23:35 +0000 (13:23 +0100)] 
conf: move CAP_SYS_* definitions to utils.h

Closes #1946.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agoMerge pull request #1944 from dnegreira/lxc_spec_in_typo_fix
Christian Brauner [Thu, 23 Nov 2017 20:34:51 +0000 (21:34 +0100)] 
Merge pull request #1944 from dnegreira/lxc_spec_in_typo_fix

Fixed typo on lxc.spec.in

7 years agoFixed typo on lxc.spec.in 1944/head
David Negreira [Thu, 23 Nov 2017 20:23:14 +0000 (21:23 +0100)] 
Fixed typo on lxc.spec.in

Signed-off-by: David Negreira David@otherreality.net
7 years agoMerge pull request #1939 from brauner/2017-11-22/more_elaborate_config_update_message
Stéphane Graber [Thu, 23 Nov 2017 17:28:08 +0000 (12:28 -0500)] 
Merge pull request #1939 from brauner/2017-11-22/more_elaborate_config_update_message

doc: documents lxc.namespace.[namespace identifier] + confile: improve legacy update message

7 years agoMerge pull request #1941 from flx42/lxc-oci-improve-import
Christian Brauner [Thu, 23 Nov 2017 12:20:33 +0000 (13:20 +0100)] 
Merge pull request #1941 from flx42/lxc-oci-improve-import

Improve lxc-oci.in

7 years agodoc: document lxc.namespace.[namespace identifier] 1939/head
Christian Brauner [Thu, 23 Nov 2017 11:34:23 +0000 (12:34 +0100)] 
doc: document lxc.namespace.[namespace identifier]

Closes #1924.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agolxc-oci: add support for registry authentication 1941/head
Felix Abecassis [Tue, 21 Nov 2017 21:49:46 +0000 (13:49 -0800)] 
lxc-oci: add support for registry authentication

Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
7 years agolxc-oci: import common.conf and userns.conf
Felix Abecassis [Tue, 21 Nov 2017 21:49:40 +0000 (13:49 -0800)] 
lxc-oci: import common.conf and userns.conf

Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
7 years agolxc-oci: import the environment variables
Felix Abecassis [Tue, 21 Nov 2017 21:49:36 +0000 (13:49 -0800)] 
lxc-oci: import the environment variables

Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
7 years agolxc-oci: add utility function to retrieve the path of the config file
Felix Abecassis [Thu, 23 Nov 2017 00:00:53 +0000 (16:00 -0800)] 
lxc-oci: add utility function to retrieve the path of the config file

Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
7 years agoconfile: improve legacy update message
Christian Brauner [Wed, 22 Nov 2017 22:24:40 +0000 (23:24 +0100)] 
confile: improve legacy update message

Closes #1938.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agolxc-oci: write /etc/hosts
Felix Abecassis [Tue, 21 Nov 2017 21:49:33 +0000 (13:49 -0800)] 
lxc-oci: write /etc/hosts

Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
7 years agolxc-oci: write /etc/hostname
Felix Abecassis [Tue, 21 Nov 2017 21:49:30 +0000 (13:49 -0800)] 
lxc-oci: write /etc/hostname

Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
7 years agolxc-oci: support unprivileged umoci unpacking
Felix Abecassis [Tue, 21 Nov 2017 21:49:25 +0000 (13:49 -0800)] 
lxc-oci: support unprivileged umoci unpacking

Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
7 years agoMerge pull request #1936 from Cypresslin/user-del-mute
Christian Brauner [Wed, 22 Nov 2017 11:48:19 +0000 (12:48 +0100)] 
Merge pull request #1936 from Cypresslin/user-del-mute

lxc-test-unpriv: check user existence before removing it

7 years agoMerge pull request #1935 from flx42/confile-overlapping-strncpy
Christian Brauner [Wed, 22 Nov 2017 11:33:57 +0000 (12:33 +0100)] 
Merge pull request #1935 from flx42/confile-overlapping-strncpy

confile_utils: fix overlapping strncpy

7 years agolxc-test-unpriv: check user existence before removing it 1936/head
Po-Hsu Lin [Wed, 22 Nov 2017 08:11:34 +0000 (03:11 -0500)] 
lxc-test-unpriv: check user existence before removing it

Check the test user (lxcunpriv) before calling deluser command,
otherwise it will print unnecessary error message:
/usr/sbin/deluser: The user 'lxcunpriv' does not exist.

Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
7 years agoconfile_utils: fix overlapping strncpy 1935/head
Felix Abecassis [Wed, 22 Nov 2017 06:27:19 +0000 (22:27 -0800)] 
confile_utils: fix overlapping strncpy

In the case of "lxc.net.0.type", the pointers passed to strncpy were
only 2 elements apart, resulting in undefined behavior.

Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
7 years agoMerge pull request #1933 from 3XX0/init-control-tty
Christian Brauner [Tue, 21 Nov 2017 12:31:01 +0000 (13:31 +0100)] 
Merge pull request #1933 from 3XX0/init-control-tty

lxc_init: set the control terminal in the child session

7 years agolxc_init: set the control terminal in the child session 1933/head
Jonathan Calmels [Tue, 21 Nov 2017 01:30:45 +0000 (17:30 -0800)] 
lxc_init: set the control terminal in the child session

Signed-off-by: Jonathan Calmels <jcalmels@nvidia.com>
7 years agohooks: add dhclient hooks 1932/head
Jonathan Calmels [Wed, 8 Nov 2017 10:58:01 +0000 (05:58 -0500)] 
hooks: add dhclient hooks

Add new hooks leveraging dhclient from the host to automatically
configure the container interfaces. This is especially useful for
application containers which rely on an IPAM driver for network
configuration (e.g. Docker).

Signed-off-by: Jonathan Calmels <jcalmels@nvidia.com>
7 years agoMerge pull request #1931 from brauner/2017-11-20/fix_state_socket
Stéphane Graber [Mon, 20 Nov 2017 22:21:25 +0000 (17:21 -0500)] 
Merge pull request #1931 from brauner/2017-11-20/fix_state_socket

commands: fix state socket implementation

7 years agocommands: fix state socket implementation 1931/head
Christian Brauner [Mon, 20 Nov 2017 21:16:40 +0000 (22:16 +0100)] 
commands: fix state socket implementation

Remove dead state clients from state client list. Consider the following
scenario:

01 start container
02 issue shutdown request
03 state_client_fd is added to lxc_handler
03 container doesn't respond to shutdown request
04 user aborts shutdown request
05 lxc_cmd_fd_cleanup() removes state_client_fd from lxc_mainloop
06 invalid state_client_fd is still recorded in the lxc_handler
07 user issues lxc_cmd_stop() request via SIGKILL
08 container reaches STOPPED state and sends message to state_client_fd
09 state_client_fd number has been reused by lxc_cmd_stop_callback()
10 invalid data gets dumped to lxc_cmd_stop()

Reproducer:
Set an invalid shutdown signal to which the init system does not respond with a
shutdown via lxc.signal.halt e.g. "lxc.signal.halt = SIGUSR1". Then do:

1. start container
    root@conventiont|~
    > lxc-start -n a1

2. try to shutdown container
    root@conventiont|~
    > lxc-stop -n a1

3. abort shutdown
^C

4. SIGKILL the container (lxc.signal.stop = SIGKILL)
    root@conventiont|~
    > lxc-stop -n a1 -k
    lxc-stop: a1: commands.c: lxc_cmd_rsp_recv: 165 File too large - Response data for command "stop" is too long: 12641 bytes > 8192

To not let this happen we remove the state_client_fd from the lxc_handler when
we detect a cleanup event in lxc_cmd_fd_cleanup().

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agolxccontainer: non-functional changes
Christian Brauner [Mon, 20 Nov 2017 15:50:00 +0000 (16:50 +0100)] 
lxccontainer: non-functional changes

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agocommands: non-functional changes
Christian Brauner [Mon, 20 Nov 2017 15:49:30 +0000 (16:49 +0100)] 
commands: non-functional changes

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agoMerge pull request #1930 from lifeng68/Fix_parse_err
Christian Brauner [Mon, 20 Nov 2017 10:19:08 +0000 (11:19 +0100)] 
Merge pull request #1930 from lifeng68/Fix_parse_err

Fix lxc_inherit_namespace function error

7 years agoFix namespace config parse error 1930/head
LiFeng [Mon, 20 Nov 2017 11:42:30 +0000 (06:42 -0500)] 
Fix namespace config parse error

Signed-off-by: LiFeng <lifeng68@huawei.com>
7 years agoMerge pull request #1925 from brauner/2017-11-14/console_config_keys
Serge Hallyn [Sat, 18 Nov 2017 00:04:59 +0000 (18:04 -0600)] 
Merge pull request #1925 from brauner/2017-11-14/console_config_keys

console: add lxc.console.buffer.size, lxc.console.buffer.logfile, lxc.console.rotate

7 years agotest: expand console log tests 1925/head
Christian Brauner [Wed, 15 Nov 2017 15:05:49 +0000 (16:05 +0100)] 
test: expand console log tests

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agocommands: rotate console log file
Christian Brauner [Wed, 15 Nov 2017 12:29:49 +0000 (13:29 +0100)] 
commands: rotate console log file

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agocommands: truncate console ringbuffer log file
Christian Brauner [Thu, 9 Nov 2017 18:39:59 +0000 (19:39 +0100)] 
commands: truncate console ringbuffer log file

When a "clear" request is sent to the console ringbuffer we should truncate the
console log file as well.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agoconsole: split console setup into logical parts
Christian Brauner [Wed, 15 Nov 2017 11:18:51 +0000 (12:18 +0100)] 
console: split console setup into logical parts

The lxc_console_create() function used to munge the ringbuffer setup and the
log file setup already. This made somewhat sense when we didn't have a separate
ringbuffer log file. Now it's just plain confusing. So split this into logical
helpers that future maintainers can understand:

- lxc_console_create_log_file()
- lxc_console_create_ringbuf(console);
- lxc_console_create_ringbuf_log_file(console);

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agocommands: only set ringbuffer datalen when needed
Christian Brauner [Wed, 15 Nov 2017 15:04:12 +0000 (16:04 +0100)] 
commands: only set ringbuffer datalen when needed

If we do it unconditionally a request to only clear the ringbuffer and not read
or write anything will fail.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agoconfile: add lxc.console.rotate
Christian Brauner [Tue, 14 Nov 2017 23:35:02 +0000 (00:35 +0100)] 
confile: add lxc.console.rotate

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agoconfile: add lxc.console.buffer.logfile
Christian Brauner [Tue, 14 Nov 2017 23:23:07 +0000 (00:23 +0100)] 
confile: add lxc.console.buffer.logfile

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agoconfile: add lxc.console.buffer.size
Christian Brauner [Tue, 14 Nov 2017 22:55:33 +0000 (23:55 +0100)] 
confile: add lxc.console.buffer.size

Determines the size of the ringbuffer.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agoMerge pull request #1920 from brauner/2017-11-12/console_exit_clean_on_sigterm
Serge Hallyn [Mon, 13 Nov 2017 15:28:46 +0000 (09:28 -0600)] 
Merge pull request #1920 from brauner/2017-11-12/console_exit_clean_on_sigterm

console: exit mainloop on SIGTERM

7 years agoMerge pull request #1922 from brauner/2017-11-13/generate_new_uuid_for_xfs_and_btrfs_...
Serge Hallyn [Mon, 13 Nov 2017 15:28:24 +0000 (09:28 -0600)] 
Merge pull request #1922 from brauner/2017-11-13/generate_new_uuid_for_xfs_and_btrfs_snapshots

lvm: generate new UUID for xfs + btrfs filesystems

7 years agolvm: generate new UUID for xfs + btrfs filesystems 1922/head
Christian Brauner [Mon, 13 Nov 2017 14:01:42 +0000 (15:01 +0100)] 
lvm: generate new UUID for xfs + btrfs filesystems

Closes #1909.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agoconsole: exit mainloop on SIGTERM 1920/head
Christian Brauner [Sun, 12 Nov 2017 16:51:11 +0000 (17:51 +0100)] 
console: exit mainloop on SIGTERM

This allows cleanly exiting a console session without control sequences.

Relates to https://github.com/lxc/lxd/pull/4001 .

Note that the existence of a signal handler now doesn't guarantee that ts->node
is allocated. Instead, ts->node will now only be added to if stdinfd is a tty.
New checks need to take that into account.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agoconsole: prepare for generic signal handler
Christian Brauner [Sun, 12 Nov 2017 14:25:19 +0000 (15:25 +0100)] 
console: prepare for generic signal handler

Non-functional changes to enable handling more signals.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agoMerge pull request #1919 from brauner/2017-11-11/console_fix_escape_sequence
Serge Hallyn [Sun, 12 Nov 2017 04:38:34 +0000 (22:38 -0600)] 
Merge pull request #1919 from brauner/2017-11-11/console_fix_escape_sequence

console: use correct escape sequence check

7 years agoconsole: use correct escape sequence check 1919/head
Christian Brauner [Sat, 11 Nov 2017 22:05:33 +0000 (23:05 +0100)] 
console: use correct escape sequence check

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
7 years agoMerge pull request #1918 from brauner/2017-11-11/daemonized_execute
Serge Hallyn [Sat, 11 Nov 2017 03:41:29 +0000 (21:41 -0600)] 
Merge pull request #1918 from brauner/2017-11-11/daemonized_execute

lxccontainer: enable daemonized execute

7 years agoMerge pull request #1907 from brauner/2017-11-08/cgfsng
Serge Hallyn [Sat, 11 Nov 2017 00:54:26 +0000 (18:54 -0600)] 
Merge pull request #1907 from brauner/2017-11-08/cgfsng

cgroups/cgfsng: adapt to new cgroup2 delegation

7 years agotools: add "--daemonize/-d" 1918/head
Christian Brauner [Fri, 10 Nov 2017 23:22:09 +0000 (00:22 +0100)] 
tools: add "--daemonize/-d"

This lets's users run daemonized application containers with our minimal init
as pid 1 and the requested program as pid 2.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>