platform/upstream/systemd.git
8 years agoRevert "do not pass-along the environment from the kernel or initrd"
Franck Bui [Mon, 20 Jun 2016 16:54:21 +0000 (18:54 +0200)]
Revert "do not pass-along the environment from the kernel or initrd"

This reverts commit ce8aba568156f2b9d0d3b023e960cda3d9d7db81.

We should pass an environment as close as possible to what we originally
got.

8 years agopid1: reconnect to the console before being re-executed
Franck Bui [Mon, 13 Jun 2016 14:10:06 +0000 (16:10 +0200)]
pid1: reconnect to the console before being re-executed

When re-executed, reconnect the console to PID1's stdios as it was the case
when PID1 was initially started by the kernel.

8 years agocore/execute: pass env vars to PAM session setup (#3503)
Jouke Witteveen [Mon, 13 Jun 2016 10:50:12 +0000 (12:50 +0200)]
core/execute: pass env vars to PAM session setup (#3503)

Move the merger of environment variables before setting up the PAM
session and pass the aggregate environment to PAM setup. This allows
control over the PAM session hooks through environment variables.

PAM session initiation may update the environment. On successful
initiation of a PAM session, we adopt the environment of the
PAM context.

8 years agosystemctl: disallow systemctl --user reboot (#3519)
Zbigniew Jędrzejewski-Szmek [Mon, 13 Jun 2016 04:57:28 +0000 (00:57 -0400)]
systemctl: disallow systemctl --user reboot (#3519)

... as well as halt/poweroff/kexec/suspend/hibernate/hybrid-sleep.
Running those commands will fail in user mode, but we try to set the wall
message first, which might even succeed for privileged users. Best to nip
the whole sequence in the bud.

https://github.com/systemd/systemd/pull/3453#issuecomment-225455156

8 years agoutil-lib: drop trailing non-printable characters from cmdline (#3512)
Max Prokhorov [Mon, 13 Jun 2016 01:13:42 +0000 (04:13 +0300)]
util-lib: drop trailing non-printable characters from cmdline (#3512)

If max_length is equal or greater than cmdline length all trailing non-printable
characters are dropped. If max_length is 0 it should do the same.

This should also fix cmdline truncation if the last character is not '\0'.

Fixes #3469.

8 years agohwdb: change the Logitech MX500 to 1100 dpi (#3517)
Peter Hutterer [Mon, 13 Jun 2016 00:52:48 +0000 (10:52 +1000)]
hwdb: change the Logitech MX500 to 1100 dpi (#3517)

https://bugs.freedesktop.org/show_bug.cgi?id=96225
and specifically the tech specs here:
http://support.logitech.com/en_us/product/corded-mouse-m500

8 years agoMerge pull request #3502 from poettering/resolved-flush-cache
Zbigniew Jędrzejewski-Szmek [Sun, 12 Jun 2016 22:28:30 +0000 (18:28 -0400)]
Merge pull request #3502 from poettering/resolved-flush-cache

resolved: allow clients request cache flushes

8 years agoMerge pull request #3453 from poettering/fix-3353
Zbigniew Jędrzejewski-Szmek [Sun, 12 Jun 2016 19:21:22 +0000 (15:21 -0400)]
Merge pull request #3453 from poettering/fix-3353

Fixes #3353.

8 years agonetworkd: more vlan cleanup (#3506)
Tobias Jungel [Sun, 12 Jun 2016 18:01:14 +0000 (20:01 +0200)]
networkd: more vlan cleanup (#3506)

use config_parse_vlanid to parse vlan for BridgeFDB entries

8 years agonetworkd: cleanup of bridge vlan code (#3505)
Tobias Jungel [Sun, 12 Jun 2016 17:59:21 +0000 (19:59 +0200)]
networkd: cleanup of bridge vlan code (#3505)

cleanup minor nitpicks mentioned in #3428

8 years agoFixed a small typo in a comment (#3514)
Alex Gaynor [Sun, 12 Jun 2016 14:42:13 +0000 (10:42 -0400)]
Fixed a small typo in a comment (#3514)

8 years agoresolved: move verification that link is unmanaged into the proper bus calls
Lennart Poettering [Fri, 10 Jun 2016 18:54:10 +0000 (20:54 +0200)]
resolved: move verification that link is unmanaged into the proper bus calls

Previously, we checked only for the various SetLinkXYZ() calls on the Manager
object exposed on the bus if the specified interface is managed/unmanaged by
networkd (as we don't permit overriding DNS configuration via bus calls if
networkd owns the device), but the equivalent SetXYZ() calls on the Link object
did not have such a check. Fix that by moving the appropriate check into the
latter, as the former just calls that anyway.

8 years agoresolved: also add a way to flush all caches via the bus
Lennart Poettering [Fri, 10 Jun 2016 18:40:30 +0000 (20:40 +0200)]
resolved: also add a way to flush all caches via the bus

And expose it in "resolve-tool --flush-caches".

8 years agoman: document what SIGUSR1 and SIGUSR2 do to resolved
Lennart Poettering [Fri, 10 Jun 2016 18:29:32 +0000 (20:29 +0200)]
man: document what SIGUSR1 and SIGUSR2 do to resolved

8 years agoresolved: flush all caches if SIGUSR2 is received
Lennart Poettering [Fri, 10 Jun 2016 18:23:49 +0000 (20:23 +0200)]
resolved: flush all caches if SIGUSR2 is received

8 years agonetworkd: fix bad memory access for routes that are note attached to a link yet ...
Lennart Poettering [Fri, 10 Jun 2016 21:26:24 +0000 (23:26 +0200)]
networkd: fix bad memory access for routes that are note attached to a link yet (#3499)

Corrects: 1b566071

Also see: https://github.com/systemd/systemd/pull/3478#issuecomment-225008542

8 years agoupdate TODO
Lennart Poettering [Fri, 10 Jun 2016 18:04:53 +0000 (20:04 +0200)]
update TODO

8 years agosystemctl: prolong timeout of "systemctl daemon-reload"
Lennart Poettering [Mon, 6 Jun 2016 19:48:08 +0000 (21:48 +0200)]
systemctl: prolong timeout of "systemctl daemon-reload"

Reloading or reexecuting PID 1 means the unit generators are rerun, which are
timed out at 90s. Make sure the method call asking for the reload is timed out
at twice that, so that the generators have 90s and the reload operation has 90s
too.

This reworks the daemon_reload() call in systemctl, and makes it exclusively
about reloading/reexecing. Previously it was used for other trivial method
calls too, which didn't really help readability. As the code paths are now
sufficiently different, split out the old code into a new function
trivial_method().

This call also does a similar change as
c8ad4efb277c3235d58789170af11bb3c847d655 but for the reload/reexec operation.

Fixes: #3353

8 years agosystemctl: don't suppress error code when handling legacy commands
Lennart Poettering [Mon, 6 Jun 2016 19:45:12 +0000 (21:45 +0200)]
systemctl: don't suppress error code when handling legacy commands

For legacy commands such as /sbin/halt or /sbin/poweroff we support legacy
fallbacks that talk via traditional SysV way with PID 1 to issue the desired
operation. We do this on any kind of error if the primary method of operation
fails. When this is the case we suppress any error message that is normally
generated, in order to not confuse the user. When suppressing this log message,
don't suppress the original error code, because there's really no reason to.

8 years agocore: disable colors when displaying cylon when systemd.log_color=off (#3495)
Franck Bui [Fri, 10 Jun 2016 16:33:15 +0000 (18:33 +0200)]
core: disable colors when displaying cylon when systemd.log_color=off (#3495)

8 years agoupdate TODO
Lennart Poettering [Fri, 10 Jun 2016 16:21:05 +0000 (18:21 +0200)]
update TODO

8 years agocore/execute: add the magic character '!' to allow privileged execution (#3493)
Alessandro Puccetti [Fri, 10 Jun 2016 16:19:54 +0000 (18:19 +0200)]
core/execute: add the magic character '!' to allow privileged execution (#3493)

This patch implements the new magic character '!'. By putting '!' in front
of a command, systemd executes it with full privileges ignoring paramters
such as User, Group, SupplementaryGroups, CapabilityBoundingSet,
AmbientCapabilities, SecureBits, SystemCallFilter, SELinuxContext,
AppArmorProfile, SmackProcessLabel, and RestrictAddressFamilies.

Fixes partially https://github.com/systemd/systemd/issues/3414
Related to https://github.com/coreos/rkt/issues/2482

Testing:
1. Create a user 'bob'
2. Create the unit file /etc/systemd/system/exec-perm.service
   (You can use the example below)
3. sudo systemctl start ext-perm.service
4. Verify that the commands starting with '!' were not executed as bob,
   4.1 Looking to the output of ls -l /tmp/exec-perm
   4.2 Each file contains the result of the id command.

`````````````````````````````````````````````````````````````````
[Unit]
Description=ext-perm

[Service]
Type=oneshot
TimeoutStartSec=0
User=bob
ExecStartPre=!/usr/bin/sh -c "/usr/bin/rm /tmp/exec-perm*" ;
    /usr/bin/sh -c "/usr/bin/id > /tmp/exec-perm-start-pre"
ExecStart=/usr/bin/sh -c "/usr/bin/id > /tmp/exec-perm-start" ;
    !/usr/bin/sh -c "/usr/bin/id > /tmp/exec-perm-star-2"
ExecStartPost=/usr/bin/sh -c "/usr/bin/id > /tmp/exec-perm-start-post"
ExecReload=/usr/bin/sh -c "/usr/bin/id > /tmp/exec-perm-reload"
ExecStop=!/usr/bin/sh -c "/usr/bin/id > /tmp/exec-perm-stop"
ExecStopPost=/usr/bin/sh -c "/usr/bin/id > /tmp/exec-perm-stop-post"

[Install]
WantedBy=multi-user.target]
`````````````````````````````````````````````````````````````````

8 years agorules: block - add scm block devices to whitelist (#3494)
Lennart Poettering [Fri, 10 Jun 2016 13:19:26 +0000 (15:19 +0200)]
rules: block - add scm block devices to whitelist (#3494)

Since the introduction of the whitelist in 60-persistent-storage.rules
block device symlinks are no longer created for scm block devices.

Add scm to the whitelist.

Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
8 years agonspawn: introduce --notify-ready=[no|yes] (#3474)
Alessandro Puccetti [Fri, 10 Jun 2016 11:09:06 +0000 (13:09 +0200)]
nspawn: introduce --notify-ready=[no|yes] (#3474)

This the patch implements a notificaiton mechanism from the init process
in the container to systemd-nspawn.
The switch --notify-ready=yes configures systemd-nspawn to wait the "READY=1"
message from the init process in the container to send its own to systemd.
--notify-ready=no is equivalent to the previous behavior before this patch,
systemd-nspawn notifies systemd with a "READY=1" message when the container is
created. This notificaiton mechanism uses socket file with path relative to the contanier
"/run/systemd/nspawn/notify". The default values it --notify-ready=no.
It is also possible to configure this mechanism from the .nspawn files using
NotifyReady. This parameter takes the same options of the command line switch.

Before this patch, systemd-nspawn notifies "ready" after the inner child was created,
regardless the status of the service running inside it. Now, with --notify-ready=yes,
systemd-nspawn notifies when the service is ready. This is really useful when
there are dependencies between different contaniers.

Fixes https://github.com/systemd/systemd/issues/1369
Based on the work from https://github.com/systemd/systemd/pull/3022

Testing:
Boot a OS inside a container with systemd-nspawn.
Note: modify the commands accordingly with your filesystem.

1. Create a filesystem where you can boot an OS.
2. sudo systemd-nspawn -D ${HOME}/distros/fedora-23/ sh
2.1. Create the unit file /etc/systemd/system/sleep.service inside the container
     (You can use the example below)
2.2. systemdctl enable sleep
2.3 exit
3. sudo systemd-run --service-type=notify --unit=notify-test
   ${HOME}/systemd/systemd-nspawn --notify-ready=yes
   -D ${HOME}/distros/fedora-23/ -b
4. In a different shell run "systemctl status notify-test"

When using --notify-ready=yes the service status is "activating" for 20 seconds
before being set to "active (running)". Instead, using --notify-ready=no
the service status is marked "active (running)" quickly, without waiting for
the 20 seconds.

This patch was also test with --private-users=yes, you can test it just adding it
at the end of the command at point 3.

------ sleep.service ------
[Unit]
Description=sleep
After=network.target

[Service]
Type=oneshot
ExecStart=/bin/sleep 20

[Install]
WantedBy=multi-user.target
------------ end ------------

8 years agoMerge pull request #3428 from toanju/networkd/brvlan
Lennart Poettering [Fri, 10 Jun 2016 11:04:44 +0000 (13:04 +0200)]
Merge pull request #3428 from toanju/networkd/brvlan

networkd: add support to configure VLAN on bridge ports

8 years agol10n: update belarusian translation (#3482)
Viktar Vaŭčkievič [Fri, 10 Jun 2016 10:36:10 +0000 (13:36 +0300)]
l10n: update belarusian translation (#3482)

8 years agonetworkd: fix dbus matchmac interface (#3485)
Andrew Jeddeloh [Fri, 10 Jun 2016 10:35:43 +0000 (03:35 -0700)]
networkd: fix dbus matchmac interface (#3485)

Fix issue where the *Network passed via userdata is being offset
by offsetof(Network, matchmac) leading to incorrect values being
exposed in dbus.

8 years agonetworkd: add support to configure VLAN on bridge ports
Tobias Jungel [Wed, 1 Jun 2016 13:18:21 +0000 (15:18 +0200)]
networkd: add support to configure VLAN on bridge ports

8 years agonetworkd-link: parse linkinfo to get kind
Tobias Jungel [Thu, 9 Jun 2016 11:44:31 +0000 (13:44 +0200)]
networkd-link: parse linkinfo to get kind

8 years agoMerge pull request #3456 from poettering/ipv6-ra-rename
Tom Gundersen [Thu, 9 Jun 2016 19:28:40 +0000 (21:28 +0200)]
Merge pull request #3456 from poettering/ipv6-ra-rename

networkd: rename IPv6AcceptRouterAdvertisements to IPv6AcceptRA

8 years agonetworkd: clean up vlan handling a bit (#3478)
Lennart Poettering [Thu, 9 Jun 2016 16:55:16 +0000 (18:55 +0200)]
networkd: clean up vlan handling a bit (#3478)

Let's add a generic parser for VLAN ids, which should become handy as
preparation for PR #3428. Let's also make sure we use uint16_t for the vlan ID
type everywhere, and that validity checks are already applied at the time of
parsing, and not only whne we about to prepare a netdev.

Also, establish a common definition VLANID_INVALID we can use for
non-initialized VLAN id fields.

8 years agoUpdated Turkish translation (#3477)
Muhammet Kara [Thu, 9 Jun 2016 15:43:18 +0000 (18:43 +0300)]
Updated Turkish translation (#3477)

8 years agobus_util: add support to map double (#3479)
Susant Sahani [Thu, 9 Jun 2016 15:41:35 +0000 (21:11 +0530)]
bus_util: add support to map double (#3479)

Now we don't support parsing double at map_basic.
when trying to  use bus_message_map_all_properties with a double
this fails. Let's add it.

8 years agoudev-builtin-blkid: fix GPT_FLAG_NO_AUTO check for ESP (#3450)
Lennart Poettering [Thu, 9 Jun 2016 08:51:20 +0000 (10:51 +0200)]
udev-builtin-blkid: fix GPT_FLAG_NO_AUTO check for ESP (#3450)

The flags check was accidentally placed in the ESP if block, but should be in
the root if block.

This corrects: 0238d4c660e732dd03ba0cdb54a29ec5870ee849

Fixes: #3440

Also see: #3441

8 years agoload-fragment: don't try to do a template instance replacement if we are not an insta...
Lennart Poettering [Thu, 9 Jun 2016 08:49:36 +0000 (10:49 +0200)]
load-fragment: don't try to do a template instance replacement if we are not an instance (#3451)

Corrects: 7aad67e7

Fixes: #3438

8 years agoMerge pull request #3432 from poettering/resolved-ll-ipv6
Martin Pitt [Thu, 9 Jun 2016 08:18:07 +0000 (10:18 +0200)]
Merge pull request #3432 from poettering/resolved-ll-ipv6

resolved: support IPv6 DNS servers on the local link

8 years agoexecute: check whether the specified fd is a tty before chowning/chmoding it (#3457)
Lennart Poettering [Thu, 9 Jun 2016 08:01:16 +0000 (10:01 +0200)]
execute: check whether the specified fd is a tty before chowning/chmoding  it (#3457)

Let's add an extra safety check before we chmod/chown a TTY to the right user,
as we might end up having connected something to STDIN/STDOUT that is actually
not a TTY, even though this might have been requested, due to permissive
StandardInput= settings or transient service activation with fds passed in.

Fixes:

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

8 years agoUpdate spanish po file (#3463)
Pablo Lezaeta Reyes [pˈaβ̞lo lˌe̞θaˈeta rˈejɛ] [Thu, 9 Jun 2016 07:38:17 +0000 (04:38 -0300)]
Update spanish po file (#3463)

8 years agounits: add a basic SystemCallFilter (#3471)
Topi Miettinen [Thu, 9 Jun 2016 07:32:04 +0000 (07:32 +0000)]
units: add a basic SystemCallFilter (#3471)

Add a line
SystemCallFilter=~@clock @module @mount @obsolete @raw-io ptrace
for daemons shipped by systemd. As an exception, systemd-timesyncd
needs @clock system calls and systemd-localed is not privileged.
ptrace(2) is blocked to prevent seccomp escapes.

8 years agoMerge pull request #3431 from poettering/network-fixes
Tom Gundersen [Wed, 8 Jun 2016 21:10:16 +0000 (23:10 +0200)]
Merge pull request #3431 from poettering/network-fixes

put limits on addresses and routers per link and per network

8 years agoMerge pull request #3470 from fbuihuu/logind-fix-ignore-inhibit
Lennart Poettering [Wed, 8 Jun 2016 18:38:55 +0000 (20:38 +0200)]
Merge pull request #3470 from fbuihuu/logind-fix-ignore-inhibit

Logind: fix handling of *KeyIgnoreInhibited options in logind.conf

8 years agologind: minor cleanup and use IN_SET() in manager_handle_action()
Franck Bui [Wed, 8 Jun 2016 16:16:42 +0000 (18:16 +0200)]
logind: minor cleanup and use IN_SET() in manager_handle_action()

8 years agologind: really handle *KeyIgnoreInhibited options in logind.conf
Franck Bui [Wed, 8 Jun 2016 16:08:56 +0000 (18:08 +0200)]
logind: really handle *KeyIgnoreInhibited options in logind.conf

8 years agounits: enable MemoryDenyWriteExecute (#3459)
Topi Miettinen [Wed, 8 Jun 2016 12:23:37 +0000 (12:23 +0000)]
units: enable MemoryDenyWriteExecute (#3459)

Secure daemons shipped by systemd by enabling MemoryDenyWriteExecute.

Closes: #3459

8 years agosysv-generator: remove more dead code (#3462)
Lennart Poettering [Wed, 8 Jun 2016 08:18:56 +0000 (10:18 +0200)]
sysv-generator: remove more dead code (#3462)

The changes in 788d2b088b13a2444b9eb2ea82c0cc57d9f0980f weren't complete, only
half the code that dealt with K links was removed. This is a follow-up patch
that removes the rest too.

No functional changes.

8 years agohwdb: selinuxify a bit (#3460)
Evgeny Vereshchagin [Tue, 7 Jun 2016 17:47:41 +0000 (20:47 +0300)]
hwdb: selinuxify a bit (#3460)

-bash-4.3# rm /etc/udev/hwdb.bin
-bash-4.3# systemd-hwdb update
-bash-4.3# ls -Z /etc/udev/hwdb.bin
system_u:object_r:systemd_hwdb_etc_t:s0 /etc/udev/hwdb.bin

Fixes: #3458

8 years agonetworkd: rename IPv6AcceptRouterAdvertisements to IPv6AcceptRA
Lennart Poettering [Tue, 7 Jun 2016 09:19:26 +0000 (11:19 +0200)]
networkd: rename IPv6AcceptRouterAdvertisements to IPv6AcceptRA

The long name is just too hard to type. We generally should avoid using
acronyms too liberally, if they aren't established enough, but it appears that
"RA" is known well enough. Internally we call the option "ipv6_accept_ra"
anyway, and the kernel also exposes it under this name. Hence, let's rename the
IPv6AcceptRouterAdvertisements= setting and the
[IPv6AcceptRouterAdvertisements] section to IPv6AcceptRA= and [IPv6AcceptRA].

The old setting IPv6AcceptRouterAdvertisements= is kept for compatibility with
older configuration. (However the section [IPv6AcceptRouterAdvertisements] is
not, as it was never available in a published version of systemd.

8 years agoMerge pull request #3394 from poettering/triple-tstamp
Lennart Poettering [Tue, 7 Jun 2016 09:13:39 +0000 (11:13 +0200)]
Merge pull request #3394 from poettering/triple-tstamp

timestamping improvements and IPv6 RA revamp

8 years agosd-netlink: fix deep recursion in message destruction (#3455)
David Herrmann [Tue, 7 Jun 2016 08:38:33 +0000 (10:38 +0200)]
sd-netlink: fix deep recursion in message destruction (#3455)

On larger systems we might very well see messages with thousands of parts.
When we free them, we must avoid recursing into each part, otherwise we
very likely get stack overflows.

Fix sd_netlink_message_unref() to use an iterative approach rather than
recursion (also avoid tail-recursion in case it is not optimized by the
compiler).

8 years agofstab-generator: don't process root= if it happens to be "gpt-auto" (#3452)
Lennart Poettering [Tue, 7 Jun 2016 08:23:20 +0000 (10:23 +0200)]
fstab-generator: don't process root= if it happens to be "gpt-auto" (#3452)

As that's handled by "gpt-auto-generator".

Fixes: #3404

8 years agoos-release: Add VERSION_CODENAME field (#3445)
Benjamin Drung [Mon, 6 Jun 2016 20:05:29 +0000 (22:05 +0200)]
os-release: Add VERSION_CODENAME field (#3445)

Debian and their derivatives (Ubuntu, Trisquel, etc.) use a code name
for their repositories. Thus record the code name in os-release for
processing.

Closes systemd/systemd#3429

8 years agocgtop: minimize aux variable scope
Lennart Poettering [Mon, 6 Jun 2016 20:04:33 +0000 (22:04 +0200)]
cgtop: minimize aux variable scope

8 years agocore: add minor comment
Lennart Poettering [Mon, 6 Jun 2016 20:03:31 +0000 (22:03 +0200)]
core: add minor comment

Let's explain #3444 briefly in the sources, too.

8 years agomount: make sure got into MOUNT_DEAD state after a successful umount (#3444)
michaelolbrich [Mon, 6 Jun 2016 19:59:51 +0000 (21:59 +0200)]
mount: make sure got into MOUNT_DEAD state after a successful umount (#3444)

Without this code the following can happen:
1. Open a file to keep a mount busy
2. Try to stop the corresponding mount unit with systemctl
   -> umount fails and the failure is remembered in mount->result
3. Close the file and umount the filesystem manually
   -> mount_dispatch_io() calls "mount_enter_dead(mount, MOUNT_SUCCESS)"
   -> Old error in mount->result is reused and the mount unit enters a
      failed state

Clear the old error result when 'mountinfo' reports a successful umount to
fix this.

8 years agonetwork: beef up ipv6 RA support considerably
Lennart Poettering [Thu, 2 Jun 2016 18:38:12 +0000 (20:38 +0200)]
network: beef up ipv6 RA support considerably

This reworks sd-ndisc and networkd substantially to support IPv6 RA much more
comprehensively. Since the API is extended quite a bit networkd has been ported
over too, and the patch is not as straight-forward as one could wish. The
rework includes:

- Support for DNSSL, RDNSS and RA routing options in sd-ndisc and networkd. Two
  new configuration options have been added to networkd to make this
  configurable.

- sd-ndisc now exposes an sd_ndisc_router object that encapsulates a full RA
  message, and has direct, friendly acessor functions for the singleton RA
  properties, as well as an iterative interface to iterate through known and
  unsupported options. The router object may either be retrieved from the wire,
  or generated from raw data. In many ways the sd-ndisc API now matches the
  sd-lldp API, except that no implicit database of seen data is kept. (Note
  that sd-ndisc actually had a half-written, but unused implementaiton of such
  a store, which is removed now.)

- sd-ndisc will now collect the reception timestamps of RA, which is useful to
  make sd_ndisc_router fully descriptive of what it covers.

Fixes: #1079

8 years agonetwork: use inet_ntop() rather than SD_NDISC_ADDRESS_FORMAT_VAL() when serializing
Lennart Poettering [Thu, 2 Jun 2016 18:35:13 +0000 (20:35 +0200)]
network: use inet_ntop() rather than SD_NDISC_ADDRESS_FORMAT_VAL() when serializing

Let's use the usual libc API for serializing IPv6 addresses, instead of the
NDISC-specific macro we should get rid of anyway.

8 years agoutil: make it easier to check whether in_addr or in6_addr addresses are NULL
Lennart Poettering [Thu, 2 Jun 2016 18:34:21 +0000 (20:34 +0200)]
util: make it easier to check whether in_addr or in6_addr addresses are NULL

8 years agoutil-lib: add accessors for unaligned native endian words
Lennart Poettering [Thu, 2 Jun 2016 16:12:16 +0000 (18:12 +0200)]
util-lib: add accessors for unaligned native endian words

8 years agoexit-status: update comments a bit
Lennart Poettering [Thu, 2 Jun 2016 15:56:59 +0000 (17:56 +0200)]
exit-status: update comments a bit

8 years agolldp: include sys/types.h in sd-lldp.h
Lennart Poettering [Thu, 2 Jun 2016 15:52:58 +0000 (17:52 +0200)]
lldp: include sys/types.h in sd-lldp.h

After all, we use clockid_t which is defined there.

8 years agolldp: minor coding style improvement
Lennart Poettering [Thu, 2 Jun 2016 15:52:32 +0000 (17:52 +0200)]
lldp: minor coding style improvement

8 years agolldp: add sd_lldp_get_event() call
Lennart Poettering [Thu, 2 Jun 2016 15:51:56 +0000 (17:51 +0200)]
lldp: add sd_lldp_get_event() call

sd-ndisc has something like this, let's add this for sd-lldp, too.

8 years agolldp: deal properly with recv() returning EAGAIN/EINTR
Lennart Poettering [Thu, 2 Jun 2016 15:50:40 +0000 (17:50 +0200)]
lldp: deal properly with recv() returning EAGAIN/EINTR

It might very well return EAGAIN in case of packet checksum problems and
suchlike, hence let's better handle this nicely, the same way as we do it in
the other sd-network libraries for incoming datagrams.

8 years agolldp: pass correct neighbor object to REMOVED callback
Lennart Poettering [Thu, 2 Jun 2016 15:50:21 +0000 (17:50 +0200)]
lldp: pass correct neighbor object to REMOVED callback

8 years agolldp: rename TLV accessor pseudo-macros
Lennart Poettering [Thu, 2 Jun 2016 15:49:28 +0000 (17:49 +0200)]
lldp: rename TLV accessor pseudo-macros

Let's make sure the inline functions for retrieving TLV data actually carry TLV
in the name, so that we don#t assume they retrieve the whole, raw packet data.

8 years agolldp: make sd_lldp_neighbor_tlv_rewind() return whether there's a first entry
Lennart Poettering [Thu, 2 Jun 2016 15:48:31 +0000 (17:48 +0200)]
lldp: make sd_lldp_neighbor_tlv_rewind() return whether there's a first entry

This way it's nicer to use as it matches how sd_lldp_neighbor_tlv_next()
indicates an EOF too via its return value.

8 years agolldp: use NULL instead 0, when we deal with a pointer
Lennart Poettering [Thu, 2 Jun 2016 15:48:05 +0000 (17:48 +0200)]
lldp: use NULL instead 0, when we deal with a pointer

8 years agolldp: add _public_ to a two exported functions missing it
Lennart Poettering [Thu, 2 Jun 2016 15:47:35 +0000 (17:47 +0200)]
lldp: add _public_ to a two exported functions missing it

8 years agolldp: clarify that sd_lldp_neighbor_get_ttl() returns seconds
Lennart Poettering [Thu, 2 Jun 2016 15:46:56 +0000 (17:46 +0200)]
lldp: clarify that sd_lldp_neighbor_get_ttl() returns seconds

Let's simply encode this in the parameter name.

8 years agolldp: add proper ref counting to sd_lldp object and a separate call for setting the...
Lennart Poettering [Thu, 2 Jun 2016 15:45:08 +0000 (17:45 +0200)]
lldp: add proper ref counting to sd_lldp object and a separate call for setting the ifindex

Let's make sd-lldp a bit more like sd-ndisc ant the other APIs, and add proper
ref counting and a separate call for setting the ifindex.

This also adds a new lldp_reset() call we can use at various places to close
all fds. This is also similar to how sd-ndisc already does it.

8 years agoexit-code: minor coding style updates
Lennart Poettering [Thu, 2 Jun 2016 15:41:48 +0000 (17:41 +0200)]
exit-code: minor coding style updates

8 years agosd-lldp: take triple timestamp when reading LLDP packets
Lennart Poettering [Mon, 30 May 2016 20:11:47 +0000 (22:11 +0200)]
sd-lldp: take triple timestamp when reading LLDP packets

It's a good idea to store away the recption time of LLDP packets in the
neighbor object, simply because the LLDP data only has a validity of a certain
amount of time.

Hence, let's record the timestamp when we receive the datagram and expose an
API for it. Also, automatically expire LLDP neighbors based on this new
timestamp.

8 years agosd-event: port over to new triple timestamp logic
Lennart Poettering [Mon, 30 May 2016 20:11:22 +0000 (22:11 +0200)]
sd-event: port over to new triple timestamp logic

8 years agotime-util: add triple timestamp object
Lennart Poettering [Mon, 30 May 2016 20:08:21 +0000 (22:08 +0200)]
time-util: add triple timestamp object

We already have a double timestamp object that we use whenever we need both a
MONOTONIC and a REALTIME timestamp taken and stored. With this change we
also add a triple timestamp object that in addition stores a BOOTTIME
timestamp, which is useful for a few usecases.

Note that we keep dual_timestamp around, as it is useful in many cases where
triple_timestamp is not, in particular because retrieving the monotonic and
realtime timestamps is much cheaper on Linux that getting the boottime
timestamp.

8 years agoresolved: also rewrite private /etc/resolv.conf when configuration is changed via...
Lennart Poettering [Mon, 6 Jun 2016 17:00:36 +0000 (19:00 +0200)]
resolved: also rewrite private /etc/resolv.conf when configuration is changed via bus calls

This also moves log message generation into manager_write_resolv_conf(), so
that it is shorter to invoke the function, given that we have to invoke it at a
couple of additional places now.

Fixes: #3225

8 years agoresolved: support IPv6 DNS servers on the local link
Lennart Poettering [Fri, 3 Jun 2016 19:29:14 +0000 (21:29 +0200)]
resolved: support IPv6 DNS servers on the local link

Make sure we can parse DNS server addresses that use the "zone id" syntax for
local link addresses, i.e. "fe80::c256:27ff:febb:12f%wlp3s0", when reading
/etc/resolv.conf.

Also make sure we spit this out correctly again when writing /etc/resolv.conf
and via the bus.

Fixes: #3359

8 years agoTwo CODING_STYLE additions
Lennart Poettering [Mon, 6 Jun 2016 15:24:21 +0000 (17:24 +0200)]
Two CODING_STYLE additions

8 years agomachinectl: Added stop as alias for poweroff (#3406)
Christian Rebischke [Mon, 6 Jun 2016 15:06:20 +0000 (17:06 +0200)]
machinectl: Added stop as alias for poweroff (#3406)

8 years agonetworkd: remove unused variable (#3447)
Tobias Jungel [Mon, 6 Jun 2016 12:03:07 +0000 (14:03 +0200)]
networkd: remove unused variable (#3447)

this patch solves the following waring:

../src/network/networkd-ndisc.c:197:13: warning: unused variable ‘r’
[-Wunused-variable]
         int r;

fixes acac5b2f

8 years agocgtop: fix ret pointer usage (#3443)
Alessandro Puccetti [Mon, 6 Jun 2016 10:38:23 +0000 (12:38 +0200)]
cgtop: fix ret pointer usage (#3443)

8 years agocgtop: add option to show a single cgroup subtree (#3413)
Alessandro Puccetti [Sun, 5 Jun 2016 17:42:37 +0000 (19:42 +0200)]
cgtop: add option to show a single cgroup subtree (#3413)

When many services are running, it was difficult to see only the interesting ones.
This patch allows to show only the subtree of interest.

8 years agoautomount: handle expire_tokens when the mount unit changes its state (#3434)
michaelolbrich [Sun, 5 Jun 2016 15:25:14 +0000 (17:25 +0200)]
automount: handle expire_tokens when the mount unit changes its state (#3434)

This basically reverts 7b2fd9d51259f6cf350791434e640ac3519acc6c ("core:
remove duplicate code in automount_update_mount()").

This was not duplicate code. The expire_tokens need to be handled as well:
Send 0 == success for MOUNT_DEAD (umount successful), do nothing for
MOUNT_UNMOUNTING (not yet done) and an error for everything else.

Otherwise the automount logic will assume unmounting is not done and will
not send any new requests for mounting. As a result, the corresponding
mount unit is never mounted.

Without this, automounts with TimeoutIdleSec= are broken. Once the idle
timeout triggered a umount, any access to the corresponding filesystem
hangs forever.

Fixes #3332.

8 years agosystemctl: install sigbus handler (#3435)
Evgeny Vereshchagin [Sat, 4 Jun 2016 23:24:20 +0000 (02:24 +0300)]
systemctl: install sigbus handler (#3435)

This makes systemctl robust regarding journal truncation.
This is a follow-up for 2cf4172a71860c6e44

Fixes:
Core was generated by `./systemctl status systemd-journald'.
Program terminated with signal SIGBUS, Bus error.
PID 8569 - core
TID 8569:
 #0  0x00007f246cc89ed6 __memcmp_sse4_1
 #1  0x0000557ebbc6f42c journal_file_init_header
 #2  0x0000557ebbc77262 journal_file_open
 #3  0x0000557ebbc42999 file_type_wanted
 #4  0x0000557ebbc42e08 add_any_file
 #5  0x0000557ebbc43832 add_directory
 #6  0x0000557ebbc4401c add_root_directory
 #7  0x0000557ebbc442e9 add_root_directory
 #8  0x0000557ebbc446fc add_search_paths
 #9  0x0000557ebbbacb5e show_journal_by_unit
 #10 0x0000557ebbb8376d print_status_info
 #11 0x0000557ebbb86a0b show_one
 #12 0x0000557ebbb87954 show
 #13 0x0000557ebbc20b1f dispatch_verb
 #14 0x0000557ebbb90615 systemctl_main
 #15 0x0000557ebbb9159f main
 #16 0x00007f246cb3e731 __libc_start_main
 #17 0x0000557ebbb75ae9 _start

8 years agoMerge pull request #3392 from poettering/assorted-stuff
Zbigniew Jędrzejewski-Szmek [Sat, 4 Jun 2016 22:47:56 +0000 (18:47 -0400)]
Merge pull request #3392 from poettering/assorted-stuff

Assorted stuff

8 years agonetworkd-link: fix handler typo for route_remove() (#3433)
tomty89 [Sat, 4 Jun 2016 10:31:07 +0000 (18:31 +0800)]
networkd-link: fix handler typo for route_remove() (#3433)

Obviously we've been using the wrong handler here. Fixes #3352.

8 years agonetworkd: constify more things
Lennart Poettering [Fri, 3 Jun 2016 17:54:35 +0000 (19:54 +0200)]
networkd: constify more things

8 years agonetworkd: also enforce limit on total number of address/routes
Lennart Poettering [Fri, 3 Jun 2016 17:51:48 +0000 (19:51 +0200)]
networkd: also enforce limit on total number of address/routes

This covers the address/routers acquire dynamically.

8 years agonetworkd: drop weird "const" usage in function parameters
Lennart Poettering [Fri, 3 Jun 2016 17:20:46 +0000 (19:20 +0200)]
networkd: drop weird "const" usage in function parameters

We generally only use "const" to constify the destination of pointers, but not
the pointers themselves, as they are copied anyway during C function
invocation. Hence, drop this usage of "const".

8 years agosd-netlink: fix sd_netlink_inc_rcvbuf() prototype
Lennart Poettering [Fri, 3 Jun 2016 17:20:00 +0000 (19:20 +0200)]
sd-netlink: fix sd_netlink_inc_rcvbuf() prototype

Drop weird "const" usage, and use size_t for sizes.

8 years agonetworkd: enforce a limit on the number of statically assigned addresses/routes/fdb...
Lennart Poettering [Fri, 3 Jun 2016 17:14:12 +0000 (19:14 +0200)]
networkd: enforce a limit on the number of statically assigned addresses/routes/fdb entries

We should put a limit on everything, hence also on these resources.

8 years agocore: Restrict mmap and mprotect with PAGE_WRITE|PAGE_EXEC (#3319) (#3379)
Topi Miettinen [Fri, 3 Jun 2016 15:58:18 +0000 (15:58 +0000)]
core: Restrict mmap and mprotect with PAGE_WRITE|PAGE_EXEC (#3319) (#3379)

New exec boolean MemoryDenyWriteExecute, when set, installs
a seccomp filter to reject mmap(2) with PAGE_WRITE|PAGE_EXEC
and mprotect(2) with PAGE_EXEC.

8 years agoMerge pull request #3409 from tomty89/update-2
Lennart Poettering [Fri, 3 Jun 2016 15:57:04 +0000 (17:57 +0200)]
Merge pull request #3409 from tomty89/update-2

networkd-dhcp6: DHCPv6 starting fixes

8 years agoMerge pull request #3418 from htejun/cgroup2-log-compat
Lennart Poettering [Fri, 3 Jun 2016 15:49:50 +0000 (17:49 +0200)]
Merge pull request #3418 from htejun/cgroup2-log-compat

core: log cgroup legacy and unified hierarchy setting translations

8 years agocore: always use "infinity" for no upper limit instead of "max" (#3417)
Tejun Heo [Fri, 3 Jun 2016 15:49:05 +0000 (08:49 -0700)]
core: always use "infinity" for no upper limit instead of "max" (#3417)

Recently added cgroup unified hierarchy support uses "max" in configurations
for no upper limit.  While consistent with what the kernel uses for no upper
limit, it is inconsistent with what systemd uses for other controllers such as
memory or pids.  There's no point in introducing another term.  Update cgroup
unified hierarchy support so that "infinity" is the only term that systemd
uses for no upper limit.

8 years agomissing include added for build with -DDEBUG (#3424)
Tobias Jungel [Fri, 3 Jun 2016 10:33:12 +0000 (12:33 +0200)]
missing include added for build with -DDEBUG (#3424)

8 years agotests: introduce UNIFIED_CGROUP_HIERARCHY (#3419)
Evgeny Vereshchagin [Fri, 3 Jun 2016 09:17:00 +0000 (12:17 +0300)]
tests: introduce UNIFIED_CGROUP_HIERARCHY (#3419)

There are many cgroups-related changes (thanks, @htejun!)
This commit will simplify testing a bit.

Use:
make run UNIFIED_CGROUP_HIERARCHY=yes to enable cgroup-v2
make run UNIFIED_CGROUP_HIERARCHY=no to enable cgroup-v1

8 years agoresolved: fix comments in resolve.conf for search domain overflows (#3422)
Martin Pitt [Fri, 3 Jun 2016 09:15:44 +0000 (11:15 +0200)]
resolved: fix comments in resolve.conf for search domain overflows (#3422)

Write comments about "too many search domains" and "Total length of all search
domains is too long" just once. Also put it on a separate line, as
resolv.conf(5) only specifies comments in a line by themselves.

This is ugly to do if write_resolv_conf_search() gets called once for every
search domain. So change it to receive the complete OrderedSet instead and do
the iteration by itself.

Add test cases to networkd-test.py.

https://launchpad.net/bugs/1588229

8 years agohwdb: Add Thinkpad X1 carbon 4th gen to 70-pointingstick.hwdb (#3426)
Matthieu Codron [Fri, 3 Jun 2016 07:41:14 +0000 (09:41 +0200)]
hwdb: Add Thinkpad X1 carbon 4th gen to 70-pointingstick.hwdb (#3426)

Like many other recent thinkpads the factory default pointingstick
sensitivity on these devices is quite low, making the pointingstick
very slow in moving the cursor.

This extends the existing hwdb rules for tweaking the sensitivity to
also apply to the X1 carbon 4thgen model.

8 years agocore: log cgroup legacy and unified hierarchy setting translations
Tejun Heo [Thu, 2 Jun 2016 17:02:53 +0000 (13:02 -0400)]
core: log cgroup legacy and unified hierarchy setting translations

To accommodate changes in kernel interface, cgroup unified hierarchy support
added several configuration items which overlap with the existing resource
control settings and there is simple config translation between the overlapping
settings to ease the transition.  As why certain cgroup knobs are being
configured can become confusing, this patch adds a master warning message which
is printed once when such translation is first used and logs each translation
with a debug message.

v2:

- Switched to log_unit*().

8 years agocore: pass Unit into cgroup_context_apply() and use log_unit*()
Tejun Heo [Thu, 2 Jun 2016 17:02:49 +0000 (13:02 -0400)]
core: pass Unit into cgroup_context_apply() and use log_unit*()

cgroup_context_apply() and friends take CGroupContext and cgroup path as input
and has no way of getting back to the associated Unit and thus uses raw cgroup
path for logging.  This makes the log messages difficult to track down.
There's no reason to avoid passing in Unit into these functions.  Pass in Unit
and use log_unit*() instead.

While at it, make cgroup_context_apply(), which has no outside users, static.
Also, drop cgroup path from log messages where the path itself isn't too
interesting and can be easily obtained from the unit.