platform/upstream/systemd.git
8 years agosystemctl: fix return values on success
Christian Hesse [Fri, 27 May 2016 07:32:41 +0000 (09:32 +0200)]
systemctl: fix return values on success

8 years agosystemctl: remove extra comma
Christian Hesse [Fri, 27 May 2016 07:21:02 +0000 (09:21 +0200)]
systemctl: remove extra comma

8 years ago{machine,system}ctl: always pass &changes and &n_changes (#3350)
Christian Hesse [Thu, 26 May 2016 13:57:37 +0000 (15:57 +0200)]
{machine,system}ctl: always pass &changes and &n_changes (#3350)

We have to pass addresses of changes and n_changes to
bus_deserialize_and_dump_unit_file_changes(). Otherwise we are hit by
missing information (subsequent calls to unit_file_changes_add() to
not add anything).

Also prevent null pointer dereference in
bus_deserialize_and_dump_unit_file_changes() by asserting.

Fixes #3339

8 years agoTypo: systemd-nspaw -> systemd-nspawn (#3354)
Ansgar Burchardt [Thu, 26 May 2016 08:44:35 +0000 (10:44 +0200)]
Typo: systemd-nspaw -> systemd-nspawn (#3354)

8 years agoMerge pull request #3247 from fbuihuu/ask-passowrd-on-all-consoles
Lennart Poettering [Tue, 24 May 2016 10:14:21 +0000 (12:14 +0200)]
Merge pull request #3247 from fbuihuu/ask-passowrd-on-all-consoles

ask-password: ask for passphrases not only on the first console

8 years agoUdevadm trivial cleanups (#3331)
Zbigniew Jędrzejewski-Szmek [Tue, 24 May 2016 10:07:42 +0000 (06:07 -0400)]
Udevadm trivial cleanups (#3331)

* udevadm-info: use _cleanup_

* udevadm-info: propagate return value from export_devices()

* sd-device: add comment and remove unnecessary braces

8 years agoask-password: ask for passphrases not only on the first console of /dev/console
Werner Fink [Wed, 18 Nov 2015 11:28:30 +0000 (12:28 +0100)]
ask-password: ask for passphrases not only on the first console of /dev/console

but also on all other consoles.  This does help on e.g. mainframes
where often a serial console together with other consoles are
used.  Even rack based servers attachted to both a serial console
as well as having a virtual console do sometimes miss a connected
monitor.

To be able to ask on all terminal devices of /dev/console the devices
are collected. If more than one device are found, then on each of the
terminals a inquiring task for passphrase is forked and do not return
to the caller.

Every task has its own session and its own controlling terminal.
If one of the tasks does handle a password, the remaining tasks
will be terminated.

Also let contradictory options on the command of
systemd-tty-ask-password-agent fail.

Spwan for each device of the system console /dev/console a own process.
Replace the system call wait() with with system call waitid().
Use SIGTERM instead of SIGHUP to get unresponsive childs down.

Port the collect_consoles() function forward to a pulbic and strv
based function "get_kernel_consoles()" in terminal-util.c and use this
in tty-ask-password-agent.c.

8 years agoRevert "rules: allow users to access frame buffer devices" (#3333)
Zbigniew Jędrzejewski-Szmek [Tue, 24 May 2016 09:32:30 +0000 (05:32 -0400)]
Revert "rules: allow users to access frame buffer devices" (#3333)

This reverts commit 483d8bbb4c0190f419bf9fba57fb0feb1a56bea6.

In [1] Michel Dänzer and Daniel Vetter wrote:
>> The scenario you describe isn't possible if the Wayland compositor
>> directly uses the KMS API of /dev/dri/card*, but it may be possible if
>> the Wayland compositor uses the fbdev API of /dev/fb* instead (e.g. if
>> weston uses its fbdev backend).
>
> Yeah, if both weston and your screen grabber uses native fbdev API you can
> now screenshot your desktop. And since fbdev has no concept of "current
> owner of the display hw" like the drm master, I think this is not fixable.
> At least not just in userspace. Also even with native KMS compositors
> fbdev still doesn't have the concept of ownership, which is why it doesn't
> bother clearing it's buffer before KMS takes over. I agree that this
> should be reverted or at least hidden better.

TBH, I think that privilege separation between processes running under the same
UID is tenuous. Even with drm, in common setups any user process can ptrace the
"current owner of the display" and call DROP_MASTER or do whatever. It *is*
possible to prevent that, e.g. by disabling ptrace using yama.ptrace_scope, or
selinux, and so on, but afaik this is not commonly done. E.g. all Fedora
systems pull in elfutils-default-yama-scope.rpm through dependencies which sets
yama.ptrace_scope=0. And even assuming that ptrace was disabled, it is trivial
to modify files on disk, communicate through dbus, etc; there is just to many
ways for a non-sandboxed process to interact maliciously with the display shell
to close them all off. To achieve real protection, some sort of sandboxing
must be implemented, and in that case there is no need to rely on access mode
on the device files, since much more stringent measures have to be implemented
anyway.

The situation is similar for framebuffer devices. It is common to add
framebuffer users to video group to allow them unlimited access to /dev/fb*.
Using uaccess would be better solution in that case. Also, since there is no
"current owner" limitation like in DRM, processes running under the same UID
should be able to access /proc/<pid-of-display-server>/fd/* and gain access to
the devices. Nevertheless, weston implements a suid wrapper to access the
devices and then drop privileges, and this patch would make this daemon
pointless. So if the weston developers feel that this change reduces security,
I prefer to revert it.

[1] https://lists.freedesktop.org/archives/wayland-devel/2016-May/029017.html

8 years agosd-device: udev-db - handle properties with empty value (#3330)
Tom Gundersen [Mon, 23 May 2016 23:34:29 +0000 (01:34 +0200)]
sd-device: udev-db - handle properties with empty value (#3330)

The statemachine was unable to parse properties with empty values,
reported in [0].

When reaching the start of the KEY, we would unconditionally read
one more character before starting to look for the end-of-line.
Simply look for the end-of-line from the first character.

[0]: <https://bugzilla.redhat.com/show_bug.cgi?id=1338823>

8 years agoman: explain what list-units does a bit better (#3324)
Zbigniew Jędrzejewski-Szmek [Mon, 23 May 2016 13:33:44 +0000 (09:33 -0400)]
man: explain what list-units does a bit better (#3324)

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

8 years agonetworkd: networkd: ndisc set SO_BINDTODEVICE on socket (#3294)
Susant Sahani [Mon, 23 May 2016 09:13:57 +0000 (14:43 +0530)]
networkd: networkd: ndisc set SO_BINDTODEVICE on socket (#3294)

From the issue #2004 we are receiving packet even if this
packet is not intended for this interface.

This can be reproduced.

lp3s0: Updating address: 2001:db8:1:0:7e7a:91ff:fe6d:ffe2/64 (valid for 1d)
wlp3s0: Updating address: fe80::7e7a:91ff:fe6d:ffe2/64 (valid forever)
NDisc CLIENT: Received RA from non-link-local address ::. Ignoring.
NDisc CLIENT: Received RA on wrong interface: 2 != 6. Ignoring.
NDisc CLIENT: Received RA on wrong interface: 2 != 3. Ignoring.
enp0s25: Updating address: 2001:db8:1:0:2ad2:44ff:fe6a:ae07/64 (valid for 1d)
enp0s25: Updating address: fe80::2ad2:44ff:fe6a:ae07/64 (valid forever)
NDisc CLIENT: Sent Router Solicitation
NDisc CLIENT: Sent Router Solicitation
NDisc CLIENT: Sent Router Solicitation
NDisc CLIENT: Received RA on wrong interface: 3 != 2. Ignoring.
NDisc CLIENT: Received RA on wrong interface: 3 != 6. Ignoring.
NDisc CLIENT: Received RA from non-link-local address ::. Ignoring.
NDisc CLIENT: Received RA on wrong interface: 2 != 6. Ignoring.
NDisc CLIENT: Received RA on wrong interface: 2 != 3. Ignoring.
enp0s25: Updating address: 2001:db8:1:0:2ad2:44ff:fe6a:ae07/64 (valid for 1d)
enp0s25: Updating address: fe80::2ad2:44ff:fe6a:ae07/64 (valid forever)

Add SO_BINDTODEVICE to socket
fixes #2004

8 years agoMention initrd-root-device.target in NEWS (#3325)
Dave Reisner [Mon, 23 May 2016 08:31:47 +0000 (10:31 +0200)]
Mention initrd-root-device.target in NEWS (#3325)

8 years agoresolved: don't stop handle messages after receiving a zero length UDP packet (#3323)
Evgeny Vereshchagin [Mon, 23 May 2016 08:19:14 +0000 (11:19 +0300)]
resolved: don't stop handle messages after receiving a zero length UDP packet (#3323)

Fixes:

-bash-4.3# ss --udp -l -p
State      Recv-Q Send-Q Local Address:Port                 Peer Address:Port
UNCONN     0      0          *:5355                     *:* users:(("systemd-resolve",pid=601,fd=12))
UNCONN     0      0         :::5355                    :::* users:(("systemd-resolve",pid=601,fd=14))

-bash-4.3# nping --udp -p 5355 --data-length 0 -c 1 localhost

-bash-4.3# journalctl -u systemd-resolved -b --no-hostname
...
May 21 14:59:22 systemd-resolved[601]: Event source llmnr-ipv4-udp (type io) returned error, disabling: Input/output error
...

-bash-4.3# nping --udp -p 5355 --data-length 1000 -c 1 localhost

-bash-4.3# ss --udp -l
State      Recv-Q Send-Q Local Address:Port                 Peer Address:Port
UNCONN     2304   0          *:5355                     *:*
UNCONN     0      0         :::5355                    :::*

8 years agoMerge pull request #3322 from poettering/random-ipv4acd-fixes
Tom Gundersen [Sun, 22 May 2016 22:16:28 +0000 (00:16 +0200)]
Merge pull request #3322 from poettering/random-ipv4acd-fixes

Random ipv4acd fixes

8 years agoipv4acd/ipv4ll: stop using read() on SOCK_DGRAM sockets
Lennart Poettering [Sun, 22 May 2016 12:26:36 +0000 (14:26 +0200)]
ipv4acd/ipv4ll: stop using read() on SOCK_DGRAM sockets

This is a follow-up to cf447cb62d01137f4cbd1cd14b83b88823542bbf.

Let's generally follow the rule to not use read() on SOCK_DGRAM sockets, let's
always use recv() on that.

Also, don't abort IPV4ACD logic in case we read a short packet. Simply log and
ignore.

8 years agosd-ipv4acd: do not define ether_addr_is_nul() redundantly
Lennart Poettering [Sun, 22 May 2016 12:26:06 +0000 (14:26 +0200)]
sd-ipv4acd: do not define ether_addr_is_nul() redundantly

we already have ether_addr_is_null() in ether-addr-util.h, let's use it here,
too.

8 years agosd-ipv4acd: drop HASH_KEY definition, as it is unused
Lennart Poettering [Sun, 22 May 2016 12:25:02 +0000 (14:25 +0200)]
sd-ipv4acd: drop HASH_KEY definition, as it is unused

8 years agonspawn: remove unreachable return statement (#3320)
Zbigniew Jędrzejewski-Szmek [Sun, 22 May 2016 11:02:41 +0000 (07:02 -0400)]
nspawn: remove unreachable return statement (#3320)

8 years agonetworkd-ndisc: do not return value from void function
Zbigniew Jędrzejewski-Szmek [Sat, 21 May 2016 22:12:17 +0000 (18:12 -0400)]
networkd-ndisc: do not return value from void function

Fixup for #3304.

Only warn, and not return, because that's what sd_dhcp6_client_start()
does right below the call to sd_dhcp6_client_set_local_address().

8 years agobuild-sys: bump so version
Zbigniew Jędrzejewski-Szmek [Sat, 21 May 2016 21:58:30 +0000 (17:58 -0400)]
build-sys: bump so version

8 years agoNEWS: final updates for v230
Zbigniew Jędrzejewski-Szmek [Sat, 21 May 2016 21:51:13 +0000 (17:51 -0400)]
NEWS: final updates for v230

8 years agorun: do not try to use reply after freeing it (#3318)
Zbigniew Jędrzejewski-Szmek [Sat, 21 May 2016 22:30:33 +0000 (18:30 -0400)]
run: do not try to use reply after freeing it (#3318)

We'd call sd_bus_message_unref and then proceed to use
variables pointing into the reply buffer (fd and char*).
dup the fd and copy the string before destorying the reply.

This makes systemd-run run again for me.

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

8 years agounits: restore ConditionNeesUpdate=/etc in ldconfig.service (#3311)
Lennart Poettering [Sat, 21 May 2016 21:09:18 +0000 (23:09 +0200)]
units: restore ConditionNeesUpdate=/etc in ldconfig.service (#3311)

In order to support stateless systems that support offline /usr updates
properly, let's restore the ConditionNeesUpdate=/etc line that makes sure we
are run when /usr is updated and this update needs to be propagated to the
/etc/ld.so.conf file stored in /etc.

This reverts part of #2859, which snuck this change in, but really shouldn't
have.

8 years agolibsystemd-network: use recv(..., 0) instead of read(...) (#3317)
Tom Gundersen [Sat, 21 May 2016 21:00:32 +0000 (23:00 +0200)]
libsystemd-network: use recv(..., 0) instead of read(...) (#3317)

According to recv(2) these should be the same, but that is not true.
Passing a buffer of length 0 to read is defined to be a noop according
to read(2), but passing a buffer of length 0 to recv will discard the
pending pacet.

We can easily hit this as we allocate our buffer size depending on
the size of the incoming packet (using FIONREAD). As pointed out in
issue #3299 simply sending an empty UDP packet to the DHCP client
port will trigger a busy loop in networkd as we are polling on the
socket but never discarding the empty packet.

This reverts ad5ae47a0d159ea473c9730d7e0298a3e5d31cf6 but fixes the
same issue.

8 years agocore: set all log fds to -1 when freezing (#3314)
Evgeny Vereshchagin [Sat, 21 May 2016 16:40:34 +0000 (19:40 +0300)]
core: set all log fds to -1 when freezing (#3314)

Fixes:
-bash-4.3# echo core >/proc/sys/kernel/core_pattern
-bash-4.3# kill -ABRT 1
-bash-4.3# kill -ABRT 1
[   61.373922] systemd[1]: segfault at 7fff1d0a8f48 ip 00007fc9ca91b1c3 sp 00007fff1d0a8f50 error 6 in libc-2.23.so[7fc9ca8ce000+1c0000]
[   61.768017] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000008b
[   61.768017]
...

Recursive ABRT and segfault:
PID 1 - core
TID 1:
...
 #153905 0x00005575fc3f829d log_dispatch
 #153906 0x00005575fc3f8aa3 log_assert
 #153907 0x00005575fc3f8ae9 log_assert_failed
 #153908 0x00005575fc3e7eb1 safe_close
 #153909 0x00005575fc3f6d5e log_close_journal
 #153910 0x00005575fc3f829d log_dispatch
 #153911 0x00005575fc3f85a1 log_internalv
 #153912 0x00005575fc3f86a1 log_internal
 #153913 0x00005575fc31c4c1 crash
 #153914 0x00007fb26f2cf3d0 __restore_rt
 #153915 0x00007fb26f2ced00 pause
 #153916 0x00005575fc403944 freeze
 #153917 0x00005575fc31bf7b freeze_or_reboot
...

8 years agocore: put opening curly braces on the same line as function names (#3313)
Tejun Heo [Fri, 20 May 2016 20:46:42 +0000 (13:46 -0700)]
core: put opening curly braces on the same line as function names (#3313)

Recently added cgroup helper functions break the style convention.  Fix them
up.

8 years agoRevert "core/dbus: further simplify branch code" (#3307)
Lennart Poettering [Fri, 20 May 2016 20:36:22 +0000 (22:36 +0200)]
Revert "core/dbus: further simplify branch code" (#3307)

8 years agoMerge pull request #3304 from tomty89/master
Tom Gundersen [Fri, 20 May 2016 17:00:08 +0000 (19:00 +0200)]
Merge pull request #3304 from tomty89/master

[networkd] ndisc DHCPv6 triggering fixes

8 years agoMerge pull request #3276 from ssahani/issue-3264
Tom Gundersen [Fri, 20 May 2016 16:54:49 +0000 (18:54 +0200)]
Merge pull request #3276 from ssahani/issue-3264

networkd: Drop IPv6LL address when link is down.

8 years agoMerge pull request #3290 from htejun/cgroup2-io-compat
Lennart Poettering [Fri, 20 May 2016 16:53:11 +0000 (18:53 +0200)]
Merge pull request #3290 from htejun/cgroup2-io-compat

Implement compat translation between IO* and BlockIO* settings

8 years agoMerge pull request #3235 from dkg/hwaddr-cleanup
Tom Gundersen [Fri, 20 May 2016 15:27:58 +0000 (17:27 +0200)]
Merge pull request #3235 from dkg/hwaddr-cleanup

minor improvements for dealing with MAC Addresses

8 years agocore/dbus: revert oversimplification (#3309)
Jonathan Boulle [Fri, 20 May 2016 14:20:00 +0000 (16:20 +0200)]
core/dbus: revert oversimplification (#3309)

free_and_strdup handles NULL but not empty strings.

See also:
https://github.com/systemd/systemd/pull/3283#issuecomment-220603145
https://github.com/systemd/systemd/pull/3307

8 years agoMake the fix for net/if.h fuckup even worse (#3287)
Zbigniew Jędrzejewski-Szmek [Fri, 20 May 2016 13:12:42 +0000 (09:12 -0400)]
Make the fix for net/if.h fuckup even worse (#3287)

The original conflict is fixed in the kernel in v4.6-rc7-40-g4a91cb61bb,
but now our work-around causes a compilation failure.
Keep the workaround to support 4.5 kernels for now, and layer
more ugliness on top.

Tested with:
kernel-headers-4.6.0-1.fc25.x86_64
glibc-devel-2.23.90-18.fc25.x86_64

kernel-headers-4.5.4-300.fc24.x86_64
glibc-devel-2.23.1-7.fc24.x86_64

kernel-headers-4.4.9-300.fc23.x86_64
glibc-devel-2.22-16.fc23.x86_64

kernel-headers-4.1.13-100.fc21.x86_64
glibc-devel-2.20-8.fc21.x86_64

8 years agoresolved: fix accounting of dns serves on a link (#3291)
Zbigniew Jędrzejewski-Szmek [Fri, 20 May 2016 13:11:58 +0000 (09:11 -0400)]
resolved: fix accounting of dns serves on a link (#3291)

After a few link up/down events I got this warning:
May 17 22:05:10 laptop systemd-resolved[2983]: Failed to read DNS servers for interface wlp3s0, ignoring: Argument list too long

8 years agocore/dbus: expose SELinuxContext property (#3284)
Jonathan Boulle [Fri, 20 May 2016 13:09:14 +0000 (15:09 +0200)]
core/dbus: expose SELinuxContext property (#3284)

Adds support to core for systemd D-Bus clients to send the
`SELinuxContext` property . This means `systemd-run -p
SELinuxContext=foo` should now work.

8 years agobasic: remove rm_rf_and_free, add rm_rf_physical_and_free, use rm_rf_physical_and_fre...
Evgeny Vereshchagin [Fri, 20 May 2016 13:08:24 +0000 (16:08 +0300)]
basic: remove rm_rf_and_free, add rm_rf_physical_and_free, use rm_rf_physical_and_freep in tests (#3292)

Some distros don't mount /tmp as tmpfs.
For example:
https://lists.ubuntu.com/archives/ubuntu-cloud/2016-January/001009.html

Some tests:
* print 'Attempted to remove disk file system, and we can't allow that.'
* don't really cleanup /tmp

8 years agoNEWS: typo fix and american english (#3301)
Thomas H. P. Andersen [Fri, 20 May 2016 13:04:01 +0000 (15:04 +0200)]
NEWS: typo fix and american english (#3301)

8 years agosd-dhcp-client: fix busy loop reading zero sized DHCP UDP packets. (#3299)
sadag [Fri, 20 May 2016 11:26:27 +0000 (04:26 -0700)]
sd-dhcp-client: fix busy loop reading zero sized DHCP UDP packets. (#3299)

8 years ago[networkd-dhcp6] do not call sd_dhcp6_client_start() from dhcp6_request_address()
tomty89 [Fri, 20 May 2016 10:28:30 +0000 (18:28 +0800)]
[networkd-dhcp6] do not call sd_dhcp6_client_start() from dhcp6_request_address()

Starting the DHCP client doesn't seem like dhcp6_request_address()'s responsibility anyway. Whenever it's called, sd_dhcp6_client_start() is unconditionally called outside of it as well. See ndisc_router_handler() and ndisc_handler() in networkd-ndisc.c.

8 years ago[networkd-ndisc] set IPv6LL address in DHCP client
tomty89 [Fri, 20 May 2016 10:20:24 +0000 (18:20 +0800)]
[networkd-ndisc] set IPv6LL address in DHCP client

Fix issue #3256 and probably #1982. Referenced link_acquire_ipv6_conf() in networkd-link.c.

8 years agosystemctl: suppress no-[Install] hint when --quiet is used (#3295)
Zbigniew Jędrzejewski-Szmek [Thu, 19 May 2016 19:08:41 +0000 (15:08 -0400)]
systemctl: suppress no-[Install] hint when --quiet is used (#3295)

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

8 years agosystemctl: reload configuration when enabling sysv units too (#3297)
Franck Bui [Thu, 19 May 2016 14:37:04 +0000 (16:37 +0200)]
systemctl: reload configuration when enabling sysv units too (#3297)

After enabling/disabling a unit, the daemon configuration is expected
to be unless '--no-reload' option is passed.

However this is not done when enabling a sysv units. This can lead to
the following scenario:

   $ cp /etc/init.d/named /etc/init.d/foo
   $ systemctl enable foo
   foo.service is not a native service, redirecting to systemd-sysv-install
   Executing /usr/lib/systemd/systemd-sysv-install enable foo
   $ systemctl start foo
   Failed to start foo.service: Unit foo.service failed to load: No such file or directory.

This can also be seen after installing a package providing a sysv
service: the service can't be started unless 'daemon-reload' is called
manually. This shouldn't be needed and this patch will fix this case
too since during package installation, the service is expected to be
enabled/disabled.

8 years agosystemctl: restore the no-sync option for legacy halt (#3249)
tblume [Thu, 19 May 2016 14:35:27 +0000 (16:35 +0200)]
systemctl: restore the no-sync option for legacy halt (#3249)

The sync() call on shutdown had been removed with commit 57371e5829a61e5ee6c9f98404dfc729d6c62608
together with the no-sync option for the shutdown commands.
The sync call was restored in commit 4a3ad39957399c4a30fc472a804e72907ecaa4f9 but the no-sync option
wasn't re-added.
I think we should restore this option at least for the legacy halt command.

8 years agoMerge pull request #3293 from michaelolbrich/partuuid
Zbigniew Jędrzejewski-Szmek [Thu, 19 May 2016 13:38:00 +0000 (09:38 -0400)]
Merge pull request #3293 from michaelolbrich/partuuid

rules: add /dev/disk/by-partuuid symlinks also for dos partition tables

8 years agorules: add /dev/disk/by-partuuid symlinks also for dos partition tables
Uwe Kleine-König [Mon, 9 May 2016 09:24:55 +0000 (11:24 +0200)]
rules: add /dev/disk/by-partuuid symlinks also for dos partition tables

blkid reports PARTUUID values also for partitions that are defined by a
dos partitioning scheme. Instead of limiting the partitioning scheme to
"gpt or dos" just drop the test for the partitioning scheme and trust
blkid to do the right thing.

8 years agoNEWS: mention SessionsMax, InhibitorsMax, MulticastSnooping...
Zbigniew Jędrzejewski-Szmek [Thu, 19 May 2016 04:11:20 +0000 (00:11 -0400)]
NEWS: mention SessionsMax, InhibitorsMax, MulticastSnooping...

... logind SIGHUP support, sd_journal_open_{directory,files}_fd,
specifiers in DeviceAllow, "generated" and "trasnient" unit types.

Move removed features to the end and cluster features by type.

8 years agocore/dbus: further simplify branch code (#3283)
Jonathan Boulle [Thu, 19 May 2016 00:54:22 +0000 (02:54 +0200)]
core/dbus: further simplify branch code (#3283)

free_and_strdup already handles the NULL case for us, so we can remove
an extraneous conditional check.

As noted in https://github.com/systemd/systemd/pull/3279/files#r63687717

8 years agocore: translate between IO and BlockIO settings to ease transition
Tejun Heo [Thu, 19 May 2016 00:35:12 +0000 (17:35 -0700)]
core: translate between IO and BlockIO settings to ease transition

Due to the substantial interface changes in cgroup unified hierarchy, new IO
settings are introduced.  Currently, IO settings apply only to unified
hierarchy and BlockIO to legacy.  While the transition is necessary, it's
painful for users to have to provide configs for both.  This patch implements
translation from one config set to another for configs which make sense.

* The translation takes place during application of the configs.  Users won't
  see IO or BlockIO settings appearing without being explicitly created.

* The translation takes place only if there is no config for the matching
  cgroup hierarchy type at all.

While this doesn't provide comprehensive compatibility, it should considerably
ease transition to the new IO settings which are a superset of BlockIO
settings.

v2:

- Update test-cgroup-mask.c so that it accounts for the fact that
  CGROUP_MASK_IO and CGROUP_MASK_BLKIO move together.  Also, test/parent.slice
  now sets IOWeight instead of BlockIOWeight.

8 years agocore: factor out io and blkio helper functions from cgroup_context_apply()
Tejun Heo [Wed, 18 May 2016 20:51:46 +0000 (13:51 -0700)]
core: factor out io and blkio helper functions from cgroup_context_apply()

Factor out the following functions out of cgroup_context_apply()

* cgroup_context_[blk]io_weight()
* cgroup_apply_[blk]io_device_weight()
* cgroup_apply_[blk]io_device_limit()

This is pure refactoring and shouldn't cause any functional differences.

8 years agocore: update CGroupBlockIODeviceBandwidth to record both rbps and wbps
Tejun Heo [Wed, 18 May 2016 20:51:46 +0000 (13:51 -0700)]
core: update CGroupBlockIODeviceBandwidth to record both rbps and wbps

CGroupBlockIODeviceBandwith is used to keep track of IO bandwidth limits for
legacy cgroup hierarchies.  Unlike the unified hierarchy counterpart
CGroupIODeviceLimit, a CGroupBlockIODeviceBandwiddth records either a read or
write limit and has a couple issues.

* There's no way to clear specific config entry.

* When configs are cleared for an IO direction of a unit, the kernel settings
  aren't cleared accordingly creating discrepancies.

This patch updates CGroupBlockIODeviceBandwidth so that it behaves similarly to
CGroupIODeviceLimit - each entry records both rbps and wbps limits and is
cleared if both are at default values after kernel settings are updated.

8 years agocore: add support for IOReadIOPSMax and IOWriteIOPSMax
Tejun Heo [Wed, 18 May 2016 20:50:56 +0000 (13:50 -0700)]
core: add support for IOReadIOPSMax and IOWriteIOPSMax

cgroup IO controller supports maximum limits for both bandwidth and IOPS but
systemd resource control currently only supports bandwidth limits.  This patch
adds support for IOReadIOPSMax and IOWriteIOPSMax when unified cgroup hierarchy
is in use.

It isn't difficult to also add BlockIOReadIOPS and BlockIOWriteIOPS for legacy
hierarchies but IO control on legacy hierarchies is half-broken anyway, so
let's leave it alone for now.

8 years agocore: introduce CGroupIOLimitType enums
Tejun Heo [Wed, 18 May 2016 20:50:56 +0000 (13:50 -0700)]
core: introduce CGroupIOLimitType enums

Currently, there are two cgroup IO limits, bandwidth max for read and write,
and they are hard-coded in various places.  This is fine for two limits but IO
is expected to grow more limits - low, high and max limits for bandwidth and
IOPS - and hard-coding each limit won't make sense.

This patch replaces hard-coded limits with an array indexed by
CGroupIOLimitType and accompanying string and default value tables so that new
limits can be added trivially.

8 years agonetworkd: Drop IPv6LL address when link is down
Susant Sahani [Wed, 18 May 2016 12:49:40 +0000 (18:19 +0530)]
networkd: Drop IPv6LL address when link is down

Now we are not dropping the IPv6LL address when link is down.
So next time when link is up and before kernel acquired this address
we are using the old address.

When the link is down kernel tells us that this address is no longer
valid . Let's remove this address and again when kernel tells us
that the address is added let's use it.

fixes #3264

8 years agohwdb: run "make hwdb-udate" (#3280)
Zbigniew Jędrzejewski-Szmek [Wed, 18 May 2016 03:26:15 +0000 (23:26 -0400)]
hwdb: run "make hwdb-udate" (#3280)

8 years agonetworkd: do not update state or IPv6LL address if link is failed or lingering
Susant Sahani [Wed, 18 May 2016 02:59:56 +0000 (08:29 +0530)]
networkd: do not update state or IPv6LL address if link is failed or lingering

This is partial fix for #2228 and #2977, #3204.

bridge-test: netdev ready
docker0: Gained IPv6LL
wlan0: Gained IPv6LL
eth0: Gained IPv6LL
Enumeration completed
bridge-test: netdev exists, using existing without changing its
parameters
vboxnet0: IPv6 enabled for interface: Success
lo: Configured
docker0: Could not drop address: No such process
vboxnet0: Gained carrier
wlan0: Could not drop address: No such process
eth0: Could not drop address: No such process
eth0: Could not drop address: No such process
eth0: Could not drop address: No such process
vboxnet0: Gained IPv6LL
vboxnet0: Could not set NDisc route or address: Invalid argument
vboxnet0: Failed
[New Thread 0x7ffff6505700 (LWP 1111)]
[Thread 0x7ffff6505700 (LWP 1111) exited]
Assertion 'link->state == LINK_STATE_SETTING_ROUTES' failed at
src/network/networkd-link.c:672, function link_enter_configured().
Aborting.

Program received signal SIGABRT, Aborted.
0x00007ffff6dc6a98 in raise () from /lib64/libc.so.6
Missing separate debuginfos, use: dnf debuginfo-install
iptables-1.4.21-15.fc23.x86_64 libattr-2.4.47-14.fc23.x86_64
libidn-1.32-1.fc23.x86_64 pcre-8.38-7.fc23.x86_64

Debugging

(gdb) bt
"link->state == LINK_STATE_SETTING_ROUTES", file=0x5555556a34c8
"src/network/networkd-link.c", line=672,
    func=0x5555556a56d0 <__PRETTY_FUNCTION__.14850>
"link_enter_configured") at src/basic/log.c:788
src/network/networkd-link.c:672
src/network/networkd-link.c:720
flags=0 '\000', scope=0 '\000', cinfo=0x7fffffffe020) at
src/network/networkd-address.c:344
(rtnl=0x5555556eded0, message=0x55555570ff20, userdata=0x5555556ec590)
at src/network/networkd-manager.c:604
m=0x55555570ff20) at src/libsystemd/sd-netlink/sd-netlink.c:365
at src/libsystemd/sd-netlink/sd-netlink.c:395
ret=0x0) at src/libsystemd/sd-netlink/sd-netlink.c:429
revents=1, userdata=0x5555556eded0) at
src/libsystemd/sd-netlink/sd-netlink.c:723
src/libsystemd/sd-event/sd-event.c:2268
src/libsystemd/sd-event/sd-event.c:2629
timeout=18446744073709551615) at src/libsystemd/sd-event/sd-event.c:2688
bus=0x5555556eeba0, name=0x55555568a2f5 "org.freedesktop.network1",
timeout=30000000,
    check_idle=0x55555556adb6 <manager_check_idle>,
userdata=0x5555556ec590) at src/shared/bus-util.c:134
src/network/networkd-manager.c:1130
src/network/networkd.c:127

(gdb) f 3
src/network/networkd-link.c:672
672         assert(link->state == LINK_STATE_SETTING_ROUTES);
(gdb) p link->state
$1 = LINK_STATE_FAILED

We should not be in this state .

even if vboxnet0 failed we went into this state.

vboxnet0: Could not set NDisc route or address: Invalid argument
vboxnet0: Failed

8 years agonetworkd: add route expiration handler (#3242)
Susant Sahani [Wed, 18 May 2016 01:36:43 +0000 (07:06 +0530)]
networkd: add route expiration handler (#3242)

Fix for #3232.

8 years agocoredump: Improve man pages
Peter Mattern [Mon, 16 May 2016 09:56:04 +0000 (11:56 +0200)]
coredump: Improve man pages

8 years agonetworkd: Add EmitRouter= option for DHCP Server (#3251)
Clemens Gruber [Tue, 17 May 2016 23:34:25 +0000 (01:34 +0200)]
networkd: Add EmitRouter= option for DHCP Server (#3251)

Add an option to disable appending DHCP option 3 (Router) to the DHCP
OFFER and ACK packets.
This commit adds the boolean option EmitRouter= for the [DHCPServer]
section in .network files.

Rationale: On embedded devices, it is very useful to have a DHCP server
running on an USB OTG ethernet gadget interface to avoid manual setup on
the client PCs, but it should only serve IP addresses, no route(r)s.
Otherwise, Windows clients experience network connectivity issues, due
to them using the address set in DHCP option 3 as default gateway.

Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
8 years agocore/dbus: use free_and_strdup to simplify code (#3279)
Jonathan Boulle [Tue, 17 May 2016 23:30:37 +0000 (01:30 +0200)]
core/dbus: use free_and_strdup to simplify code (#3279)

Makes it consistent with the other branches here.

8 years agonetwork: rely on ether_addr_from_string instead of sscanf
Daniel Kahn Gillmor [Tue, 17 May 2016 20:43:36 +0000 (16:43 -0400)]
network: rely on ether_addr_from_string instead of sscanf

8 years agoutil-lib: add ether_addr_from_string()
Daniel Kahn Gillmor [Tue, 17 May 2016 15:00:29 +0000 (11:00 -0400)]
util-lib: add ether_addr_from_string()

This isn't quite symmetrical to in_addr_from_string() because it also returns
an offset indicating how much of the string was consumed by the matched
pattern.  This offset reporting is needed for either of the following use
cases:

 * verifying the lack of trailing garbage after such an address
 * parsing subsequent data from the same string

8 years agobasic: define HEXDIGITS
Daniel Kahn Gillmor [Tue, 17 May 2016 13:44:32 +0000 (09:44 -0400)]
basic: define HEXDIGITS

define HEXDIGITS alongside DIGITS, and use it where it's already useful.  We'll
use it again shortly when parsing MAC addresses.

8 years agonetwork: test MAC address parsing
Daniel Kahn Gillmor [Tue, 17 May 2016 12:01:01 +0000 (08:01 -0400)]
network: test MAC address parsing

networkd currently silently accepts some strings as MAC addresses that it
probably shouldn't (like "ab:cd:ef:12:34:56:78" and "ab:cd:ef:12:3 4:56").

Add tests to MAC address parsing to ensure that we only accept valid MAC
addresses, and that we accept the three most common forms of MAC address
(colon-delimited hex, IEEE, and Cisco)

Several of these tests currently fail, but another commit in this series will
resolve them.

8 years agoman: clarify different uses of MACAddress
Daniel Kahn Gillmor [Sun, 8 May 2016 19:58:34 +0000 (15:58 -0400)]
man: clarify different uses of MACAddress

Improve the networkd documentation to clarify that Match.MACAddress is for
selection, but Link.MACAddress describes an action to be taken.

8 years agohwdb: Update database of Bluetooth company identifiers
Marcel Holtmann [Tue, 17 May 2016 16:52:37 +0000 (18:52 +0200)]
hwdb: Update database of Bluetooth company identifiers

8 years agovconsole: add log_oom() where appropriate
Lennart Poettering [Tue, 17 May 2016 08:27:26 +0000 (10:27 +0200)]
vconsole: add log_oom() where appropriate

8 years agoMerge pull request #3258 from keszybz/small-networkd-cleanup
Lennart Poettering [Tue, 17 May 2016 08:12:30 +0000 (10:12 +0200)]
Merge pull request #3258 from keszybz/small-networkd-cleanup

Small networkd cleanup

8 years agoupdate NEWS
Lennart Poettering [Mon, 16 May 2016 21:07:08 +0000 (23:07 +0200)]
update NEWS

8 years agoman: clarify that IOXyz= only applies to the unified hierarchy, and BlockIOXyz= to...
Lennart Poettering [Mon, 16 May 2016 20:48:45 +0000 (22:48 +0200)]
man: clarify that IOXyz= only applies to the unified hierarchy, and BlockIOXyz= to the legacy hierarchy

With this change for each setting we say which hierarachy it applies to briefly
in the first sentence of the description, plus in longer form in an extra
pargraph at the end, with a recommendation for the counterpart of the option in
the other hierarchy.

Also adds markup and the "=" suffix to all mentioned settings.

8 years agoupdate TODO
Lennart Poettering [Mon, 16 May 2016 20:18:39 +0000 (22:18 +0200)]
update TODO

8 years agoMerge pull request #3193 from htejun/cgroup-io-controller
Lennart Poettering [Mon, 16 May 2016 20:05:27 +0000 (22:05 +0200)]
Merge pull request #3193 from htejun/cgroup-io-controller

core: add io controller support on the unified hierarchy

8 years agoCONTRIBUTING: recommend force-push (#3273)
Zbigniew Jędrzejewski-Szmek [Mon, 16 May 2016 19:44:35 +0000 (15:44 -0400)]
CONTRIBUTING: recommend force-push (#3273)

8 years agobasic: Fix incorrect architecture mapping on sparc64. (#3274)
John Paul Adrian Glaubitz [Mon, 16 May 2016 19:25:36 +0000 (21:25 +0200)]
basic: Fix incorrect architecture mapping on sparc64. (#3274)

8 years agocore: don't log job status message in case job was effectively NOP (#3199)
Michal Sekletar [Mon, 16 May 2016 15:24:51 +0000 (17:24 +0200)]
core: don't log job status message in case job was effectively NOP (#3199)

We currently generate log message about unit being started even when
unit was started already and job didn't do anything. This is because job
was requested explicitly and hence became anchor job of the transaction
thus we could not eliminate it. That is fine but, let's not pollute
journal with useless log messages.

$ systemctl start systemd-resolved
$ systemctl start systemd-resolved
$ systemctl start systemd-resolved

Current state:
$ journalctl -u systemd-resolved | grep Started

May 05 15:31:42 rawhide systemd[1]: Started Network Name Resolution.
May 05 15:31:59 rawhide systemd[1]: Started Network Name Resolution.
May 05 15:32:01 rawhide systemd[1]: Started Network Name Resolution.

After patch applied:
$ journalctl -u systemd-resolved | grep Started

May 05 16:42:12 rawhide systemd[1]: Started Network Name Resolution.

Fixes #1723

8 years agomissing.h: add BTRFS_IOC_QUOTA_RESCAN_WAIT (#3266)
Stefan Saraev [Mon, 16 May 2016 14:58:46 +0000 (17:58 +0300)]
missing.h: add BTRFS_IOC_QUOTA_RESCAN_WAIT (#3266)

8 years agovconsole-setup: Store fonts on heap (#3268)
Kyle Russell [Mon, 16 May 2016 14:41:30 +0000 (09:41 -0500)]
vconsole-setup: Store fonts on heap (#3268)

More friendly to the stack.

8 years agohwdb: add touchpad resolution for Lenovo E530 (#3265)
Peter Hutterer [Mon, 16 May 2016 02:35:47 +0000 (12:35 +1000)]
hwdb: add touchpad resolution for Lenovo E530 (#3265)

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

8 years agonamespace: Make private /dev noexec and readonly (#3263)
topimiettinen [Mon, 16 May 2016 02:34:05 +0000 (02:34 +0000)]
namespace: Make private /dev noexec and readonly (#3263)

Private /dev will not be managed by udev or others, so we can make it
noexec and readonly after we have made all device nodes. As /dev/shm
needs to be writable, we can't use bind_remount_recursive().

8 years ago/var/tmp instead of /tmp/var in systemd.unit man page (#3262)
gdamjan [Mon, 16 May 2016 01:43:00 +0000 (03:43 +0200)]
/var/tmp instead of /tmp/var in systemd.unit man page (#3262)

8 years agoman: fix typo (#3261)
Andre Klärner [Mon, 16 May 2016 01:40:52 +0000 (03:40 +0200)]
man: fix typo (#3261)

8 years agosd-dhcp6-client: add log_errno macro and improve debug messages a bit
Zbigniew Jędrzejewski-Szmek [Sun, 15 May 2016 14:46:17 +0000 (10:46 -0400)]
sd-dhcp6-client: add log_errno macro and improve debug messages a bit

8 years agotree-wide: drop spurious "&"s when passing functions around
Zbigniew Jędrzejewski-Szmek [Sun, 15 May 2016 14:22:40 +0000 (10:22 -0400)]
tree-wide: drop spurious "&"s when passing functions around

Also adjust indentation in various places.

8 years agonetworkd: do not generate a mac address for vlan interfaces (#3221)
Susant Sahani [Sun, 15 May 2016 13:45:30 +0000 (19:15 +0530)]
networkd: do not generate a mac address for vlan interfaces (#3221)

While creating a VLAN the mac address should be copied from the parent interface, so that
the VLANs inherit the MAC address of the physical interface.

Before:
```
3: wlp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:26:c6:85:a3:c2 brd ff:ff:ff:ff:ff:ff
    ...
6: vlan1@wlp3s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 22:07:73:9d:43:59 brd ff:ff:ff:ff:ff:ff
7: vlan2@wlp3s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 46:30:76:33:35:d4 brd ff:ff:ff:ff:ff:ff
```

After:
```
3: wlp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:26:c6:85:a3:c2 brd ff:ff:ff:ff:ff:ff
    ...
11: vlan1@wlp3s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 00:26:c6:85:a3:c2 brd ff:ff:ff:ff:ff:ff
12: vlan2@wlp3s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 00:26:c6:85:a3:c2 brd ff:ff:ff:ff:ff:ff
```

v2 of #1573, with fixed commit message.

8 years agonetworkd: bridge add support to configure multicast snooping (#3223)
Susant Sahani [Sun, 15 May 2016 13:15:20 +0000 (18:45 +0530)]
networkd: bridge add support to configure multicast snooping (#3223)

This patch implements support for the IFLA_BR_MCAST_SNOOPING attribute
it can change the multicast snooping value.

IGMP snooping monitors the Internet Group Management Protocol (IGMP)
traffic between hosts and multicast routers.

8 years agonetworkd: fix copy-pasto in error message
Zbigniew Jędrzejewski-Szmek [Sat, 14 May 2016 20:47:59 +0000 (16:47 -0400)]
networkd: fix copy-pasto in error message

8 years agonetworkd: drop route_drop
Zbigniew Jędrzejewski-Szmek [Sat, 14 May 2016 20:46:01 +0000 (16:46 -0400)]
networkd: drop route_drop

It is just an alias for route_free which requires that route is not null,
but it was only used in one place where it was checked that route is not
null anyway. Let's just call route_free instead.

8 years agobusctl: use Monitoring interface (#3245)
Lars Uebernickel [Sat, 14 May 2016 20:10:22 +0000 (22:10 +0200)]
busctl: use Monitoring interface (#3245)

This is now the recommended way to do monitoring by upstream D-Bus.
It's also allowed in the default policy, whereas eavesdrop is not
anymore, which effectively broke busctl on many systems.

8 years agocore: allow slice to be overriden if cgroups aren't realized (#3246)
Tejun Heo [Sat, 14 May 2016 19:56:53 +0000 (15:56 -0400)]
core: allow slice to be overriden if cgroups aren't realized (#3246)

unit_set_slice() fails with -EBUSY if the unit already has a slice associated
with it.  This makes it impossible to override slice through dropin config or
over dbus.  There's no reason to disallow slice changes as long as cgroups
aren't realized.  Fix it.

Fixes #3240.

Signed-off-by: Tejun Heo <htejun@fb.com>
Reported-by: Davide Cavalca <dcavalca@fb.com>
8 years agoMerge pull request #3253 from alshopov/master
Zbigniew Jędrzejewski-Szmek [Sat, 14 May 2016 16:52:59 +0000 (12:52 -0400)]
Merge pull request #3253 from alshopov/master

Bulgarian translation of systemd

8 years agonamespace: unmount old /dev under our new private /dev (#3254)
topimiettinen [Sat, 14 May 2016 16:46:23 +0000 (16:46 +0000)]
namespace: unmount old /dev under our new private /dev (#3254)

Drop all dangling old /dev mounts before mounting a new private /dev tree.

8 years agoSort LINGUAS similar to Makefile.am:dist_catalog_DATA
Alexander Shopov [Sat, 14 May 2016 11:00:02 +0000 (14:00 +0300)]
Sort LINGUAS similar to Makefile.am:dist_catalog_DATA

8 years agopo, catalog - add Bulgarian translation
Alexander Shopov [Wed, 11 May 2016 07:02:04 +0000 (10:02 +0300)]
po, catalog - add Bulgarian translation

8 years agonspawn: drop spurious newline
Lennart Poettering [Thu, 12 May 2016 18:14:58 +0000 (20:14 +0200)]
nspawn: drop spurious newline

8 years agoupdate TODO
Lennart Poettering [Thu, 12 May 2016 18:14:46 +0000 (20:14 +0200)]
update TODO

8 years agocore: added ListUnitsByNames dbus method (#3182)
kayrus [Thu, 12 May 2016 16:58:59 +0000 (18:58 +0200)]
core: added ListUnitsByNames dbus method (#3182)

This new method returns information by unit names. Instead of ListUnitsByPatterns
this method returns information of inactive and even unexisting units.
Moved dbus unit reply logic into a separate shared function.
Resolves https://github.com/coreos/fleet/pull/1418

8 years agoCreate initrd-root-device.target synchronization point (#3239)
Daniel Drake [Thu, 12 May 2016 16:42:39 +0000 (10:42 -0600)]
Create initrd-root-device.target synchronization point (#3239)

Add a synchronization point so that custom initramfs units can run
after the root device becomes available, before it is fsck'd and
mounted.

This is useful for custom initramfs units that may modify the
root disk partition table, where the root device is not known in
advance (it's dynamically selected by the generators).

8 years agologind: introduce LockedHint and SetLockedHint (#3238)
Victor Toso [Wed, 11 May 2016 17:34:13 +0000 (19:34 +0200)]
logind: introduce LockedHint and SetLockedHint (#3238)

Desktop environments can keep this property up to date to allow
applications to easily track session's Lock status.

8 years agocoredump: use next_datagram_size_fd instead of ioctl(FIONREAD) (#3237)
Evgeny Vereshchagin [Wed, 11 May 2016 12:29:24 +0000 (15:29 +0300)]
coredump: use next_datagram_size_fd instead of ioctl(FIONREAD) (#3237)

We need to be sure that the size returned here actually matches what we will read with recvmsg() next

Fixes #2984

8 years agoMerge pull request #3220 from keszybz/install-fixes
Lennart Poettering [Tue, 10 May 2016 14:44:29 +0000 (16:44 +0200)]
Merge pull request #3220 from keszybz/install-fixes

Fix "preset-all" with dangling symlinks and install-section hint emitted too eagerly

8 years agoman: document the nfs mount option bg as unsupported (#3231)
tblume [Tue, 10 May 2016 14:20:03 +0000 (16:20 +0200)]
man: document the nfs mount option bg as unsupported (#3231)

The nfs mount option bg will not be supported with systemd.

Reasons are discussed here:
https://github.com/systemd/systemd/pull/3169