]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
9 years agojournalctl: only have a single exit path from main()
Lennart Poettering [Mon, 18 May 2015 21:50:34 +0000 (23:50 +0200)] 
journalctl: only have a single exit path from main()

That way we can be sure we execute the destructors properly, and can be
valgrind-clean.

9 years agojournalctl: Improve boot ID lookup
Jan Janssen [Fri, 1 May 2015 13:15:16 +0000 (15:15 +0200)] 
journalctl: Improve boot ID lookup

This method should greatly improve offset based lookup, by simply jumping
from one boot to the next boot. It starts at the journal head to get the
a boot ID, makes a _BOOT_ID match and then comes from the opposite
journal direction (tail) to get to the end that boot. After flushing the matches
and advancing the journal from that exact position, we arrive at the start
of next boot. Rinse and repeat.

This is faster than the old method of aggregating the full boot listing just
so we can jump to a specific boot, which can be a real pain on big journals
just for a mere "-b -1" case.

As an additional benefit --list-boots should improve slightly too, because
it does less seeking.

Note that there can be a change in boot order with this lookup method
because it will use the order of boots in the journal, not the realtime stamp
stored in them. That's arguably better, though.
Another deficiency is that it will get confused with boots interleaving in the
journal, therefore, it will refuse operation in --merge, --file and --directory mode.

https://bugs.freedesktop.org/show_bug.cgi?id=72601

9 years agoudevd: main - use _exit() when daemonizing
Tom Gundersen [Mon, 18 May 2015 15:21:03 +0000 (17:21 +0200)] 
udevd: main - use _exit() when daemonizing

Makes it a bit clearer what is going on, rather than jumping to the end of main().

No functional change.

9 years agoudevd: main - reshuffle
Tom Gundersen [Mon, 18 May 2015 15:19:38 +0000 (17:19 +0200)] 
udevd: main - reshuffle

First parse config, then sanitize environment before donig any further setup.

No functional change.

9 years agoudevd: rename on_reque_{exit,reload} to on_sig{term,chld}
Tom Gundersen [Mon, 18 May 2015 15:18:46 +0000 (17:18 +0200)] 
udevd: rename on_reque_{exit,reload} to on_sig{term,chld}

No functional change.

9 years agoudevd: introduce on_event_timeout{,_warning}
Tom Gundersen [Mon, 18 May 2015 15:17:07 +0000 (17:17 +0200)] 
udevd: introduce on_event_timeout{,_warning}

This uses kill_and_sigcont() instead of kill(), otherwise no functional change.

9 years agoudevd: process all SIGCHLD events every time the handler is invoked
Tom Gundersen [Mon, 18 May 2015 15:07:04 +0000 (17:07 +0200)] 
udevd: process all SIGCHLD events every time the handler is invoked

We were returning rather than continuing in some cases. The intention
was always to fully process all pending events before returning
from the SIGCHLD handler. Restore this behaviour.

9 years agoudevd: init/exit the builtins in manager_new/free
Tom Gundersen [Wed, 13 May 2015 09:39:45 +0000 (11:39 +0200)] 
udevd: init/exit the builtins in manager_new/free

No functional change.

9 years agoudevd: move file descriptors to Manager
Tom Gundersen [Tue, 12 May 2015 19:16:47 +0000 (21:16 +0200)] 
udevd: move file descriptors to Manager

No functional change.

9 years agoresolved: allow DnsAnswer objects with no space for RRs
Lennart Poettering [Mon, 18 May 2015 21:38:47 +0000 (23:38 +0200)] 
resolved: allow DnsAnswer objects with no space for RRs

They might be created as result of merged answer sets, hence accept
them.

http://lists.freedesktop.org/archives/systemd-devel/2015-April/030834.html

9 years agoresolved: fix crash when shutting down
Lennart Poettering [Mon, 18 May 2015 21:23:17 +0000 (23:23 +0200)] 
resolved: fix crash when shutting down

Reported by Cristian Rodríguez

http://lists.freedesktop.org/archives/systemd-devel/2015-May/031626.html

9 years agonspawn: close extra fds before execing init
Alban Crequy [Mon, 18 May 2015 14:45:30 +0000 (16:45 +0200)] 
nspawn: close extra fds before execing init

When systemd-nspawn gets exec*()ed, it inherits the followings file
descriptors:
- 0, 1, 2: stdin, stdout, stderr
- SD_LISTEN_FDS_START, ... SD_LISTEN_FDS_START+LISTEN_FDS: file
  descriptors passed by the system manager (useful for socket
  activation). They are passed to the child process (process leader).
- extra lock fd: rkt passes a locked directory as an extra fd, so the
  directory remains locked as long as the container is alive.

systemd-nspawn used to close all open fds except 0, 1, 2 and the
SD_LISTEN_FDS_START..SD_LISTEN_FDS_START+LISTEN_FDS. This patch delays
the close just before the exec so the nspawn process (parent) keeps the
extra fds open.

This patch supersedes the previous attempt ("cloexec extraneous fds"):
http://lists.freedesktop.org/archives/systemd-devel/2015-May/031608.html

9 years agoata_id: drop spurious space
Lennart Poettering [Mon, 18 May 2015 19:52:26 +0000 (21:52 +0200)] 
ata_id: drop spurious space

9 years agoCODING_STYLE: document that we should avoid kernel types like u32
Lennart Poettering [Mon, 18 May 2015 16:47:22 +0000 (18:47 +0200)] 
CODING_STYLE: document that we should avoid kernel types like u32

9 years agocore: Private*/Protect* options with RootDirectory
Alban Crequy [Mon, 18 May 2015 10:20:28 +0000 (12:20 +0200)] 
core: Private*/Protect* options with RootDirectory

When a service is chrooted with the option RootDirectory=/opt/..., then
the options PrivateDevices, PrivateTmp, ProtectHome, ProtectSystem must
mount the directories under $RootDirectory/{dev,tmp,home,usr,boot}.

The test-ns tool can test setup_namespace() with and without chroot:
 $ sudo TEST_NS_PROJECTS=/home/lennart/projects ./test-ns
 $ sudo TEST_NS_CHROOT=/home/alban/debian-tree TEST_NS_PROJECTS=/home/alban/debian-tree/home/alban/Documents ./test-ns

9 years agokmod-setup: conditionalize kmod autoloading properly
Lennart Poettering [Mon, 18 May 2015 15:27:37 +0000 (17:27 +0200)] 
kmod-setup: conditionalize kmod autoloading properly

Load kdbus.ko only if we are built with kdbus, and load ip_tables.ko
only if we are built with iptables support.

9 years agoutil: split all hostname related calls into hostname-util.c
Lennart Poettering [Mon, 18 May 2015 15:10:07 +0000 (17:10 +0200)] 
util: split all hostname related calls into hostname-util.c

9 years agoREADME: document that we prefer if CONFIG_CHECKPOINT_RESTORE is turned on, for the...
Lennart Poettering [Mon, 18 May 2015 14:35:24 +0000 (16:35 +0200)] 
README: document that we prefer if CONFIG_CHECKPOINT_RESTORE is turned on, for the kcmp() syscall

9 years agofstab-generator: add x-systemd.requires and x-systemd.requires-mounts-for
Karel Zak [Mon, 18 May 2015 10:30:37 +0000 (12:30 +0200)] 
fstab-generator: add x-systemd.requires and x-systemd.requires-mounts-for

Currently we have no way how to specify dependencies between fstab
entries (or another units) in the /etc/fstab. It means that users are
forced to bypass fstab and write .mount units manually.

The patch introduces new systemd fstab options:

x-systemd.requires=<PATH>

 - to specify dependence an another mount (PATH is translated to unit name)

x-systemd.requires=<UNIT>

 - to specify dependence on arbitrary UNIT

x-systemd.requires-mounts-for=<PATH ...>

 - to specify dependence on another paths, implemented by
   RequiresMountsFor=. The option may be specified more than once.

For example two bind mounts where B depends on A:

 /mnt/test/A    /mnt/test/A     none    bind,defaults
 /mnt/test/A    /mnt/test/B     none    bind,x-systemd.requires=/mnt/test/A

More complex example with overlay FS where one mount point depends on
"low" and "upper" directories:

 /dev/sdc1   /mnt/low    ext4     defaults
 /dev/sdc2   /mnt/high   ext4     defaults
 overlay     /mnt/merged overlay  lowerdir=/mnt/low,upperdir=/mnt/high/data,workdir=/mnt/high/work,x-systemd.requires-mounts-for=/mnt/low,x-systemd.requires-mounts-for=mnt/high

https://bugzilla.redhat.com/show_bug.cgi?id=812826
https://bugzilla.redhat.com/show_bug.cgi?id=1164334

9 years agobuildsys: actually install 70-pointingstick.hwdb
Mantas Mikulėnas [Mon, 18 May 2015 08:18:10 +0000 (11:18 +0300)] 
buildsys: actually install 70-pointingstick.hwdb

9 years agohwdb: Add trackpoint sensitivity setting for Thinkpad X230 tablet
Hans de Goede [Mon, 18 May 2015 07:54:00 +0000 (09:54 +0200)] 
hwdb: Add trackpoint sensitivity setting for Thinkpad X230 tablet

This model needs the trackpoint sensitivity to be boosted to not be too slow
to be usable, see: https://bugzilla.redhat.com/show_bug.cgi?id=1200717

9 years agozsh-completion: make the arrays _sys_active_units, _sys_startable_units and _sys_rest...
Eric Cook [Mon, 18 May 2015 05:02:43 +0000 (01:02 -0400)] 
zsh-completion: make the arrays _sys_active_units, _sys_startable_units and _sys_restartable_units local to the completer.

9 years agozsh-completion: removing more pointless forks
Eric Cook [Mon, 18 May 2015 07:19:59 +0000 (03:19 -0400)] 
zsh-completion: removing more pointless forks

I seem to have forgot about _systemctl_active_units().

9 years agozsh-completion: less forking in _systemctl_failed_units() and make the array `_sys_fa...
Eric Cook [Mon, 18 May 2015 05:02:41 +0000 (01:02 -0400)] 
zsh-completion: less forking in _systemctl_failed_units() and make the array `_sys_failed_units' local to the completer.

9 years agozsh-completion: less forking in _systemctl_get_template_names()
Eric Cook [Mon, 18 May 2015 05:02:40 +0000 (01:02 -0400)] 
zsh-completion: less forking in _systemctl_get_template_names()

9 years agozsh-completion: actually complete template names for subcommands enable, reenable...
Eric Cook [Mon, 18 May 2015 05:02:39 +0000 (01:02 -0400)] 
zsh-completion: actually complete template names for subcommands enable, reenable and disable.

compadd's -a option treats non-option arguments as arrays. So
$(_systemctl_get_template_names) expands to some words that aren't
legal array names. Even if there were, they would be empty; thus adding
nothing.

deduplicated a few functions too.

9 years agozsh-completion: actually run _filter_units_by_property when creating the arrays _sys_...
Eric Cook [Mon, 18 May 2015 05:02:38 +0000 (01:02 -0400)] 
zsh-completion: actually run _filter_units_by_property when creating the arrays _sys_(re|)startable_units

9 years agoUse "new" --job-mode= option in more places
Zbigniew Jędrzejewski-Szmek [Mon, 18 May 2015 04:58:24 +0000 (00:58 -0400)] 
Use "new" --job-mode= option in more places

--irreversible/--ignore-dependencies/--fail are deprececated since 4dc5b821ae737914499119e29811fc3346e3d97c.

Also add shell completions for --jobs-mode.

9 years agoload-fragment: put quotes around iffy rvalue
Zbigniew Jędrzejewski-Szmek [Sat, 16 May 2015 22:21:01 +0000 (18:21 -0400)] 
load-fragment: put quotes around iffy rvalue

9 years agoUse fflush_and_check() in more places
Zbigniew Jędrzejewski-Szmek [Sat, 16 May 2015 22:11:12 +0000 (18:11 -0400)] 
Use fflush_and_check() in more places

9 years agobuildsys: Remove X_SERVER from AM_CPPFLAGS
Cristian Rodríguez [Sat, 16 May 2015 15:58:15 +0000 (12:58 -0300)] 
buildsys: Remove X_SERVER from AM_CPPFLAGS

It is a leftover from multi-seat-x wrapper which is long
gone.

9 years agozsh-completion: add missing completions for systemd-nspawn
Lukas Rusak [Wed, 22 Apr 2015 18:07:39 +0000 (11:07 -0700)] 
zsh-completion: add missing completions for systemd-nspawn

9 years agozsh-completion: update -M completion for systemd-analyze
Lukas Rusak [Wed, 22 Apr 2015 18:07:38 +0000 (11:07 -0700)] 
zsh-completion: update -M completion for systemd-analyze

9 years agozsh-completion: add missing completions for machinectl
Lukas Rusak [Wed, 22 Apr 2015 22:52:59 +0000 (15:52 -0700)] 
zsh-completion: add missing completions for machinectl

Appologies, I'm still getting used to this mailing list thing and using git send-email

9 years agoudevd: queue - update queue state when events are queued/freed
Tom Gundersen [Sat, 16 May 2015 08:14:20 +0000 (10:14 +0200)] 
udevd: queue - update queue state when events are queued/freed

This way it is more obvious that the queue flag file is always
up-to-date. Moreover, we only have to touch/unlink it when the
first/last event is allocated/freed.

9 years agoudevd: on_worker - distinguish between EINTR and EAGAIN
Tom Gundersen [Fri, 15 May 2015 23:12:21 +0000 (01:12 +0200)] 
udevd: on_worker - distinguish between EINTR and EAGAIN

EAGAIN means there are no more messages to read, so give up. EINTR means we got interrupted
reading a message, so try again.

9 years agoudevd: worker - use loop_write() rather than send()
Tom Gundersen [Fri, 15 May 2015 09:41:36 +0000 (11:41 +0200)] 
udevd: worker - use loop_write() rather than send()

When notifying the main daemon about event completion, make sure the message is sent
successfully, and not interrupted.

9 years agoutil: loop_write - accept 0-length message
Tom Gundersen [Fri, 15 May 2015 23:07:45 +0000 (01:07 +0200)] 
util: loop_write - accept 0-length message

write() can send empty messages, so make sure loop_write() can do the same.

9 years agoudevd: net - fix leak in .link config
Tom Gundersen [Fri, 15 May 2015 21:59:28 +0000 (23:59 +0200)] 
udevd: net - fix leak in .link config

Path, Driver and Type are now strv rather than strings, so free them properly.

9 years agoudev-ctrl: make _unref() always return NULL
Tom Gundersen [Thu, 14 May 2015 13:30:52 +0000 (15:30 +0200)] 
udev-ctrl: make _unref() always return NULL

Bring this in line with the rest of the codebase.

9 years agounits: make networkd pull in its own .busname unit
Tom Gundersen [Fri, 15 May 2015 20:59:24 +0000 (22:59 +0200)] 
units: make networkd pull in its own .busname unit

The daemon requires the busname unit to operate (on kdbus systems),
since it contains the policy that allows it to acquire its service
name.

This fixes https://bugs.freedesktop.org/show_bug.cgi?id=90287

9 years agotmpfiles: use lstat() instead of stat() when checking whether a file system object...
Lennart Poettering [Fri, 15 May 2015 19:48:20 +0000 (21:48 +0200)] 
tmpfiles: use lstat() instead of stat() when checking whether a file system object already exists

9 years agotmpfiles: don't fail if we cannot create a subvolume because a file system is read...
Lennart Poettering [Fri, 15 May 2015 19:47:22 +0000 (21:47 +0200)] 
tmpfiles: don't fail if we cannot create a subvolume because a file system is read-only but a dir already exists anyway

https://bugs.freedesktop.org/show_bug.cgi?id=90281

9 years agoCODING_STYLE: document that EXIT_FAILURE and EXIT_SUCCESS should be used
Lennart Poettering [Fri, 15 May 2015 19:34:14 +0000 (21:34 +0200)] 
CODING_STYLE: document that EXIT_FAILURE and EXIT_SUCCESS should be used

9 years agoCODING_STYLE: document best practices when initializing structs
Lennart Poettering [Fri, 15 May 2015 19:06:40 +0000 (21:06 +0200)] 
CODING_STYLE: document best practices when initializing structs

9 years agocoredump: make sure we vacuum by default
Lennart Poettering [Fri, 15 May 2015 18:56:55 +0000 (20:56 +0200)] 
coredump: make sure we vacuum by default

Only if both keep_free and max_use are actually 0 we can shortcut things
and avoid vacuuming. If either are positive or -1 we need to execute the
vacuuming.

http://lists.freedesktop.org/archives/systemd-devel/2015-April/031382.html

9 years agosocket-util: socket_address_parse() should not log errors on its own
Lennart Poettering [Fri, 15 May 2015 18:15:59 +0000 (20:15 +0200)] 
socket-util: socket_address_parse() should not log errors on its own

Given that socket_address_parse() is mostly a "library" call it
shouldn't log on its own, but leave that to its caller.

This patch removes logging from the call in case IPv6 is not available
but and IPv6 address shall be parsed. Instead a new call
socket_address_parse_and_warn() is introduced which first invokes
socket_address_parse() and then logs if necessary.

This should fix "make check" on ipv6-less kernels:

http://lists.freedesktop.org/archives/systemd-devel/2015-April/031385.html

9 years agocore: Fix assertion with empty Exec*= paths
Martin Pitt [Thu, 14 May 2015 07:06:40 +0000 (09:06 +0200)] 
core: Fix assertion with empty Exec*= paths

An Exec*= line with whitespace after modifiers, like

  ExecStart=- /bin/true

is considered to have an empty command path. This is as specified, but causes
systemd to crash with

  Assertion 'skip < l' failed at ../src/core/load-fragment.c:607, function config_parse_exec(). Aborting.
  Aborted (core dumped)

Fix this by logging an error instead and ignoring the invalid line.

Add corresponding test cases. Also add a test case for a completely empty value
which resets the command list.

https://launchpad.net/bugs/1454173

9 years agotimedate: fix memory leak in timedated
Cristian Rodríguez [Fri, 15 May 2015 16:26:18 +0000 (13:26 -0300)] 
timedate: fix memory leak in timedated

$ /usr/lib/systemd/systemd-timedated (wait until auto-exit)

=================================================================
==396==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 928 byte(s) in 1 object(s) allocated from:
    #0 0x7f782f788db1 in __interceptor_calloc (/usr/lib64/libasan.so.2+0x96db1)
    #1 0x562a83ae60cf in bus_message_from_header src/libsystemd/sd-bus/bus-message.c:480
    #2 0x562a83ae6f5a in bus_message_from_malloc src/libsystemd/sd-bus/bus-message.c:576
    #3 0x562a83ad3cad in bus_socket_make_message src/libsystemd/sd-bus/bus-socket.c:915
    #4 0x562a83ad4cfc in bus_socket_read_message src/libsystemd/sd-bus/bus-socket.c:1051
    #5 0x562a83ab733f in bus_read_message src/libsystemd/sd-bus/sd-bus.c:1647
    #6 0x562a83ab98ea in sd_bus_call src/libsystemd/sd-bus/sd-bus.c:2038
    #7 0x562a83b1f46d in sd_bus_call_method src/libsystemd/sd-bus/bus-convenience.c:94
    #8 0x562a83aab3e1 in context_read_ntp src/timedate/timedated.c:192
    #9 0x562a83aae1af in main src/timedate/timedated.c:730
    #10 0x7f782eb238c4 in __libc_start_main (/lib64/libc.so.6+0x208c4)

Indirect leak of 77 byte(s) in 1 object(s) allocated from:
    #0 0x7f782f788f6a in realloc (/usr/lib64/libasan.so.2+0x96f6a)
    #1 0x562a83ad418a in bus_socket_read_message src/libsystemd/sd-bus/bus-socket.c:963
    #2 0x562a83ab733f in bus_read_message src/libsystemd/sd-bus/sd-bus.c:1647
    #3 0x562a83ab98ea in sd_bus_call src/libsystemd/sd-bus/sd-bus.c:2038
    #4 0x562a83b1f46d in sd_bus_call_method src/libsystemd/sd-bus/bus-convenience.c:94
    #5 0x562a83aab3e1 in context_read_ntp src/timedate/timedated.c:192
    #6 0x562a83aae1af in main src/timedate/timedated.c:730
    #7 0x7f782eb238c4 in __libc_start_main (/lib64/libc.so.6+0x208c4)

Indirect leak of 2 byte(s) in 1 object(s) allocated from:
    #0 0x7f782f75493f in strdup (/usr/lib64/libasan.so.2+0x6293f)
    #1 0x562a83b0229b in bus_message_parse_fields src/libsystemd/sd-bus/bus-message.c:5382
    #2 0x562a83ae7290 in bus_message_from_malloc src/libsystemd/sd-bus/bus-message.c:601
    #3 0x562a83ad3cad in bus_socket_make_message src/libsystemd/sd-bus/bus-socket.c:915
    #4 0x562a83ad4cfc in bus_socket_read_message src/libsystemd/sd-bus/bus-socket.c:1051
    #5 0x562a83ab733f in bus_read_message src/libsystemd/sd-bus/sd-bus.c:1647
    #6 0x562a83ab98ea in sd_bus_call src/libsystemd/sd-bus/sd-bus.c:2038
    #7 0x562a83b1f46d in sd_bus_call_method src/libsystemd/sd-bus/bus-convenience.c:94
    #8 0x562a83aab3e1 in context_read_ntp src/timedate/timedated.c:192
    #9 0x562a83aae1af in main src/timedate/timedated.c:730
    #10 0x7f782eb238c4 in __libc_start_main (/lib64/libc.so.6+0x208c4)

SUMMARY: AddressSanitizer: 1007 byte(s) leaked in 3 allocation(s).

This is due to missing  _cleanup_bus_message_unref_ in context_read_ntp()

9 years ago.gitignore: add GNU GLOBAL files
Łukasz Stelmach [Fri, 15 May 2015 15:12:16 +0000 (17:12 +0200)] 
.gitignore: add GNU GLOBAL files

9 years agogenerator: use fflush_and_check() where appropriate
Lennart Poettering [Fri, 15 May 2015 15:06:59 +0000 (17:06 +0200)] 
generator: use fflush_and_check() where appropriate

9 years agocore: don't consider umask for SocketMode=
Davide Bettio [Fri, 15 May 2015 14:36:28 +0000 (16:36 +0200)] 
core: don't consider umask for SocketMode=

https://bugs.freedesktop.org/show_bug.cgi?id=89248

9 years agoCODING_STYLE: document alloca() DONTS
Lennart Poettering [Fri, 15 May 2015 13:47:37 +0000 (15:47 +0200)] 
CODING_STYLE: document alloca() DONTS

9 years agocore: Execute first boot presets in an enable-only preset-mode.
Dimitri John Ledkov [Fri, 15 May 2015 10:44:22 +0000 (11:44 +0100)] 
core: Execute first boot presets in an enable-only preset-mode.

This means any existing enabled units well be preserved and no
pre-created symlinks will be removed. This is done on first boot, when
the assumption is that /etc is not populated at all (no machine-id
setup). For minimal containers that gives a significant first boot
speed up, approximately ~20ms / ~16% in my trials.

9 years agonetworkd: don't try to turn on ipv6 forwarding if kernel lacks IPv6 support
Lennart Poettering [Fri, 15 May 2015 10:20:36 +0000 (12:20 +0200)] 
networkd: don't try to turn on ipv6 forwarding if kernel lacks IPv6 support

http://lists.freedesktop.org/archives/systemd-devel/2015-May/031598.html

9 years agoman: IPMasquerade only implies IPForward=ipv4
Benedikt Morbach [Sun, 10 May 2015 18:32:14 +0000 (20:32 +0200)] 
man: IPMasquerade only implies IPForward=ipv4

at least that's what the code does.

9 years agonetworkd: don't touch global forwarding setting
Benedikt Morbach [Sun, 10 May 2015 18:52:40 +0000 (20:52 +0200)] 
networkd: don't touch global forwarding setting

This reverts commit 43c6d5abacaebf813845934ec8d5e5ee3c431854
(and a small part of 4046d8361c55c80ab8577aea52523b9e6eab0d0c)

It turns out we don't actually need to set the global ip_forward setting.
The only relevant setting is the one on each interface.

What the global toggle actually does is switch forwarding on/off for all
currently present interfaces and change the default for new ones.

That means that by setting the global ip_forward we

  - Introduce a race condition, because if the interface with IPForward=yes
    is brought up after one with IPForward=no, both will have forwarding
    enabled, because the global switch turns it on for all interfaces.
    If the other interface comes up first networkd correctly sets forward=0
    and it doesn't get overridden.

  - Change the forwarding setting for interfaces that networkd is not
    configured to touch, even if the user disabled forwarding via sysctl,
    either globally or per-interface

As forwarding works fine without this, as long as all relevant interfacest
individually set IPForward=yes:  just drop it

This means that non-networkd interfaces use the global default while
networkd interfaces default to off if IPForward isn't given.

9 years agosystemctl: introduce --now for enable, disable and mask
Jan Synacek [Fri, 15 May 2015 07:54:10 +0000 (09:54 +0200)] 
systemctl: introduce --now for enable, disable and mask

https://bugs.freedesktop.org/show_bug.cgi?id=42940

9 years agonspawn: allow access to device nodes listed in --bind= and --bind-ro= switches
Stefan Junker [Thu, 14 May 2015 20:51:05 +0000 (22:51 +0200)] 
nspawn: allow access to device nodes listed in --bind= and --bind-ro= switches

https://bugs.freedesktop.org/show_bug.cgi?id=90385

9 years agotest-bus-chat: various modernizations
Lennart Poettering [Thu, 14 May 2015 20:41:19 +0000 (22:41 +0200)] 
test-bus-chat: various modernizations

9 years agosd-bus: fix memory leak in test-bus-chat
Cristian Rodríguez [Sun, 10 May 2015 01:14:09 +0000 (22:14 -0300)] 
sd-bus: fix memory leak in test-bus-chat

Building with address sanitizer enabled on GCC 5.1.x a memory leak
is reported because we never close the bus, fix it by using
cleanup variable attribute.

9 years agounits: fix typo in systemd-resolved.service
Lennart Poettering [Thu, 14 May 2015 20:32:35 +0000 (22:32 +0200)] 
units: fix typo in systemd-resolved.service

There's no network.service unit, we actually mean network.target here.

Reported by Fco. Eduardo Ramírez.

9 years agoutil: introduce memmem_safe() and make use of it
Lennart Poettering [Thu, 14 May 2015 09:30:59 +0000 (11:30 +0200)] 
util: introduce memmem_safe() and make use of it

GNU memmem() requires a nonnull first parameter. Let's introduce
memmem_safe() that removes this restriction for zero-length parameters,
and make use of it where appropriate.

http://lists.freedesktop.org/archives/systemd-devel/2015-May/031705.html

9 years agoutil: use GNU comparison function prototype for qsort_safe()
Lennart Poettering [Thu, 14 May 2015 09:30:14 +0000 (11:30 +0200)] 
util: use GNU comparison function prototype for qsort_safe()

9 years agonetworkd: remove dead initialization
Thomas Hindoe Paaboel Andersen [Wed, 13 May 2015 21:41:34 +0000 (23:41 +0200)] 
networkd: remove dead initialization

9 years agocore: only set event source name when we create an event source
Lennart Poettering [Wed, 13 May 2015 16:30:14 +0000 (18:30 +0200)] 
core: only set event source name when we create an event source

9 years agojournal: fix size comment
Peter Lemenkov [Tue, 12 May 2015 11:45:33 +0000 (14:45 +0300)] 
journal: fix size comment

Looks like sizeof(struct Header) is 240 not 224

9 years agoutil: add generic calls for prefixing a root directory to a path
Lennart Poettering [Wed, 13 May 2015 15:42:10 +0000 (17:42 +0200)] 
util: add generic calls for prefixing a root directory to a path

So far a number of utilities implemented their own calls for this, unify
them in prefix_root() and prefix_roota(). The former uses heap memory,
the latter allocates from the stack via alloca().

Port over most users of a --root= logic.

9 years agocore: make exec code a bit more readable
Lennart Poettering [Wed, 13 May 2015 14:34:02 +0000 (16:34 +0200)] 
core: make exec code a bit more readable

Let's add a function that checks whether we need fs namespacing, to make
things easier to read, instead of using a humungous if expression...

9 years agocore: fix memory leak in manager_run_generators()
Cristian Rodríguez [Tue, 12 May 2015 02:30:38 +0000 (23:30 -0300)] 
core: fix memory leak in manager_run_generators()

If systemd is built with GCC address sanitizer or leak sanitizer
the following memory leak ocurs:

May 12 02:02:46 linux.site systemd[326]: =================================================================
May 12 02:02:46 linux.site systemd[326]: ==326==ERROR: LeakSanitizer: detected memory leaks
May 12 02:02:46 linux.site systemd[326]: Direct leak of 101 byte(s) in 3 object(s) allocated from:
May 12 02:02:46 linux.site systemd[326]: #0 0x7fd1f504993f in strdup (/usr/lib64/libasan.so.2+0x6293f)
May 12 02:02:46 linux.site systemd[326]: #1 0x55d6ffac5336 in strv_new_ap src/shared/strv.c:163
May 12 02:02:46 linux.site systemd[326]: #2 0x55d6ffac56a9 in strv_new src/shared/strv.c:185
May 12 02:02:46 linux.site systemd[326]: #3 0x55d6ffa80272 in generator_paths src/shared/path-lookup.c:223
May 12 02:02:46 linux.site systemd[326]: #4 0x55d6ff9bdb0f in manager_run_generators src/core/manager.c:2828
May 12 02:02:46 linux.site systemd[326]: #5 0x55d6ff9b1a10 in manager_startup src/core/manager.c:1121
May 12 02:02:46 linux.site systemd[326]: #6 0x55d6ff9a78e3 in main src/core/main.c:1667
May 12 02:02:46 linux.site systemd[326]: #7 0x7fd1f394e8c4 in __libc_start_main (/lib64/libc.so.6+0x208c4)
May 12 02:02:46 linux.site systemd[326]: Direct leak of 29 byte(s) in 1 object(s) allocated from:
May 12 02:02:46 linux.site systemd[326]: #0 0x7fd1f504993f in strdup (/usr/lib64/libasan.so.2+0x6293f)
May 12 02:02:46 linux.site systemd[326]: #1 0x55d6ffac5288 in strv_new_ap src/shared/strv.c:152
May 12 02:02:46 linux.site systemd[326]: #2 0x55d6ffac56a9 in strv_new src/shared/strv.c:185
May 12 02:02:46 linux.site systemd[326]: #3 0x55d6ffa80272 in generator_paths src/shared/path-lookup.c:223
May 12 02:02:46 linux.site systemd[326]: #4 0x55d6ff9bdb0f in manager_run_generators src/core/manager.c:2828
May 12 02:02:46 linux.site systemd[326]: #5 0x55d6ff9b1a10 in manager_startup src/core/manager.c:1121
May 12 02:02:46 linux.site systemd[326]: #6 0x55d6ff9a78e3 in main src/core/main.c:1667
May 12 02:02:46 linux.site systemd[326]: #7 0x7fd1f394e8c4 in __libc_start_main (/lib64/libc.so.6+0x208c4)
May 12 02:02:46 linux.site systemd[326]: SUMMARY: AddressSanitizer: 130 byte(s) leaked in 4 allocation(s).

There is a leak due to the the use of cleanup_free instead _cleanup_strv_free_

9 years agonspawn: skip symlink to a combined cgroup hierarchy if it already exists
Iago López Galeiras [Wed, 13 May 2015 13:45:49 +0000 (15:45 +0200)] 
nspawn: skip symlink to a combined cgroup hierarchy if it already exists

If a symlink to a combined cgroup hierarchy already exists and points to
the right path, skip it. This avoids an error when the cgroups are set
manually before calling nspawn.

9 years agonspawn: only mount the cgroup root if it's not already mounted
Iago López Galeiras [Wed, 13 May 2015 13:45:48 +0000 (15:45 +0200)] 
nspawn: only mount the cgroup root if it's not already mounted

This allows the user to set the cgroups manually before calling nspawn.

9 years agoDefault to /usr/bin/u?mount, configurable, rather than hard-coded /bin/u?mount.
Dimitri John Ledkov [Wed, 13 May 2015 13:43:04 +0000 (14:43 +0100)] 
Default to /usr/bin/u?mount, configurable, rather than hard-coded /bin/u?mount.

9 years agocore: never create device depencies for /dev/root mounts
Lennart Poettering [Wed, 13 May 2015 12:40:37 +0000 (14:40 +0200)] 
core: never create device depencies for /dev/root mounts

http://lists.freedesktop.org/archives/systemd-devel/2015-May/031658.html

9 years agonspawn: rework custom mount point order, and add support for overlayfs
Lennart Poettering [Wed, 13 May 2015 12:04:55 +0000 (14:04 +0200)] 
nspawn: rework custom mount point order, and add support for overlayfs

Previously all bind mount mounts were applied in the order specified,
followed by all tmpfs mounts in the order specified. This is
problematic, if bind mounts shall be placed within tmpfs mounts.

This patch hence reworks the custom mount point logic, and alwas applies
them in strict prefix-first order. This means the order of mounts
specified on the command line becomes irrelevant, the right operation
will always be executed.

While we are at it this commit also adds native support for overlayfs
mounts, as supported by recent kernels.

9 years agomodules-load: fix memory leak
Cristian Rodríguez [Mon, 11 May 2015 18:37:47 +0000 (15:37 -0300)] 
modules-load: fix memory leak

=================================================================
==64281==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 32 byte(s) in 1 object(s) allocated from:
    #0 0x7f623c961c4a in malloc (/usr/lib64/libasan.so.2+0x96c4a)
    #1 0x5651f79ad34e in malloc_multiply (/home/crrodriguez/scm/systemd/systemd-modules-load+0x2134e)
    #2 0x5651f79b02d6 in strjoin (/home/crrodriguez/scm/systemd/systemd-modules-load+0x242d6)
    #3 0x5651f79be1f5 in files_add (/home/crrodriguez/scm/systemd/systemd-modules-load+0x321f5)
    #4 0x5651f79be6a3 in conf_files_list_strv_internal (/home/crrodriguez/scm/systemd/systemd-modules-load+0x326a3)
    #5 0x5651f79bea24 in conf_files_list_nulstr (/home/crrodriguez/scm/systemd/systemd-modules-load+0x32a24)
    #6 0x5651f79ad01a in main (/home/crrodriguez/scm/systemd/systemd-modules-load+0x2101a)
    #7 0x7f623c11586f in __libc_start_main (/lib64/libc.so.6+0x2086f)

SUMMARY: AddressSanitizer: 32 byte(s) leaked in 1 allocation(s).

This happens due to the wrong cleanup attribute is used (free vs strv_free)

9 years agoshared: Use O_EXCL with O_TMPFILE in open_tmpfile
Cristian Rodríguez [Mon, 11 May 2015 18:01:37 +0000 (15:01 -0300)] 
shared: Use O_EXCL with O_TMPFILE in open_tmpfile

In this usecase, the file will never be materialized
with linkat().

9 years agofsck: add enum with fsck exit codes
Thomas Hindoe Paaboel Andersen [Tue, 28 Apr 2015 18:59:36 +0000 (20:59 +0200)] 
fsck: add enum with fsck exit codes

9 years agoudevd: manager - move a few global variables into the Manager object
Tom Gundersen [Tue, 12 May 2015 17:06:33 +0000 (19:06 +0200)] 
udevd: manager - move a few global variables into the Manager object

9 years agoudevd: pass a Manager objcet to event handlers
Tom Gundersen [Tue, 12 May 2015 16:37:04 +0000 (18:37 +0200)] 
udevd: pass a Manager objcet to event handlers

Stop relying on global variables in event handlers, and move them
all to a Manager object instead.

9 years agoboot: function parameters are separated by comma
Kay Sievers [Tue, 12 May 2015 15:58:59 +0000 (17:58 +0200)] 
boot: function parameters are separated by comma

9 years agocore: drop redundant logging about notification messages
Tom Gundersen [Tue, 12 May 2015 15:21:51 +0000 (17:21 +0200)] 
core: drop redundant logging about notification messages

Before:
May 12 17:11:22 tomegun-x2402 systemd[1]: systemd-udevd.service: Got notification message for unit.
May 12 17:11:22 tomegun-x2402 systemd[1]: systemd-udevd.service: Got notification message from PID 195 (READY=1)
May 12 17:11:22 tomegun-x2402 systemd[1]: systemd-udevd.service: Ggot READY=1

After:
May 12 17:11:22 tomegun-x2402 systemd[1]: systemd-udevd.service: Got notification message from PID 195 (READY=1)

9 years agoudevd: remove stale comment
Tom Gundersen [Tue, 12 May 2015 14:57:01 +0000 (16:57 +0200)] 
udevd: remove stale comment

9 years agoudevd: explicitly update queue file before answering to ping
Tom Gundersen [Tue, 12 May 2015 14:55:29 +0000 (16:55 +0200)] 
udevd: explicitly update queue file before answering to ping

This avoids updating the flag files twice for every loop, and also removes another dependency
in the main-loop, so we are freer to reshufle it as we want.

9 years agoudevd: explicitly read out uevents we create ourselves
Tom Gundersen [Tue, 12 May 2015 14:51:31 +0000 (16:51 +0200)] 
udevd: explicitly read out uevents we create ourselves

Rather than skippling ctrl handling whenever we have handlede inotify events
(and hence may have synthesized a 'change' event), just call the uevent
handling explicitly from on_inotify() so that the event queue is up-to-date.

9 years agoudevd: move to sd-event-style event handlers
Tom Gundersen [Tue, 12 May 2015 12:54:52 +0000 (14:54 +0200)] 
udevd: move to sd-event-style event handlers

9 years agonetworkd: network_get - allow udev_device to be NULL
Tom Gundersen [Mon, 11 May 2015 22:22:29 +0000 (00:22 +0200)] 
networkd: network_get - allow udev_device to be NULL

In containers we never have udev devices, so drop the assert.

This fixes an assertion introduced in af3aa302741b6edb0729925febb5f8bc26721fe3.

9 years agoudevd: make udev_ctrl_connection global
Tom Gundersen [Mon, 11 May 2015 20:17:49 +0000 (22:17 +0200)] 
udevd: make udev_ctrl_connection global

This allows us to simplify the ctrl_msg handler. Eventually all this global state should move to
a Manager object or so.

9 years agosystemctl: fix check for template units
Thomas Hindoe Paaboel Andersen [Mon, 11 May 2015 21:52:29 +0000 (23:52 +0200)] 
systemctl: fix check for template units

A typo from 7410616c. We want to ignore EINVAL but only catch errors.

9 years agoupdate TODO
Lennart Poettering [Mon, 11 May 2015 20:56:31 +0000 (22:56 +0200)] 
update TODO

9 years agoinstall: when exporting prefix InstallInfo to become UnitFileInstallInfo
Lennart Poettering [Mon, 11 May 2015 20:53:54 +0000 (22:53 +0200)] 
install: when exporting prefix InstallInfo to become UnitFileInstallInfo

All other types exported from install.h should be namespaces like this,
hence namespace InstallInfo the same way.

Also, remove external forward definition of UnitFileScope type.

9 years agocore: rename SystemdRunningAs to ManagerRunningAs
Lennart Poettering [Mon, 11 May 2015 20:51:49 +0000 (22:51 +0200)] 
core: rename SystemdRunningAs to ManagerRunningAs

It's primarily just a property of the Manager object after all, and we
try to refer to PID 1 as "manager" instead of "systemd", hence let's to
stick to this here too.

9 years agounit: move unit_warn_if_dir_nonempty() and friend to unit.c
Lennart Poettering [Mon, 11 May 2015 20:28:52 +0000 (22:28 +0200)] 
unit: move unit_warn_if_dir_nonempty() and friend to unit.c

The call is only used by the mount and automount unit types, but that's
already enough to consider it generic unit functionality, hence move it
out of mount.c and into unit.c.

9 years agocore,network: major per-object logging rework
Lennart Poettering [Mon, 11 May 2015 18:38:21 +0000 (20:38 +0200)] 
core,network: major per-object logging rework

This changes log_unit_info() (and friends) to take a real Unit* object
insted of just a unit name as parameter. The call will now prefix all
logged messages with the unit name, thus allowing the unit name to be
dropped from the various passed romat strings, simplifying invocations
drastically, and unifying log output across messages. Also, UNIT= vs.
USER_UNIT= is now derived from the Manager object attached to the Unit
object, instead of getpid(). This has the benefit of correcting the
field for --test runs.

Also contains a couple of other logging improvements:

- Drops a couple of strerror() invocations in favour of using %m.

- Not only .mount units now warn if a symlinks exist for the mount
  point already, .automount units do that too, now.

- A few invocations of log_struct() that didn't actually pass any
  additional structured data have been replaced by simpler invocations
  of log_unit_info() and friends.

- For structured data a new LOG_UNIT_MESSAGE() macro has been added,
  that works like LOG_MESSAGE() but prefixes the message with the unit
  name. Similar, there's now LOG_LINK_MESSAGE() and
  LOG_NETDEV_MESSAGE().

- For structured data new LOG_UNIT_ID(), LOG_LINK_INTERFACE(),
  LOG_NETDEV_INTERFACE() macros have been added that generate the
  necessary per object fields. The old log_unit_struct() call has been
  removed in favour of these new macros used in raw log_struct()
  invocations. In addition to removing one more function call this
  allows generated structured log messages that contain two object
  fields, as necessary for example for network interfaces that are
  joined into another network interface, and whose messages shall be
  indexed by both.

- The LOG_ERRNO() macro has been removed, in favour of
  log_struct_errno(). The latter has the benefit of ensuring that %m in
  format strings is properly resolved to the specified error number.

- A number of logging messages have been converted to use
  log_unit_info() instead of log_info()

- The client code in sysv-generator no longer #includes core code from
  src/core/.

- log_unit_full_errno() has been removed, log_unit_full() instead takes
  an errno now, too.

- log_unit_info(), log_link_info(), log_netdev_info() and friends, now
  avoid double evaluation of their parameters

9 years agocore: always initialize ExecParamters.bus_endpoint_fd to -1
Lennart Poettering [Mon, 11 May 2015 18:13:37 +0000 (20:13 +0200)] 
core: always initialize ExecParamters.bus_endpoint_fd to -1

Otherwise it might be passed in as 0, which is a valid fd, but usually
does not refer to a real endpoint.

9 years agounits: order nspawn containers after network.target
Lennart Poettering [Mon, 11 May 2015 20:08:28 +0000 (22:08 +0200)] 
units: order nspawn containers after network.target

This way we know that any bridges and other user-created network devices
are in place, and can be properly added to the container.

In the long run this should be dropped, and replaced by direct calls
inside nspawn that cause the devices to be created when necessary.

9 years agoutil: optimize free_and_strdup() if NOP
Lennart Poettering [Mon, 11 May 2015 18:09:58 +0000 (20:09 +0200)] 
util: optimize free_and_strdup() if NOP

Under the assumption that strcmp() is cheaper than memory allocation,
let's avoid the allocation, if the new value is identical to the old.

9 years agonspawn: pass on kill signal setting to contaner scope
Lennart Poettering [Thu, 7 May 2015 21:37:32 +0000 (14:37 -0700)] 
nspawn: pass on kill signal setting to contaner scope

Let's just pass on what the user set for us.

9 years agoupdate TODO
Lennart Poettering [Thu, 7 May 2015 21:33:12 +0000 (14:33 -0700)] 
update TODO

9 years agotest-libudev: fix leak in error case
Thomas Hindoe Paaboel Andersen [Mon, 11 May 2015 19:41:31 +0000 (21:41 +0200)] 
test-libudev: fix leak in error case

CID# 1297428