chiark / gitweb /
3 years agotime-util: introduce deserialize_timestamp_value()
Alexander Kuleshov [Mon, 15 Feb 2016 18:01:44 +0000 (00:01 +0600)]
time-util: introduce deserialize_timestamp_value()

The time-util.c provides dual_timestamp_deserialize() function to
convert value to usec_t and set it as value of ts->monotonic and

There are some places in code which do the same but only for one
clockid_t (realtime or monotonic), when dual_timestamp_deserialize()
sets value of both.

This patch introduces the deserialize_timestamp_value() which converts
 a given value to usec_t and write it to a given timestamp.

3 years agosystemctl: include -M or -H arguments in the hint
Zbigniew Jędrzejewski-Szmek [Mon, 15 Feb 2016 16:57:48 +0000 (11:57 -0500)]
systemctl: include -M or -H arguments in the hint

Some newlines are added, but the output will still exceed 80 columns in many
cases. The fallback for oom conditions is changed from "n/a" to something
"<service>", and a similar pattern is used for the new code. This way we
have a realistic fallback for oom, which seems nicer than making the whole
function return an error code which would then have to be propagated.

$ systemctl -M fedora-rawhide restart elogind-networkd.service
Job for elogind-networkd.service failed because start of the service was attempted too often.
See "systemctl -M fedora-rawhide status elogind-networkd.service" and "journalctl -M fedora-rawhide -xe" for details.
To force a start use "systemctl -M fedora-rawhide reset-failed elogind-networkd.service"
followed by "systemctl -M fedora-rawhide start elogind-networkd.service" again.

3 years agoresolved: drop references to two bus error codes no longer used
Lennart Poettering [Sat, 13 Feb 2016 19:01:52 +0000 (20:01 +0100)]
resolved: drop references to two bus error codes no longer used

3 years agotree-wide: make more global variables static
Lennart Poettering [Sat, 13 Feb 2016 11:28:28 +0000 (12:28 +0100)]
tree-wide: make more global variables static

let's export as little as we can

3 years agoresolve: always align flags to 8th column and print CAA flags
Zbigniew Jędrzejewski-Szmek [Tue, 2 Feb 2016 02:35:44 +0000 (21:35 -0500)]
resolve: always align flags to 8th column and print CAA flags

Left-over unknown flags are printed numerically. Otherwise,
it wouldn't be known what bits are remaining without knowning
what the known bits are.

A test case is added to verify the flag printing code:
============== src/resolve/test-data/fake-caa.pkts ============== IN CAA   0 issue "" IN CAA   128 issue ""
        -- Flags: critical IN CAA   129 issue ""
        -- Flags: critical 1 IN CAA   22 issue ""
        -- Flags: 22

3 years agotime-util: map ALARM clockids to non-ALARM clockids in now()
Lennart Poettering [Fri, 12 Feb 2016 20:29:01 +0000 (21:29 +0100)]
time-util: map ALARM clockids to non-ALARM clockids in now()

Fixes: #2597

3 years agomissing.h: define IFLA_EXT_MASK
Rabin Vincent [Fri, 12 Feb 2016 07:41:44 +0000 (08:41 +0100)]
missing.h: define IFLA_EXT_MASK

We already define IFLA_PROMISCUITY and some other of these masks in
order to allow building with older headers.  Define IFLA_EXT_MASK too,
which was added in the same kernel version as IFLA_PROMISCUITY (v3.10).

3 years agobasic/strv: fix strv_join for first empty argument
Zbigniew Jędrzejewski-Szmek [Fri, 12 Feb 2016 04:24:14 +0000 (23:24 -0500)]
basic/strv: fix strv_join for first empty argument

Empty strings were ignored in strv_join, but only if they were at the beginning
of the string. Empty strings after at least one non-empty item were treated

{"x"} → "x"
{"x", ""} → "x"
{"x", "", ""} → "x::"
{""} → ""
{"", ""} → ""
{"", "", ""} → ""
{"", "x"} → "x"
{"", "x", ""} → "x:"
{"x"} → "x"
{"x", ""} → "x"
{"x", "", ""} → "x::"
{""} → ""
{"", ""} → ":"
{"", "", ""} → "::"
{"", "x"} → ":x"
{"", "x", ""} → ":x:"

3 years agoTypo
Zbigniew Jędrzejewski-Szmek [Fri, 12 Feb 2016 02:52:02 +0000 (21:52 -0500)]

3 years agotreewide: fix typos and then/that use
Torstein Husebø [Mon, 8 Feb 2016 12:27:22 +0000 (13:27 +0100)]
treewide: fix typos and then/that use

3 years agoAdd memcpy_safe
Zbigniew Jędrzejewski-Szmek [Tue, 2 Feb 2016 02:57:41 +0000 (21:57 -0500)]
Add memcpy_safe

ISO/IEC 9899:1999 §7.21.1/2 says:
Where an argument declared as size_t n specifies the length of the array
for a function, n can have the value zero on a call to that
function. Unless explicitly stated otherwise in the description of a
particular function in this subclause, pointer arguments on such a call
shall still have valid values, as described in 7.1.4.

In base64_append_width memcpy was called as memcpy(x, NULL, 0).  GCC 4.9
started making use of this and assumes This worked fine under -O0, but
does something strange under -O3.

This patch fixes a bug in base64_append_width(), fixes a possible bug in
journal_file_append_entry_internal(), and makes use of the new function
to simplify the code in other places.

3 years agocgroup2: use new fstype for unified hierarchy
Alban Crequy [Mon, 7 Dec 2015 00:10:50 +0000 (01:10 +0100)]
cgroup2: use new fstype for unified hierarchy

Since Linux v4.4-rc1, __DEVEL__sane_behavior does not exist anymore and
is replaced by a new fstype "cgroup2".

With this patch, elogind no longer supports the old (unstable) way of
doing unified hierarchy with __DEVEL__sane_behavior and elogind now
requires Linux v4.4 for unified hierarchy.

Non-unified hierarchy is still the default and is unchanged by this

3 years agosystemctl: add --value option
Zbigniew Jędrzejewski-Szmek [Sun, 2 Aug 2015 18:22:10 +0000 (14:22 -0400)]
systemctl: add --value option

With this option, systemctl will only print the rhs in show:
$ systemctl show -p Wants,After elogind-journald --value
elogind-journald.socket ...
elogind-journald-dev-log.socket ...

This is useful in scripts, because the need to call awk or similar
is removed.

3 years agoMerge pull request #16 from Gottox/fix-musl-228.3
Sven Eden [Wed, 24 May 2017 11:50:55 +0000 (13:50 +0200)]
Merge pull request #16 from Gottox/fix-musl-228.3

musl-fix for 228.3

3 years agomusl-fix: faccessat does not support AT_SYMLINK_NOFOLLOW with musl.
Enno Boland [Wed, 24 May 2017 11:19:32 +0000 (13:19 +0200)]
musl-fix: faccessat does not support AT_SYMLINK_NOFOLLOW with musl.

3 years agoVersion 229.1 Release v229.1
Sven Eden [Tue, 23 May 2017 12:50:10 +0000 (14:50 +0200)]
Version 229.1 Release

3 years agoMerge pull request #15 from elogind/dev_v229
Sven Eden [Tue, 23 May 2017 12:48:18 +0000 (14:48 +0200)]
Merge pull request #15 from elogind/dev_v229

Candidate for first v229 release

3 years agoPrep v229: Update man pages (fix most inappropriate stuff. Still lots to do...)
Sven Eden [Tue, 23 May 2017 09:18:11 +0000 (11:18 +0200)]
Prep v229: Update man pages (fix most inappropriate stuff. Still lots to do...)

3 years agoPrep v229: Some musl-libc compatibility updates
Sven Eden [Mon, 22 May 2017 08:18:56 +0000 (10:18 +0200)]
Prep v229: Some musl-libc compatibility updates

- musl-libc has no <bits/local_lim.h>
- musl-libc has no <xlocale.h>
- added <missing.h> include to basic/mdkir.c

3 years agoPrep v229: Consolidate system sleep functions.
Sven Eden [Mon, 22 May 2017 07:12:52 +0000 (09:12 +0200)]
Prep v229: Consolidate system sleep functions.

Move sleep relevant functions from shared/sleep-config.* and
login/logind-action.* into login/logind-sleep.* - they aren't used outside
of elogind anyway.

3 years agoPrep v229: elogind should honor its Sleep configuration.
Sven Eden [Fri, 19 May 2017 11:18:31 +0000 (13:18 +0200)]
Prep v229: elogind should honor its Sleep configuration.

3 years agosrc/login/logind.conf : Fix naming
Sven Eden [Fri, 19 May 2017 06:53:29 +0000 (08:53 +0200)]
src/login/logind.conf : Fix naming

3 years agoPrep v229: Update and fix man page building (
Sven Eden [Thu, 18 May 2017 07:14:33 +0000 (09:14 +0200)]
Prep v229: Update and fix man page building (

3 years agoPrep v229: Mask more unused functions in src/basic
Sven Eden [Thu, 18 May 2017 05:25:40 +0000 (07:25 +0200)]
Prep v229: Mask more unused functions in src/basic

3 years agoPrep v229: Use parse-printf-format.h if configure did not find printf.h
Sven Eden [Thu, 18 May 2017 05:50:58 +0000 (07:50 +0200)]
Prep v229: Use parse-printf-format.h if configure did not find printf.h

3 years agoPrep v229: Remove orphaned files
Sven Eden [Wed, 17 May 2017 15:46:20 +0000 (17:46 +0200)]
Prep v229: Remove orphaned files

The files
 - src/shared/output-mode.h and
 - src/test/test-signal-util.c
are not used anywhere anymore.

3 years agoPrep v229: Add include for parse-printf-format.h to src/basic/stdio-util.h
Sven Eden [Wed, 17 May 2017 13:26:47 +0000 (15:26 +0200)]
Prep v229: Add include for parse-printf-format.h to src/basic/stdio-util.h

Now that dedicated libc headers are included in their corresponding foo-util.h
headers, stdio-util.h is the only place left, where printf.h was included.
The nice thing is, that this is the only place left where we have to take care
about printf and musl-libc.

3 years agoPrep v229: Update core build files to upstream
Sven Eden [Tue, 25 Apr 2017 11:03:09 +0000 (13:03 +0200)]
Prep v229: Update core build files to upstream

3 years agoPrep v229: Remove remaining emacs settings [6/6] src/systemd
Sven Eden [Fri, 28 Apr 2017 05:20:08 +0000 (07:20 +0200)]
Prep v229: Remove remaining emacs settings [6/6] src/systemd

3 years agoPrep v229: Remove remaining emacs settings [5/6] src/shared
Sven Eden [Fri, 28 Apr 2017 05:09:06 +0000 (07:09 +0200)]
Prep v229: Remove remaining emacs settings [5/6] src/shared

3 years agoPrep v229: Remove remaining emacs settings [4/6] src/login
Sven Eden [Fri, 28 Apr 2017 04:51:48 +0000 (06:51 +0200)]
Prep v229: Remove remaining emacs settings [4/6] src/login

3 years agoPrep v229: Remove remaining emacs settings [3/6] src/libelogind
Sven Eden [Thu, 27 Apr 2017 10:01:28 +0000 (12:01 +0200)]
Prep v229: Remove remaining emacs settings [3/6] src/libelogind

3 years agoPrep v229: Remove remaining emacs settings [2/6] src/core
Sven Eden [Thu, 27 Apr 2017 09:50:44 +0000 (11:50 +0200)]
Prep v229: Remove remaining emacs settings [2/6] src/core

3 years agoPrep v229: Remove remaining emacs settings [1/6] src/basic
Sven Eden [Thu, 27 Apr 2017 09:36:03 +0000 (11:36 +0200)]
Prep v229: Remove remaining emacs settings [1/6] src/basic

3 years agoPrep v229: Add missing fixes from upstream [6/6] src/systemd
Sven Eden [Fri, 28 Apr 2017 05:18:56 +0000 (07:18 +0200)]
Prep v229: Add missing fixes from upstream [6/6] src/systemd

3 years agoPrep v229: Add missing fixes from upstream [5/6] src/shared
Sven Eden [Fri, 28 Apr 2017 05:08:08 +0000 (07:08 +0200)]
Prep v229: Add missing fixes from upstream [5/6] src/shared

3 years agoPrep v229: Add missing fixes from upstream [4/6] src/login
Sven Eden [Thu, 27 Apr 2017 16:17:13 +0000 (18:17 +0200)]
Prep v229: Add missing fixes from upstream [4/6] src/login

3 years agoPrep v229: Add missing fixes from upstream [3/6] src/libelogind
Sven Eden [Thu, 27 Apr 2017 10:00:06 +0000 (12:00 +0200)]
Prep v229: Add missing fixes from upstream [3/6] src/libelogind

3 years agoPrep v229: Add missing fixes from upstream [2/6] src/core
Sven Eden [Thu, 27 Apr 2017 09:50:26 +0000 (11:50 +0200)]
Prep v229: Add missing fixes from upstream [2/6] src/core

3 years agoPrep v229: Add missing fixes from upstream [1/6] src/basic
Sven Eden [Thu, 27 Apr 2017 09:30:28 +0000 (11:30 +0200)]
Prep v229: Add missing fixes from upstream [1/6] src/basic

3 years agocgroup: remove support for NetClass= directive
Daniel Mack [Wed, 10 Feb 2016 14:44:01 +0000 (15:44 +0100)]
cgroup: remove support for NetClass= directive

Support for net_cls.class_id through the NetClass= configuration directive
has been added in v227 in preparation for a per-unit packet filter mechanism.
However, it turns out the kernel people have decided to deprecate the net_cls
and net_prio controllers in v2. Tejun provides a comprehensive justification
for this in his commit, which has landed during the merge window for kernel

As we're aiming for full support for the v2 cgroup hierarchy, we can no
longer support this feature. Userspace tool such as nftables are moving over
to setting rules that are specific to the full cgroup path of a task, which
obsoletes these controllers anyway.

This commit removes support for tweaking details in the net_cls controller,
but keeps the NetClass= directive around for legacy compatibility reasons.

3 years agotree-wide: remove Emacs lines from all files
Daniel Mack [Wed, 10 Feb 2016 12:26:21 +0000 (13:26 +0100)]
tree-wide: remove Emacs lines from all files

This should be handled fine now by .dir-locals.el, so need to carry that
stuff in every file.

3 years agocore: change internal error code for masked units from EBADR to ESHUTDOWN
Lennart Poettering [Tue, 9 Feb 2016 19:28:58 +0000 (20:28 +0100)]
core: change internal error code for masked units from EBADR to ESHUTDOWN

This commit changes the mapping of the BUS_ERROR_UNIT_MASKED error to ESHUTDOWN. This error is used whenever the
transaction engine is asked to operate on a masked unit. ESHUTDOWN is what is used for the similar case when the unit
file enable/disable logic hits a masked unit file, hence is a natural candidate to be used here too.

Background: before this patch both "job type not applicable" and "unit masked" where mapped to EBADR, which
transaction_add_job_and_dependencies() then checked for. It actually wanted to check exclusively for the former error
condition, not the latter but due to the same mapping this failed to work.

This patch semi-undoes an accidental change made in caffa4ef700fdd0eadd6c0b2ef9925611672a1bc, however restores the
error number to ESHUTDOWN instead of the original ENOSYS (for the reasons indicated above).

To make this easier to grok for the future, I added comments to explaining which error conditions are checked for.

Fixes: #2315

3 years agotime-util: introduce usec_sub()
Alexander Kuleshov [Thu, 4 Feb 2016 18:02:39 +0000 (00:02 +0600)]
time-util: introduce usec_sub()

The dual_timestamp_from_realtime(), dual_timestamp_from_monotonic()
and dual_timestamp_from_boottime_or_monotonic() shares the same
code for comparison given ts with delta. Let's move it to the
separate inline function to prevent code duplication.

3 years agocoredump: rework coredumping logic
Lennart Poettering [Mon, 8 Feb 2016 20:16:08 +0000 (21:16 +0100)]
coredump: rework coredumping logic

This reworks the coredumping logic so that the coredump handler invoked from the kernel only collects runtime data
about the crashed process, and then submits it for processing to a socket-activate coredump service, which extracts a
stacktrace and writes the coredump to disk.

This has a number of benefits: the disk IO and stack trace generation may take a substantial amount of resources, and
hence should better be managed by PID 1, so that resource management applies. This patch uses RuntimeMaxSec=, Nice=, OOMScoreAdjust=
and various sandboxing settings to ensure that the coredump handler doesn't take away unbounded resources from normally
priorized processes.

This logic is also nice since this makes sure the coredump processing and storage is delayed correctly until
/var/elogind/coredump is mounted and writable.

Fixes: #2286

3 years agotime-util: use dual_timestamp_get()
Alexander Kuleshov [Thu, 4 Feb 2016 19:03:23 +0000 (01:03 +0600)]
time-util: use dual_timestamp_get()

The time-util.c provides dual_timestamp_get() function for getting
realtime and monotonic timestamps. Let's use it instead of direct
realtime/monotonic calculation.

3 years agocore: log about path_is_mount_point() errors
Lennart Poettering [Wed, 3 Feb 2016 22:53:08 +0000 (23:53 +0100)]
core: log about path_is_mount_point() errors

We really shouldn't fail silently, but print a log message about these errors. Also make sure to attach error codes to
all log messages where that makes sense.

(While we are at it, add a couple of (void) casts to functions where we knowingly ignore return values.)

3 years agoutil: add check that makes sure time_t and TIME_T_MAX work the way we assume they do
Lennart Poettering [Wed, 3 Feb 2016 20:05:59 +0000 (21:05 +0100)]
util: add check that makes sure time_t and TIME_T_MAX work the way we assume they do

3 years agologind: load SELinux labelling system
Nicolas Iooss [Tue, 2 Feb 2016 19:07:46 +0000 (20:07 +0100)]
logind: load SELinux labelling system

elogind-logind uses mkdir_label and label_fix functions without calling
first mac_selinux_init.  This makes /run/user/$UID/ directories not
labelled correctly on an Arch Linux system using SELinux.

Fix this by calling mac_selinux_init("/run") early in elogind-logind.
This makes files created in /etc/udev/rules.d and /var/lib/elogind to be
labelled through transitions in the SELinux policy instead of using
setfscreatecon (with mac_selinux_create_file_prepare).

3 years agocore: rework unit timeout handling, and add new setting RuntimeMaxSec=
Lennart Poettering [Mon, 1 Feb 2016 20:48:10 +0000 (21:48 +0100)]
core: rework unit timeout handling, and add new setting RuntimeMaxSec=

This clean-ups timeout handling in PID 1. Specifically, instead of storing 0 in internal timeout variables as
indication for a disabled timeout, use USEC_INFINITY which is in-line with how we do this in the rest of our code
(following the logic that 0 means "no", and USEC_INFINITY means "never").

This also replace all usec_t additions with invocations to usec_add(), so that USEC_INFINITY is properly propagated,
and sd-event considers it has indication for turning off the event source.

This also alters the deserialization of the units to restart timeouts from the time they were originally started from.
Before this patch timeouts would be restarted beginning with the time of the deserialization, which could lead to
artificially prolonged timeouts if a daemon reload took place.

Finally, a new RuntimeMaxSec= setting is introduced for service units, that specifies a maximum runtime after which a
specific service is forcibly terminated. This is useful to put time limits on time-intensive processing jobs.

This also simplifies the various xyz_spawn() calls of the various types in that explicit distruction of the timers is
removed, as that is done anyway by the state change handlers, and a state change is always done when the xyz_spawn()
calls fail.

Fixes: #2249

3 years agocore: fix support for transient resource limit properties
Lennart Poettering [Mon, 1 Feb 2016 20:37:28 +0000 (21:37 +0100)]
core: fix support for transient resource limit properties

Make sure we can properly process resource limit properties. Specifically, allow transient configuration of both the
soft and hard limit, the same way from the unit files. Previously, only the the hard rlimits could be configured but
they'd implicitly spill into the soft hard rlimits.

This also updates the client-side code to be able to parse hard/soft resource limit specifications. Since we need to
serialize two properties in bus_append_unit_property_assignment() now, the marshalling of the container around it is
now moved into the function itself. This has the benefit of shortening the calling code.

As a side effect this now beefs up the rlimit parser of "systemctl set-property" to understand time and disk sizes
where that's appropriate.

3 years agoshared: simplify parsing of bus properties a bit
Lennart Poettering [Mon, 1 Feb 2016 20:31:44 +0000 (21:31 +0100)]
shared: simplify parsing of bus properties a bit

Let's write the property name and value in one call, when that's possible, shorthing our code a bit.

3 years agocore: fix handling of AccuracyUSec and RandomDelayUSec bus properties
Lennart Poettering [Mon, 1 Feb 2016 20:27:33 +0000 (21:27 +0100)]
core: fix handling of AccuracyUSec and RandomDelayUSec bus properties

Clear up some confusion regarding the USec and Sec suffixes we use. In configuration files we usually use the Sec
suffix, to indicate the implied time unit if none is specified. The respective bus properties however use the USec
property, since they expose 64bit unsigned integers containing time in µs.

Before this patch timer units exposed a bus property AccuracyUSec (which hence is the correct name) but when parsing
transient property data would look for AccuracySec instead (which is incorrect). This patch ensures we look for
AccuracySec correctly, but keeps the code for AccuracyUSec in place for compatibility, but adds a warning to ensure
that apps are updated to use the right property.

3 years agosd-event: permit a USEC_INFINITY timeout as an alternative to a disabling an event...
Lennart Poettering [Sun, 31 Jan 2016 23:20:18 +0000 (00:20 +0100)]
sd-event: permit a USEC_INFINITY timeout as an alternative to a disabling an event source

This should simplify handling of time events in clients and is in-line with the USEC_INFINITY macro we already have.
This way setting a timeout to 0 indicates "elapse immediately", and a timeout of USEC_INFINITY "elapse never".

3 years agosd-event: when determining the last allowed time a time event may elapse, deal with...
Lennart Poettering [Sun, 31 Jan 2016 23:19:14 +0000 (00:19 +0100)]
sd-event: when determining the last allowed time a time event may elapse, deal with overflows

3 years agobasic: fix touch() creating files with 07777 mode
Mantas Mikulėnas [Fri, 29 Jan 2016 21:36:08 +0000 (23:36 +0200)]
basic: fix touch() creating files with 07777 mode

mode_t is unsigned, so MODE_INVALID < 0 can never be true.

This fixes a possible DoS where any user could fill /run by writing to
a world-writable /run/elogind/show-status.

3 years agobasic: when parsing verb command lines, optionally shortcut them in chroot() environments
Lennart Poettering [Thu, 28 Jan 2016 18:30:56 +0000 (19:30 +0100)]
basic: when parsing verb command lines, optionally shortcut them in chroot() environments

This adds some basic infrastructure in order to fix #2015.

3 years agosystemctl: improve message when a job fails with a JOB_INVALID state
Lennart Poettering [Thu, 28 Jan 2016 17:53:34 +0000 (18:53 +0100)]
systemctl: improve message when a job fails with a JOB_INVALID state

This result can only happen if the job was a reload job for an inactive unit. Make the error message actually say that.

3 years agobasic: getauxval(AT_RANDOM) is apparently not necessarily aligned
Lennart Poettering [Thu, 28 Jan 2016 16:00:38 +0000 (17:00 +0100)]
basic: getauxval(AT_RANDOM) is apparently not necessarily aligned

Let's make sure we read it in a way compatible with non-aligned memory.


3 years agosd-journal: add an API to enumerate known field names of the journal
Lennart Poettering [Wed, 27 Jan 2016 17:59:29 +0000 (18:59 +0100)]
sd-journal: add an API to enumerate known field names of the journal

This adds two new calls to get the list of all journal fields names currently in use.

This is the low-level support to implement the feature requested in #2176 in a more optimized way.

3 years agonss: block various signals while running NSS lookups
Lennart Poettering [Tue, 26 Jan 2016 21:34:46 +0000 (22:34 +0100)]
nss: block various signals while running NSS lookups

Let's make sure our poll() calls don't get interrupted where they shouldn't (SIGALRM, ...), but allow them to be
interrupted where they should (SIGINT, ...).

Fixes #1965

3 years agobasic: don't append suffixes to unit name glob expressions
Lennart Poettering [Tue, 26 Jan 2016 19:25:10 +0000 (20:25 +0100)]
basic: don't append suffixes to unit name glob expressions

When the user specifies "foo*" as unit name glob expression, we shouldn't turn this into "foo*.service". Hence: only
append a suffix if the specified string isn't a glob expression.

Fixes: #2397

3 years agomachined: add early checks for unrealistically large image/pool sizes
Lennart Poettering [Tue, 26 Jan 2016 18:02:12 +0000 (19:02 +0100)]
machined: add early checks for unrealistically large image/pool sizes

3 years agoman: document that logind's RemoveIPC= option excepts all system users
Lennart Poettering [Tue, 26 Jan 2016 12:42:04 +0000 (13:42 +0100)]
man: document that logind's RemoveIPC= option excepts all system users

Fixes #2324.

3 years agoshutdown: complain if process excluded from killing spree runs of the same rootfs...
Michal Sekletar [Sun, 24 Jan 2016 15:08:36 +0000 (16:08 +0100)]
shutdown: complain if process excluded from killing spree runs of the same rootfs as PID1

3 years agoelogind-activate: Add support for datagram sockets
Susant Sahani [Fri, 22 Jan 2016 04:11:44 +0000 (09:41 +0530)]
elogind-activate: Add support for datagram sockets

core: Add flexible way to provide socket type
the socket type should be a diffrent argumet
in make_socket_fd . In this way we can set the socket
type like SOCK_STREAM SOCK_DGRAM in the address.

journal-remote: modify make_socket_fd

3 years agoresolve: generate a nice clean error when clients try to resolve a name when the...
Lennart Poettering [Wed, 20 Jan 2016 20:28:22 +0000 (21:28 +0100)]
resolve: generate a nice clean error when clients try to resolve a name when the network is down

3 years agologind,machined: bump TasksMax=
Lennart Poettering [Wed, 20 Jan 2016 19:27:21 +0000 (20:27 +0100)]
logind,machined: bump TasksMax=

Issue #2388 suggests the current TasksMax= setting for user processes is to low. Bump it to 12K. Also, bump the
container TasksMax= from 8K to 16K, so that it remains higher than the one for user processes.

(Compare: the kernel default limit for processes system-wide is 32K).

Fixes #2388

3 years agoresolved: add bus API for configuring per-link DNS settings
Lennart Poettering [Tue, 19 Jan 2016 16:16:12 +0000 (17:16 +0100)]
resolved: add bus API for configuring per-link DNS settings

This is useful for alternative network management solutions (such as NetworkManager) to push DNS configuration data
into resolved.

The calls will fail should networkd already have taken possesion of a link, so that the bus API is only available if
we don't get the data from networkd.

3 years agoresolved: add a couple of errors to the error mapping tables
Lennart Poettering [Tue, 19 Jan 2016 16:15:02 +0000 (17:15 +0100)]
resolved: add a couple of errors to the error mapping tables

These were previously forgotten, add them now.

3 years agocore: add valgrind helper for daemon-reexec
Evgeny Vereshchagin [Tue, 19 Jan 2016 15:48:45 +0000 (15:48 +0000)]
core: add valgrind helper for daemon-reexec

Inspired by

3 years agoFix IPv6PrivacyExtension (networkd-ndisc.c)
Dominik Hannen [Fri, 15 Jan 2016 22:39:54 +0000 (23:39 +0100)]
Fix IPv6PrivacyExtension (networkd-ndisc.c)

This small addition fixes the issues #1982 and #2242.
IPv6PrivacyExtension now works as expected even when a RA is received.

3 years agobus-error: verify additional error maps during installation
Zbigniew Jędrzejewski-Szmek [Wed, 13 Jan 2016 19:23:54 +0000 (14:23 -0500)]
bus-error: verify additional error maps during installation

Go over the entries in the map and check that they make sense.
Tests are added. In the future we might want to do additional
checks, e.g. verifying that the error names are in the expected

3 years agobasic: add ascii_strcasecmp_nn() call
Lennart Poettering [Wed, 13 Jan 2016 18:45:05 +0000 (19:45 +0100)]
basic: add ascii_strcasecmp_nn() call

In contrast to ascii_strcasecmp_nn() it takes two character buffers with their individual length. It will then compare
the buffers up the smaller size of the two buffers, and finally the length themselves.

3 years agobasic: add new ascii_strcasecmp_n() call
Lennart Poettering [Wed, 13 Jan 2016 01:21:16 +0000 (02:21 +0100)]
basic: add new ascii_strcasecmp_n() call

3 years agobasic,bus-error: return negative error from errno_from_name
Zbigniew Jędrzejewski-Szmek [Tue, 12 Jan 2016 22:19:51 +0000 (17:19 -0500)]
basic,bus-error: return negative error from errno_from_name

errno_from_name used an unusual return convention where 0 meant
"not found". This tripped up config_parse_syscall_errno(),
which would treat that as success. Return -EINVAL instead,
and adjust bus_error_name_to_errno() for the new convention.

Also remove a goto which was used as a simple if and clean
up surroudning code a bit.

3 years agobasic/escape: merge utf8 and non-utf8 paths in cunescape_one
Zbigniew Jędrzejewski-Szmek [Tue, 12 Jan 2016 20:36:57 +0000 (15:36 -0500)]
basic/escape: merge utf8 and non-utf8 paths in cunescape_one

Not every byte sequence is valid utf8. We allow escaping of non-utf8
sequences in strings by using octal and hexadecimal escape sequences
(\123 and \0xAB) for bytes at or above 128. Users of cunescape_one
could infer whether such use occured when they received an answer
between 128 and 256 in *ret (a non-ascii one byte character). But this
is subtle and misleading: the comments were wrong, because ascii is a
subset of unicode, so c != 0 did not mean non-unicode, but rather
ascii-subset-of-unicode-or-raw-byte. This was all rather confusing, so
make the "single byte" condition explicit.

I'm not convinced that allowing non-utf8 sequences to be produced is
useful in all cases where we allow it (e.g. in config files), but that
behaviour is unchanged, just made more explicit.

This also fixes an (invalid) gcc warning about unitialized variable
(*ret_unicode) in callers of cunescape_one.

3 years agosd-event: minor fixups to delays profiling changes
Vito Caputo [Tue, 12 Jan 2016 18:14:33 +0000 (10:14 -0800)]
sd-event: minor fixups to delays profiling changes

3 years agotree-wide: use xsprintf() where applicable
Daniel Mack [Tue, 12 Jan 2016 14:34:20 +0000 (15:34 +0100)]
tree-wide: use xsprintf() where applicable

Also add a coccinelle receipt to help with such transitions.

3 years agosd-event: check clock argument to sd_event_now()
Zbigniew Jędrzejewski-Szmek [Mon, 11 Jan 2016 22:19:25 +0000 (17:19 -0500)]
sd-event: check clock argument to sd_event_now()

sd_event_now() is a public function, so we must check all
arguments for validity. Update man page and add tests.

Sample debug message:
Assertion 'IN_SET(clock, CLOCK_REALTIME, CLOCK_REALTIME_ALARM, CLOCK_MONOTONIC, CLOCK_BOOTTIME, CLOCK_BOOTTIME_ALARM)' failed at src/libelogind/sd-event/sd-event.c:2719, function sd_event_now(). Ignoring.

3 years agotree-wide: check if errno is greater than zero (2)
Zbigniew Jędrzejewski-Szmek [Mon, 11 Jan 2016 19:31:14 +0000 (14:31 -0500)]
tree-wide: check if errno is greater than zero (2)

Compare errno with zero in a way that tells gcc that
(if the condition is true) errno is positive.

3 years agotree-wide: check if errno is greater then zero
Zbigniew Jędrzejewski-Szmek [Mon, 11 Jan 2016 17:47:14 +0000 (12:47 -0500)]
tree-wide: check if errno is greater then zero

gcc is confused by the common idiom of
  return errno ? -errno : -ESOMETHING
and thinks a positive value may be returned. Replace this condition
with errno > 0 to help gcc and avoid many spurious warnings. I filed
a gcc rfe a long time ago, but it hard to say if it will ever be
implemented [1].

Both conventions were used in the codebase, this change makes things
more consistent. This is a follow up to bcb161b0230f.


3 years agobus-kernel: reword assignment of dst_id in bus_message_setup_kmsg
Zbigniew Jędrzejewski-Szmek [Mon, 11 Jan 2016 17:42:42 +0000 (12:42 -0500)]
bus-kernel: reword assignment of dst_id in bus_message_setup_kmsg

Setting of dst_id was based on interplay of two booleans,
making the logic hard to follow (for humans and compilers alike).
gcc was confused and emmitted a warning about an uninitialized
variable. Rework the code to make it obvious that dst_id is
set properly.

3 years agomacro.h: provide a switch-case statement generator for IN_SET
Daniel Mack [Sun, 10 Jan 2016 17:11:22 +0000 (18:11 +0100)]
macro.h: provide a switch-case statement generator for IN_SET

Rather than walking a list of valid values one-by-one, generate a
switch-case statement for the IN_SET() macro. This allows the compiler to
further optimize its code output, possibly by generating jump tables.
This effectively decreases the binary size slightly.

The implementation is based on macro overloading depending on the number of
arguments. h/t to the following post:

3 years agoresolved: don't attempt to send queries for DNSSEC RR types to servers not supporting...
Lennart Poettering [Fri, 8 Jan 2016 16:10:49 +0000 (17:10 +0100)]
resolved: don't attempt to send queries for DNSSEC RR types to servers not supporting them

If we already degraded the feature level below DO don't bother with sending requests for DS, DNSKEY, RRSIG, NSEC, NSEC3
or NSEC3PARAM RRs. After all, we cannot do DNSSEC validation then anyway, and we better not press a legacy server like
this with such modern concepts.

This also has the benefit that when we try to validate a response we received using DNSSEC, and we detect a limited
server support level while doing so, all further auxiliary DNSSEC queries will fail right-away.

3 years agoshared: make sure and foobar result in different domain name hashes
Lennart Poettering [Fri, 8 Jan 2016 00:11:55 +0000 (01:11 +0100)]
shared: make sure and foobar result in different domain name hashes

This also introduces a new macro siphash24_compress_byte() which is useful to add a single byte into the hash stream,
and ports one user over to it.

3 years agobasic: split hash functions into their own header files
Lennart Poettering [Fri, 8 Jan 2016 00:10:45 +0000 (01:10 +0100)]
basic: split hash functions into their own header files

The hash operations are not really that specific to hashmaps, hence split them into a .c module of their own.

3 years agobasic: introduce generic ascii_strlower_n() call and make use of it everywhere
Lennart Poettering [Thu, 7 Jan 2016 18:43:26 +0000 (19:43 +0100)]
basic: introduce generic ascii_strlower_n() call and make use of it everywhere

3 years agobasic: add string table macros for "extended boolean" enums
Lennart Poettering [Tue, 5 Jan 2016 16:10:17 +0000 (17:10 +0100)]
basic: add string table macros for "extended boolean" enums

In a couple of cases we maintain configuration settings that know an on
and off state, like a boolean, plus some additional states. We generally
parse them as booleans first, and if that fails check for specific
additional values.

This adds a generalized set of macros for parsing such settings, and
ports one use in resolved and another in networkd over to it.

3 years agoresolved: explicitly handle case when the trust anchor is empty
Lennart Poettering [Mon, 4 Jan 2016 21:35:54 +0000 (22:35 +0100)]
resolved: explicitly handle case when the trust anchor is empty

Since we honour RFC5011 revoked keys it might happen we end up with an
empty trust anchor, or one where there's no entry for the root left.
With this patch the logic is changed what to do in this case.

Before this patch we'd end up requesting the root DS, which returns with
NODATA but a signed NSEC we cannot verify, since the trust anchor is
empty after all. Thus we'd return a DNSSEC result of "missing-key", as
we lack a verified version of the key.

With this patch in place, look-ups for the root DS are explicitly
recognized, and not passed on to the DNS servers. Instead, if
downgrade-ok mode is on an unsigned NODATA response is synthesized, so
that the validator code continues under the assumption the root zone was
unsigned. If downgrade-ok mode is off a new transaction failure is
generated, that makes this case recognizable.

3 years agoresolved: introduce a proper bus error for DNSSEC validation errors
Lennart Poettering [Mon, 4 Jan 2016 21:35:17 +0000 (22:35 +0100)]
resolved: introduce a proper bus error for DNSSEC validation errors

3 years agobasic: modernize conf-files.c a bit
Lennart Poettering [Sat, 2 Jan 2016 20:32:45 +0000 (21:32 +0100)]
basic: modernize conf-files.c a bit

3 years agocore: socket options fix SCTP_NODELAY
Susant Sahani [Thu, 31 Dec 2015 06:35:57 +0000 (12:05 +0530)]
core: socket options fix SCTP_NODELAY

Apply proper options in case of SCTP.

3 years agoresolved: properly handle SRV RRs with the DNS root as hostname
Lennart Poettering [Tue, 29 Dec 2015 17:58:05 +0000 (18:58 +0100)]
resolved: properly handle SRV RRs with the DNS root as hostname

3 years agoresolved: add errno mapping for BUS_ERROR_CONNECTION_FAILURE
Lennart Poettering [Tue, 29 Dec 2015 17:55:58 +0000 (18:55 +0100)]
resolved: add errno mapping for BUS_ERROR_CONNECTION_FAILURE

This was missing when the error type was added in

3 years agoresolved: change mapping of BUS_ERROR_NO_NAME_SERVERS to ESRCH
Lennart Poettering [Tue, 29 Dec 2015 17:55:17 +0000 (18:55 +0100)]
resolved: change mapping of BUS_ERROR_NO_NAME_SERVERS to ESRCH

EIO is really too generic, and indicates transmission problems.

3 years agobus-util: print "systemctl --user" on user service manager
WaLyong Cho [Tue, 29 Dec 2015 05:15:04 +0000 (14:15 +0900)]
bus-util: print "systemctl --user" on user service manager

When a unit was started with "systemctl --user" and it failed, error
messages is printed as "systemctl status". But it should be "systemctl
--user status".

3 years agoman: fix typos
Jakub Wilk [Sat, 26 Dec 2015 17:25:49 +0000 (18:25 +0100)]
man: fix typos

3 years agobasic: add missing word in comment
Zbigniew Jędrzejewski-Szmek [Fri, 25 Dec 2015 21:29:09 +0000 (16:29 -0500)]
basic: add missing word in comment

3 years agoresolved: generate an explicit transaction error when we cannot reach server via TCP
Lennart Poettering [Fri, 25 Dec 2015 11:54:27 +0000 (12:54 +0100)]
resolved: generate an explicit transaction error when we cannot reach server via TCP

Previously, if we couldn't reach a server via UDP we'd generate an
MAX_ATTEMPTS transaction result, but if we couldn't reach it via TCP
we'd generate a RESOURCES transaction result. While it is OK to generate
two different errors I think, "RESOURCES" is certainly a misnomer.
Introduce a new transaction result "CONNECTION_FAILURE" instead.