platform/upstream/systemd.git
6 years agomissing: Define EFIVARFS_MAGIC if missing
Henrik Grindal Bakken [Thu, 23 Mar 2017 15:02:20 +0000 (16:02 +0100)]
missing: Define EFIVARFS_MAGIC if missing

6 years agomissing: Add MAX_HANDLE_SZ
Henrik Grindal Bakken [Thu, 23 Mar 2017 15:07:33 +0000 (16:07 +0100)]
missing: Add MAX_HANDLE_SZ

6 years agomissing: Add PR_SET_MM_{ARG,ENV}_{START,END}
Henrik Grindal Bakken [Thu, 23 Mar 2017 14:42:15 +0000 (15:42 +0100)]
missing: Add PR_SET_MM_{ARG,ENV}_{START,END}

6 years agomissing: Add some more btrfs structs and constants
Henrik Grindal Bakken [Thu, 23 Mar 2017 14:33:06 +0000 (15:33 +0100)]
missing: Add some more btrfs structs and constants

6 years agobtrfs: Include missing.h in btrfs-ctree.h
Henrik Grindal Bakken [Thu, 23 Mar 2017 14:30:57 +0000 (15:30 +0100)]
btrfs: Include missing.h in btrfs-ctree.h

6 years agocatalog: update Polish translation (#7660)
Piotr Drąg [Sat, 16 Dec 2017 14:20:34 +0000 (15:20 +0100)]
catalog: update Polish translation (#7660)

6 years agoMerge pull request #7664 from poettering/fix-integration-tests
Zbigniew Jędrzejewski-Szmek [Sat, 16 Dec 2017 14:01:04 +0000 (15:01 +0100)]
Merge pull request #7664 from poettering/fix-integration-tests

Fix integration tests

6 years agoman: generalize "binary" to "program" (#7668)
Alan Jenkins [Sat, 16 Dec 2017 10:48:12 +0000 (10:48 +0000)]
man: generalize "binary" to "program" (#7668)

Systemd services are permitted to be scripts, as well as binary
executables.

The same also applies to the underlying /sbin/mount and /sbin/swapon.
It is not necessary for the user to consider what type of program file
these are.  Nor is it necessary with systemd-nspawn, to distinguish between
init as a "binary" v.s. a user-specified "program".

Also fix a couple of grammar nits in the modified sentences.

6 years agomeson: libudev_core and udevadm should have LOG_REALM=LOG_REALM_UDEV (#7666)
Franck Bui [Sat, 16 Dec 2017 08:36:36 +0000 (09:36 +0100)]
meson: libudev_core and udevadm should have LOG_REALM=LOG_REALM_UDEV (#7666)

Otherwise, setting udev_log=debug in /etc/udev/udev.conf has no effects since
systemd-udevd is built with LOG_REALM=LOG_REALM_UDEV.

However using LOG_REALM_UDEV (for libudev_core) reveals another similar bug for
udevadm which should also define LOG_REALM_UDEV.

6 years agoMerge pull request #7661 from keszybz/slice-cleanups
Lennart Poettering [Fri, 15 Dec 2017 19:55:39 +0000 (20:55 +0100)]
Merge pull request #7661 from keszybz/slice-cleanups

Slice cleanups and systemd-mount --owner

6 years agotest: fix TEST-13-NSPAWN-SMOKE
Lennart Poettering [Fri, 15 Dec 2017 19:49:11 +0000 (20:49 +0100)]
test: fix TEST-13-NSPAWN-SMOKE

We need to specify a full path to the "ip" binary and busybox "ip" has a
slightly different output than the normal ip, and won't show "DOWN".
hence instead ensure that at lest not "UP" is in there.

6 years agotest: make sure "make" in the test directories works again
Lennart Poettering [Fri, 15 Dec 2017 18:47:16 +0000 (19:47 +0100)]
test: make sure "make" in the test directories works again

Fixes: #7648

6 years agogenerator: add helper function for writing unit files
Zbigniew Jędrzejewski-Szmek [Sat, 9 Dec 2017 18:23:26 +0000 (19:23 +0100)]
generator: add helper function for writing unit files

It doesn't save too much, but it's a common pattern so I think it's worth
to factor this out.

6 years agoFix logical error in meson.build (#7658)
Max Harmathy [Fri, 15 Dec 2017 15:05:25 +0000 (16:05 +0100)]
Fix logical error in meson.build (#7658)

sysvinit_path and sysvrcnd_path have to be set both to activate Sysv compatibility.

6 years agomount: add option to specify uid= and gid=
Zbigniew Jędrzejewski-Szmek [Sat, 9 Dec 2017 09:18:48 +0000 (10:18 +0100)]
mount: add option to specify uid= and gid=

The kernel needs two numbers, but for the user it's most convenient to provide the
user name and have that resolved to uid and gid.

Right now the primary group of the specified user is always used. That's the most
common case anyway. In the future we can extend the --owner option to allow a group
after a colon.

[I added this before realizing that this will not be enough to be used for user
runtime directory. But this seems useful on its own, so I'm keeping this commit.]

6 years agologind: use free_and_replace in one spot
Zbigniew Jędrzejewski-Szmek [Thu, 7 Dec 2017 21:16:16 +0000 (22:16 +0100)]
logind: use free_and_replace in one spot

No functional change.

6 years agotree-wide: use SPECIAL_ROOT_SLICE
Zbigniew Jędrzejewski-Szmek [Thu, 7 Dec 2017 13:28:00 +0000 (14:28 +0100)]
tree-wide: use SPECIAL_ROOT_SLICE

6 years agocore: reuse slice_build_parent_slice
Zbigniew Jędrzejewski-Szmek [Thu, 7 Dec 2017 13:23:58 +0000 (14:23 +0100)]
core: reuse slice_build_parent_slice

6 years agologind: fix misleading message
Zbigniew Jędrzejewski-Szmek [Thu, 7 Dec 2017 12:12:13 +0000 (13:12 +0100)]
logind: fix misleading message

This message would also be emitted at boot for any user with linger
enabled, so "logged in" is the wrong term to use.

6 years agologind: simplify one conditional
Zbigniew Jędrzejewski-Szmek [Thu, 7 Dec 2017 11:57:31 +0000 (12:57 +0100)]
logind: simplify one conditional

Don't bother with removing the directory if we didn't create it.

6 years agoman: Clarify when OnFailure= activates after restarts (#7646)
Ken (Bitsko) MacLeod [Fri, 15 Dec 2017 10:10:41 +0000 (04:10 -0600)]
man: Clarify when OnFailure= activates after restarts (#7646)

6 years agotree-wide: add DEBUG_LOGGING macro that checks whether debug logging is on (#7645)
Lennart Poettering [Fri, 15 Dec 2017 10:09:00 +0000 (11:09 +0100)]
tree-wide: add DEBUG_LOGGING macro that checks whether debug logging is on (#7645)

This makes things a bit easier to read I think, and also makes sure we
always use the _unlikely_ wrapper around it, which so far we used
sometimes and other times we didn't. Let's clean that up.

6 years agoMerge pull request #7637 from yuwata/transient-path
Lennart Poettering [Fri, 15 Dec 2017 09:53:49 +0000 (10:53 +0100)]
Merge pull request #7637 from yuwata/transient-path

core/path: implement transient path unit

6 years agoMerge pull request #7631 from cgwalters/systemctl-offline
Lennart Poettering [Fri, 15 Dec 2017 09:29:21 +0000 (10:29 +0100)]
Merge pull request #7631 from cgwalters/systemctl-offline

systemctl,verbs: Introduce SYSTEMCTL_OFFLINE environment variable

6 years agoMerge pull request #7644 from poettering/memzero
Lennart Poettering [Fri, 15 Dec 2017 09:27:31 +0000 (10:27 +0100)]
Merge pull request #7644 from poettering/memzero

add memzero()/zero() coccinelle scripts and use them

6 years agoCODING_STYLE: provide better explanation why /* */ over // (#7647)
Lennart Poettering [Fri, 15 Dec 2017 09:26:07 +0000 (10:26 +0100)]
CODING_STYLE: provide better explanation why /* */ over // (#7647)

Let's provide a real reason why /* */ should be used for commenting,
rather than //, beyond mere taste.

(This ultimately simply codifies how I use // vs. /* */ comments, and I
think this is useful as an explanation and reason hence.)

6 years agoTODO: update
Yu Watanabe [Thu, 14 Dec 2017 13:17:17 +0000 (22:17 +0900)]
TODO: update

6 years agodoc: update TRANSIENT-SETTINGS.md
Yu Watanabe [Thu, 14 Dec 2017 13:02:06 +0000 (22:02 +0900)]
doc: update TRANSIENT-SETTINGS.md

6 years agobus-unit-util: add path unit related options
Yu Watanabe [Fri, 15 Dec 2017 00:11:39 +0000 (09:11 +0900)]
bus-unit-util: add path unit related options

6 years agocore/path: implement transient path unit
Yu Watanabe [Mon, 11 Dec 2017 15:10:58 +0000 (00:10 +0900)]
core/path: implement transient path unit

6 years agocore/dbus-timer: improve error messages
Yu Watanabe [Thu, 14 Dec 2017 12:52:47 +0000 (21:52 +0900)]
core/dbus-timer: improve error messages

6 years agobus-unit-util: improve error messages
Yu Watanabe [Thu, 14 Dec 2017 07:34:26 +0000 (16:34 +0900)]
bus-unit-util: improve error messages

6 years agobus-unit-util: remove unnecessary oom check
Yu Watanabe [Thu, 14 Dec 2017 07:32:59 +0000 (16:32 +0900)]
bus-unit-util: remove unnecessary oom check

We cannot detect error by alloca().

6 years agofinal v236 update (#7649) v236
Lennart Poettering [Thu, 14 Dec 2017 22:09:57 +0000 (23:09 +0100)]
final v236 update (#7649)

6 years agoMerge pull request #7608 from poettering/more-news-v236
Lennart Poettering [Thu, 14 Dec 2017 21:58:22 +0000 (22:58 +0100)]
Merge pull request #7608 from poettering/more-news-v236

more v236 news improvements

6 years agoMerge pull request #6598 from kyle-walker/shutdown-limit
Lennart Poettering [Thu, 14 Dec 2017 21:57:57 +0000 (22:57 +0100)]
Merge pull request #6598 from kyle-walker/shutdown-limit

core: Limit the time and attempts in shutdown remount/umount efforts

6 years agoMerge pull request #7640 from keszybz/tainting-updates
Lennart Poettering [Thu, 14 Dec 2017 21:57:17 +0000 (22:57 +0100)]
Merge pull request #7640 from keszybz/tainting-updates

Tainting updates

6 years agoMerge pull request #7469 from kinvolk/dongsu/nspawn-netns
Zbigniew Jędrzejewski-Szmek [Thu, 14 Dec 2017 21:47:57 +0000 (22:47 +0100)]
Merge pull request #7469 from kinvolk/dongsu/nspawn-netns

nspawn: introduce an option for specifying network namespace path

6 years agoUpdate TODO
Zbigniew Jędrzejewski-Szmek [Thu, 14 Dec 2017 13:12:39 +0000 (14:12 +0100)]
Update TODO

6 years agomeson: restore --update-catalog call after install
Zbigniew Jędrzejewski-Szmek [Thu, 14 Dec 2017 13:12:31 +0000 (14:12 +0100)]
meson: restore --update-catalog call after install

This got dropped by mistake in 72cdb3e783174dcf9223a49f03e3b0e2ca95ddb8.

6 years agoMake taint message structured and add catalog entry
Zbigniew Jędrzejewski-Szmek [Thu, 14 Dec 2017 09:15:41 +0000 (10:15 +0100)]
Make taint message structured and add catalog entry

Dec 14 14:10:54 krowka systemd[1]: System is tainted: overflowgid-not-65534
-- Subject: The system is configured in a way that might cause problems
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- The following "tags" are possible:
-- - "split-usr" — /usr is a separate file system and was not mounted when systemd
--   was booted
-- - "cgroups-missing" — the kernel was compiled without cgroup support or access
--   to expected interface files is resticted
-- - "var-run-bad" — /var/run is not a symlink to /run
-- - "overflowuid-not-65534" — the kernel user ID used for "unknown" users (with
--   NFS or user namespaces) is not 65534
-- - "overflowgid-not-65534" — the kernel group ID used for "unknown" users (with
--   NFS or user namespaces) is not 65534
-- Current system is tagged as overflowgid-not-65534.

6 years agocore: drop taints for nobody user/group names
Zbigniew Jędrzejewski-Szmek [Thu, 14 Dec 2017 11:44:21 +0000 (12:44 +0100)]
core: drop taints for nobody user/group names

We have a check and warning at compile time. The user cannot do anything about
this at runtime, and all other taints are about checks that happen at runtime
and are specific to that system (and at least potentially correctable).

(The logic in the compilation-time check was updated to treat "nogroup" as OK,
but not the runtime check. But I think it's better to remove the runtime check
for this altogether, so this becomes moot.)

6 years agoverbs: Rename VERB_OFFLINE to VERB_ONLINE_ONLY, expand MUSTBEROOT
Colin Walters [Thu, 14 Dec 2017 20:23:02 +0000 (15:23 -0500)]
verbs: Rename VERB_OFFLINE to VERB_ONLINE_ONLY, expand MUSTBEROOT

Followup to previous commit. Suggested by @poettering.
Reindented the `verbs[]` tables to match the apparent previous
whitespace rules (indent to one flag, allow multiple flags to overflow?).

6 years agosystemctl,verbs: Introduce SYSTEMD_OFFLINE environment variable
Colin Walters [Wed, 13 Dec 2017 21:04:41 +0000 (16:04 -0500)]
systemctl,verbs: Introduce SYSTEMD_OFFLINE environment variable

A lot of code references the `running_in_chroot()` function; while
I didn't dig I'm pretty certain this arose to deal with situations
like RPM package builds in `mock` - there we don't want the `%post`s
to `systemctl start` for example.

And actually this exact same use case arises for
[rpm-ostree](https://github.com/projectatomic/rpm-ostree/)
where we implement offline upgrades by default; the `%post`s are
always run in a new chroot using [bwrap](https://github.com/projectatomic/bubblewrap).

And here's the problem: bwrap creates proper mount roots, so it
passes `running_in_chroot()`, and then if a script tries to do
`systemctl start` we get:
`System has not been booted with systemd as init system (PID 1)`
but that's an *error*, unlike the `running_in_chroot()` case where we ignore.

Further complicating things is there are real world RPM packages
like `glusterfs` which end up invoking `systemctl start`.

A while ago, the `SYSTEMD_IGNORE_CHROOT` environment variable was
added for the inverse case of running in a chroot, but still wanting
to use systemd as PID 1 (presumably some broken initramfs setups?).

Let's introduce a `SYSTEMD_OFFLINE` environment variable for cases like
mock/rpm-ostree so we can force on the "ignore everything except preset" logic.
This way we'll still not start services even if mock switches to use nspawn or
bwrap or something else that isn't a chroot.

We also cleanly supercede the `SYSTEMD_IGNORE_CHROOT=1` which is now spelled
`SYSTEMD_OFFLINE=0`.  (Suggested by @poettering)

Also I made things slightly nicer here and we now print the ignored operation.

6 years agoMerge pull request #7643 from keszybz/hwdb-update-again
Zbigniew Jędrzejewski-Szmek [Thu, 14 Dec 2017 20:13:20 +0000 (21:13 +0100)]
Merge pull request #7643 from keszybz/hwdb-update-again

Hwdb update again

6 years agoresolve: extend systemd-resolve so that it can push per-interface DNS configuration...
Lennart Poettering [Thu, 14 Dec 2017 19:13:14 +0000 (20:13 +0100)]
resolve: extend systemd-resolve so that it can push per-interface DNS configuration into systemd-resolved (#7576)

This is useful to debug things, but also to hook up external post-up
scripts with resolved.

Eventually this code might be useful to implement a
resolvconf(8)-compatible interface for compatibility purposes. Since the
semantics don't map entirely cleanly as first step we add a native
interface for pushing DNS configuration into resolved, that exposes the
correct semantics, before adding any compatibility interface.

See: #7202

6 years agoudev-link-config: add missing OOM check
Lennart Poettering [Thu, 14 Dec 2017 19:09:45 +0000 (20:09 +0100)]
udev-link-config: add missing OOM check

6 years agolink-config: make initialization to -1 less weird
Lennart Poettering [Thu, 14 Dec 2017 18:50:43 +0000 (19:50 +0100)]
link-config: make initialization to -1 less weird

memset() is weird anyway, since it expects an "int" as second parameter,
which it then uses as a byte, i.e. as uint8_t or something like that.
But by passing -1 to it, things get particularly weird, as that relies
on sign expansion to do the right thing.

6 years agococcinelle: automatically rewrite memset() to zero() or memzero() where we can
Lennart Poettering [Thu, 14 Dec 2017 18:47:46 +0000 (19:47 +0100)]
coccinelle: automatically rewrite memset() to zero() or memzero() where we can

We are pretty good at this already, hence only a single case is actually
found by this.

6 years agotree-wide: make use of new STRLEN() macro everywhere (#7639)
Lennart Poettering [Thu, 14 Dec 2017 18:02:29 +0000 (19:02 +0100)]
tree-wide: make use of new STRLEN() macro everywhere (#7639)

Let's employ coccinelle to do this for us.

Follow-up for #7625.

6 years agocore: Implement sync_with_progress()
Kyle Walker [Thu, 14 Dec 2017 16:46:03 +0000 (11:46 -0500)]
core: Implement sync_with_progress()

In similar fashion to the previous change, sync() operations can stall
endlessly if cache is unable to be written out. In order to avoid an
unbounded hang, the sync takes place within a child process. Every 10
seconds (SYNC_TIMEOUT_USEC), the value of /proc/meminfo "Dirty" is checked
to verify it is smaller than the last iteration. If the sync is not making
progress for 3 successive iterations (SYNC_PROGRESS_ATTEMPTS), a SIGKILL is
sent to the sync process and the shutdown continues.

6 years agotest: add smoke tests for `--network-namespace-path`
Iago López Galeiras [Tue, 12 Dec 2017 16:47:41 +0000 (16:47 +0000)]
test: add smoke tests for `--network-namespace-path`

We create net ns with `ip netns`, pass the created ns to nspawn and
check the loopback interface is DOWN.

6 years agoNEWS: update NEWS again, and prepare for a release tomorrow
Lennart Poettering [Wed, 13 Dec 2017 17:27:59 +0000 (18:27 +0100)]
NEWS: update NEWS again, and prepare for a release tomorrow

6 years agomeson: increase version numbers
Lennart Poettering [Mon, 11 Dec 2017 15:10:25 +0000 (16:10 +0100)]
meson: increase version numbers

6 years agoMerge pull request #7610 from poettering/stdio-nolocking
Lennart Poettering [Thu, 14 Dec 2017 15:56:36 +0000 (16:56 +0100)]
Merge pull request #7610 from poettering/stdio-nolocking

use __fsetlocking() to turn off thread locking in STDIO where applicable

6 years agohwdb: update
Zbigniew Jędrzejewski-Szmek [Thu, 14 Dec 2017 14:47:43 +0000 (15:47 +0100)]
hwdb: update

The changes in pci.ids, usb.ids, and the .hwdb files are almost always
additions. 20-OUI.hwdb drops a few names and replaces them by
"IEEE Registration Authority". I'm not sure what to do about this.
Many other removals do not seem to be removals of real entries, but
rather placeholder or generic names.

6 years agohwdb/ids_parser: use replacement chars for invalid characters
Zbigniew Jędrzejewski-Szmek [Thu, 14 Dec 2017 14:42:25 +0000 (15:42 +0100)]
hwdb/ids_parser: use replacement chars for invalid characters

We have some more non-utf8 characters. Let's just replace them, this doesn't
matter much.

6 years agomeson-hwdb-update: fix undefined variable access
Zbigniew Jędrzejewski-Szmek [Thu, 14 Dec 2017 13:36:03 +0000 (14:36 +0100)]
meson-hwdb-update: fix undefined variable access

I added the test if an optional parameter is not empty, but that doesn't work
with -u. Provide an empty "fallback" value to fix the issue.

Also group the update steps so that it's easier to see what is going on.

6 years agocore: Implement timeout based umount/remount limit
Kyle Walker [Wed, 13 Dec 2017 17:49:26 +0000 (12:49 -0500)]
core: Implement timeout based umount/remount limit

Remount, and subsequent umount, attempts can hang for inaccessible network
based mount points. This can leave a system in a hard hang state that
requires a hard reset in order to recover. This change moves the remount,
and umount attempts into separate child processes. The remount and umount
operations will block for up to 90 seconds (DEFAULT_TIMEOUT_USEC). Should
those waits fail, the parent will issue a SIGKILL to the child and continue
with the shutdown efforts.

In addition, instead of only reporting some additional errors on the final
attempt, failures are reported as they occur.

6 years agosd-bus: fix a memory leak in message_new_reply() (#7636)
Cong Wang [Thu, 14 Dec 2017 12:07:04 +0000 (04:07 -0800)]
sd-bus: fix a memory leak in message_new_reply() (#7636)

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
6 years agoMerge pull request #7606 from yuwata/run-timer
Lennart Poettering [Thu, 14 Dec 2017 12:04:30 +0000 (13:04 +0100)]
Merge pull request #7606 from yuwata/run-timer

run: allow to specify multiple timer options

6 years agocore: add EXTEND_TIMEOUT_USEC={usec} - prevent timeouts in startup/runtime/shutdown...
Daniel Black [Thu, 14 Dec 2017 11:17:43 +0000 (22:17 +1100)]
core: add EXTEND_TIMEOUT_USEC={usec} - prevent timeouts in startup/runtime/shutdown (#7214)

With Type=notify services, EXTEND_TIMEOUT_USEC= messages will delay any startup/
runtime/shutdown timeouts.

A service that hasn't timed out, i.e, start time < TimeStartSec,
runtime < RuntimeMaxSec and stop time < TimeoutStopSec, may by sending
EXTEND_TIMEOUT_USEC=, allow the service to continue beyond the limit for
the execution phase (i.e TimeStartSec, RunTimeMaxSec and TimeoutStopSec).

EXTEND_TIMEOUT_USEC= must continue to be sent (in the same way as
WATCHDOG=1) within the time interval specified to continue to reprevent
the timeout from occuring.

Watchdog timeouts are also extended if a EXTEND_TIMEOUT_USEC is greater
than the remaining time on the watchdog counter.

Fixes #5868.

6 years agobusctl: let's make use of the log_error_errno() calls
Lennart Poettering [Mon, 11 Dec 2017 19:31:36 +0000 (20:31 +0100)]
busctl: let's make use of the log_error_errno() calls

6 years agobusctl: modernize code a bit
Lennart Poettering [Mon, 11 Dec 2017 19:30:07 +0000 (20:30 +0100)]
busctl: modernize code a bit

I am puzzled why coccinelle is unwilling to detect these cases...

6 years agobasic: turn off stdio locking for a couple of helper calls
Lennart Poettering [Mon, 11 Dec 2017 19:01:55 +0000 (20:01 +0100)]
basic: turn off stdio locking for a couple of helper calls

These helper calls are potentially called often, and allocate FILE*
objects internally for a very short period of time, let's turn off
locking for them too.

6 years agotree-wide: use __fsetlocking() instead of fxyz_unlocked()
Lennart Poettering [Mon, 11 Dec 2017 18:50:30 +0000 (19:50 +0100)]
tree-wide: use __fsetlocking() instead of fxyz_unlocked()

Let's replace usage of fputc_unlocked() and friends by __fsetlocking(f,
FSETLOCKING_BYCALLER). This turns off locking for the entire FILE*,
instead of doing individual per-call decision whether to use normal
calls or _unlocked() calls.

This has various benefits:

1. It's easier to read and easier not to forget

2. It's more comprehensive, as fprintf() and friends are covered too
   (as these functions have no _unlocked() counterpart)

3. Philosophically, it's a bit more correct, because it's more a
   property of the file handle really whether we ever pass it on to another
   thread, not of the operations we then apply to it.

This patch reworks all pieces of codes that so far used fxyz_unlocked()
calls to use __fsetlocking() instead. It also reworks all places that
use open_memstream(), i.e. use stdio FILE* for string manipulations.

Note that this in some way a revert of 4b61c8751135c58be043d86b9fef4c8ec7aadf18.

6 years agoMerge pull request #7625 from thom311/th/const-strlen
Zbigniew Jędrzejewski-Szmek [Thu, 14 Dec 2017 08:41:09 +0000 (09:41 +0100)]
Merge pull request #7625 from thom311/th/const-strlen

Don't use strlen() to declare variable-length arrays

6 years agonetworkd: RouteTable option in [IPv6AcceptRA] is now properly processed (#7633)
Saran Tunyasuvunakool [Thu, 14 Dec 2017 05:11:03 +0000 (05:11 +0000)]
networkd: RouteTable option in [IPv6AcceptRA] is now properly processed (#7633)

Fixes: #7632

6 years agoresolved: fix "in-between" logic when boundaries are equal (#7590)
Lennart Poettering [Thu, 14 Dec 2017 05:08:21 +0000 (06:08 +0100)]
resolved: fix "in-between" logic when boundaries are equal (#7590)

This changes dns_name_between() to deal properly with checking whether B
is between A and C if A and C are equal. Previously we simply returned
-EINVAL in this case, refusing checking. With this change we correct
behaviour: if A and C are equal, then B is "between" both if it is
different from them. That's logical, since we do < and > comparisons, not
<= and >=, and that means that anything "right of A" and "left of C"
lies in between with wrap-around at the ends. And if A and C are equal
that means everything lies between, except for A itself.

This fixes handling of domains using NSEC3 "white lies", for example the
.it TLD.

Fixes: #7421

6 years agoMerge pull request #7618 from tiagosh/sysctl_use_read_line
Yu Watanabe [Thu, 14 Dec 2017 04:58:53 +0000 (13:58 +0900)]
Merge pull request #7618 from tiagosh/sysctl_use_read_line

Make systemd-sysctl use read_line() and LONG_LINE_MAX

6 years agoman: systemd.unit: move note about clearing lists (#7621)
Daniel Black [Thu, 14 Dec 2017 04:51:23 +0000 (15:51 +1100)]
man: systemd.unit: move note about clearing lists (#7621)

This is mainly for drop-in files.

6 years agoMerge pull request #7627 from poettering/lowercase-systemd
Yu Watanabe [Thu, 14 Dec 2017 04:44:35 +0000 (13:44 +0900)]
Merge pull request #7627 from poettering/lowercase-systemd

always spell out "systemd" in lowercase letters

6 years agosysctl: disable buffer while writing to /proc
Tiago Salem Herrmann [Tue, 12 Dec 2017 15:52:45 +0000 (13:52 -0200)]
sysctl: disable buffer while writing to /proc

fputs() writes only first 2048 bytes and fails
to write to /proc when values are larger than that.
This patch adds a new flag to WriteStringFileFlags
that make it possible to disable the buffer under
specific cases.

6 years agoUse read_line() and LONG_LINE_MAX to read values configuration files.
Tiago Salem Herrmann [Tue, 12 Dec 2017 15:43:17 +0000 (13:43 -0200)]
Use read_line() and LONG_LINE_MAX to read values configuration files.

6 years agonetworkd/dhcp: shorten overlong hostname (#7616)
Luca Bruno [Wed, 13 Dec 2017 17:00:46 +0000 (17:00 +0000)]
networkd/dhcp: shorten overlong hostname (#7616)

This commit updates networkd behavior to check if the hostname option
received via DHCP is too long for Linux limit, and in case shorten it.
An overlong hostname will be truncated to the first dot or to
`HOST_MAX_LEN`, whatever comes earlier.

6 years agocatalog: don't say "systemd" when we mean "system"
Lennart Poettering [Wed, 13 Dec 2017 16:43:03 +0000 (17:43 +0100)]
catalog: don't say "systemd" when we mean "system"

Yeah, it's hard to type "system", if all you ever type is "systemd", but
it's still a typo in this case.

6 years agoman: "systemd" is to be written in all lower-case, even at beginnings of sentences
Lennart Poettering [Wed, 13 Dec 2017 16:42:04 +0000 (17:42 +0100)]
man: "systemd" is to be written in all lower-case, even at beginnings of sentences

This very important commit is very important.

6 years agoMerge pull request #7619 from msekletar/cryptsetup-image-name
Lennart Poettering [Wed, 13 Dec 2017 15:46:57 +0000 (16:46 +0100)]
Merge pull request #7619 from msekletar/cryptsetup-image-name

cryptsetup: when unlocking always put path to the object into Id

6 years agotest: add CLI smoke tests for `--network-namespace-path` of nspawn
Dongsu Park [Sat, 25 Nov 2017 18:39:37 +0000 (19:39 +0100)]
test: add CLI smoke tests for `--network-namespace-path` of nspawn

Since the new option `--network-namespace-path=` of systemd-nspawn
cannot be used together with other network-related options, we need
to add more smoke tests for checking these conditions of options.

6 years agonspawn: introduce an option for specifying network namespace path
Dongsu Park [Fri, 24 Nov 2017 17:22:17 +0000 (18:22 +0100)]
nspawn: introduce an option for specifying network namespace path

Add a new option `--network-namespace-path` to systemd-nspawn to allow
users to specify an arbitrary network namespace, e.g. `/run/netns/foo`.
Then systemd-nspawn will open the netns file, pass the fd to
outer_child, and enter the namespace represented by the fd before
running inner_child.

```
$ sudo ip netns add foo
$ mount | grep /run/netns/foo
nsfs on /run/netns/foo type nsfs (rw)
...
$ sudo systemd-nspawn -D /srv/fc27 --network-namespace-path=/run/netns/foo \
  /bin/readlink -f /proc/self/ns/net
/proc/1/ns/net:[4026532009]
```

Note that the option `--network-namespace-path=` cannot be used together
with other network-related options such as `--private-network` so that
the options do not conflict with each other.

Fixes https://github.com/systemd/systemd/issues/7361

6 years agotree-wide: use STRLEN() to allocate buffer of constant size
Thomas Haller [Wed, 13 Dec 2017 07:41:11 +0000 (08:41 +0100)]
tree-wide: use STRLEN() to allocate buffer of constant size

Using strlen() to declare a buffer results in a variable-length array,
even if the compiler likely optimizes it to be a compile time constant.

When building with -Wvla, certain versions of gcc complain about such
buffers. Compiling with -Wvla has the advantage of preventing variably
length array, which defeat static asserts that are implemented by
declaring an array of negative length.

6 years agobasic/macros: add STRLEN() to get length of string literal as constant expression
Thomas Haller [Wed, 13 Dec 2017 07:17:07 +0000 (08:17 +0100)]
basic/macros: add STRLEN() to get length of string literal as constant expression

While the compiler likely optimizes strlen(x) for string literals,
it is not a constant expression.

Hence,

  char buffer[strlen("OPTION_000") + 1];

declares a variable-length array. STRLEN() can be used instead
when a constant espression is needed.

It's not entirely identical to strlen(), as STRLEN("a\0") counts 2.
Also, it only works with string literals and the macro enforces
that the argument is a literal.

6 years agonetworkd: don't try to configure IPv6 proxy NDP if IPv6 is not available (#7613)
Lennart Poettering [Wed, 13 Dec 2017 04:47:10 +0000 (05:47 +0100)]
networkd: don't try to configure IPv6 proxy NDP if IPv6 is not available (#7613)

Fixes: #7612

6 years agoMerge pull request #7588 from poettering/resolve-route-tweak
Yu Watanabe [Wed, 13 Dec 2017 04:43:55 +0000 (13:43 +0900)]
Merge pull request #7588 from poettering/resolve-route-tweak

resolved domain routing tweaks and /etc/resolv.conf handling improvements

6 years agoMerge pull request #7569 from keszybz/doc-reverse-settings
Yu Watanabe [Wed, 13 Dec 2017 04:42:19 +0000 (13:42 +0900)]
Merge pull request #7569 from keszybz/doc-reverse-settings

Document reverse settings

6 years agoMerge pull request #7591 from poettering/retry-on-servfail
Zbigniew Jędrzejewski-Szmek [Tue, 12 Dec 2017 21:22:06 +0000 (22:22 +0100)]
Merge pull request #7591 from poettering/retry-on-servfail

resolved: retry with a different server on SERVFAIL

6 years agoMerge pull request #7611 from poettering/bootspec-fixes
Zbigniew Jędrzejewski-Szmek [Tue, 12 Dec 2017 21:16:34 +0000 (22:16 +0100)]
Merge pull request #7611 from poettering/bootspec-fixes

minor fixes to bootctl.c/bootspec.c to make sure the tool works cleanly on my system

6 years agoMerge pull request #7608 from poettering/more-news-v236
Zbigniew Jędrzejewski-Szmek [Tue, 12 Dec 2017 20:11:31 +0000 (21:11 +0100)]
Merge pull request #7608 from poettering/more-news-v236

6 years agocryptsetup: use more descriptive name for the variable and drop redundant function
Michal Sekletar [Tue, 12 Dec 2017 19:00:31 +0000 (20:00 +0100)]
cryptsetup: use more descriptive name for the variable and drop redundant function

Let's rename escaped_name to disk_path since this is an actual content
that pointer refers to. It is either path to encrypted block device
or path to encrypted image file.

Also drop redundant function disk_major_minor(). src is always set, and
it always points to either encrypted block device path (or symlink to
such device) or to encrypted image. In case it is set to device path
there is no need to reset it to /dev/block/major:minor symlink since
those paths are equivalent.

6 years agomeson: link NSS modules with -z nodelete (#7607)
Lennart Poettering [Tue, 12 Dec 2017 19:13:16 +0000 (20:13 +0100)]
meson: link NSS modules with -z nodelete (#7607)

We might end up allocating mempools, and when we are unloaded we might
orphan them, thus leaking them. Hence, let's just stick around for good,
so the mempools remain referenced continously and for good, and thus no
memory is leaked (though the memory isn't cleaned up either).

Fixes: #7596

6 years agocryptsetup: when unlocking always put path to the object into Id
Michal Sekletar [Tue, 12 Dec 2017 16:49:14 +0000 (17:49 +0100)]
cryptsetup: when unlocking always put path to the object into Id

Some ask-password agents (e.g. clevis-luks-askpass) use Id option from
/run/systemd/ask-password/ask* file in order to obtain the password for
the device.

Id option should be in the following format,
e.g. Id=subsystem:data. Where data part is supposed to identify object
that ask-password query is done for. Since
e51b9486d1b59e72c293028fed1384f4e4ef09aa this field has format
Id=cryptsetup:/dev/block/major:minor when systemd-cryptsetup is
unlocking encrypted block device. However, crypttab also supports
encrypted image files in which case we usually set data part of Id to
"vol on mountpoint". This is unexpected and actually breaks network
based device encryption as implemented by clevis.

Example:
$ cat /etc/crypttab
clevis-unlocked /clevis-test-disk-image none luks,_netdev
$ systemctl start 'systemd-cryptsetup@clevis\x2dunlocked.service'
$ grep Id /run/systemd/ask-password/ask*

Before:
$ Id=cryptsetup:clevis-unlocked on /clevis-test-disk-image-mnt

After:
$ Id=cryptsetup:/clevis-test-disk-image

6 years agoresolve: add support for RFC 8080 (#7600)
ott [Tue, 12 Dec 2017 15:30:12 +0000 (16:30 +0100)]
resolve: add support for RFC 8080 (#7600)

RFC 8080 describes how to use EdDSA keys and signatures in DNSSEC. It
uses the curves Ed25519 and Ed448. Libgcrypt 1.8.1 does not support
Ed448, so only the Ed25519 is supported at the moment. Once Libgcrypt
supports Ed448, support for it can be trivially added to resolve.

6 years agonetworkd: Fix race condition in [RoutingPolicyRule] handling (#7615)
Saran Tunyasuvunakool [Tue, 12 Dec 2017 15:25:36 +0000 (15:25 +0000)]
networkd: Fix race condition in [RoutingPolicyRule] handling (#7615)

The routing policy rule setup logic is moved to the routes setup phase (rather than the addresses setup phase as it is now). Additionally, a call to `link_check_ready` is added to the routing policy rules setup handler. This prevents a race condition with the routes setup handler.

Also give each async handler its own message counter to prevent race conditions when logging successes.

Fixes: #7614

6 years agoresolved: try a different server if server is too dumb to do DNSSEC
Lennart Poettering [Fri, 8 Dec 2017 19:11:36 +0000 (20:11 +0100)]
resolved: try a different server if server is too dumb to do DNSSEC

If we are in strict DNSSEC mode it's worthy to try a different DNS
server before accepting that DNSSEC is not actually supported.

Fixes: #7040

6 years agoresolved: cast dns_scope_get_dns_server() to NULL when we ignore it
Lennart Poettering [Fri, 8 Dec 2017 18:50:51 +0000 (19:50 +0100)]
resolved: cast dns_scope_get_dns_server() to NULL when we ignore it

6 years agoresolved: when a server consistently returns SERVFAIL, try another one
Lennart Poettering [Fri, 8 Dec 2017 18:48:15 +0000 (19:48 +0100)]
resolved: when a server consistently returns SERVFAIL, try another one

Currently, we accept SERVFAIL after downgrading fully, cache it and move
on. Let's extend this a bit: after downgrading fully, if the SERVFAIL
logic continues to be an issue, then use a different DNS server if there
are any.

Fixes: #7147

6 years agoverbs: add a new VERB_MUSTBEROOT flag
Lennart Poettering [Mon, 11 Dec 2017 22:10:11 +0000 (23:10 +0100)]
verbs: add a new VERB_MUSTBEROOT flag

Given that we regularly have verbs that require privileges, let's just
make this a flag of the verb.

6 years agotree-wide: unify logging of "Must be root" message
Lennart Poettering [Mon, 11 Dec 2017 22:00:57 +0000 (23:00 +0100)]
tree-wide: unify logging of "Must be root" message

Let's unify this in one call, generalizing must_be_root() from
bootctl.c.

6 years agobootspec: sprinkle some argument assert()s all over the place
Lennart Poettering [Mon, 11 Dec 2017 21:22:04 +0000 (22:22 +0100)]
bootspec: sprinkle some argument assert()s all over the place

The previous commit fixed a NULL parameter issue, let's check for such,
to make it easier to find issues like this.

6 years agobootctl: don't trip up in "bootctl status" when we can't find the ESP because of...
Lennart Poettering [Mon, 11 Dec 2017 21:15:03 +0000 (22:15 +0100)]
bootctl: don't trip up in "bootctl status" when we can't find the ESP because of lack of privilges

On my system the boot and EFI partitions are protected, hence "bootctl
status" can't find the ESP, and then the tool continues with arg_path ==
NULL, which it really should not. Handle these cases, and simply
suppress all output that needs arg_path.