rinrinne [Fri, 3 Jul 2015 10:13:35 +0000 (19:13 +0900)]
Fix error message for enumerate addresses
Error message for enumerating addresses was not 'addresses' but 'links'.
This patch fixes it.
Lennart Poettering [Fri, 3 Jul 2015 08:11:33 +0000 (10:11 +0200)]
Merge pull request #473 from richardmaw-codethink/machinectl-import-earlier-than-3-15
util: fall back in rename_noreplace when renameat2 isn't implemented
Gerd Hoffmann [Mon, 29 Jun 2015 07:42:11 +0000 (09:42 +0200)]
login: add rule for qemu's pci-bridge-seat
Qemu provides a separate pci-bridge exclusively for multi-seat setups.
The normal pci-pci bridge ("-device pci-bridge") has 1b36:0001. The new
pci-bridge-seat was specifically added to simplify guest-side
multiseat configuration. It is identical to the normal pci-pci bridge,
except that it has a different id (1b36:000a) so we can match it and
configure multiseating automatically.
Make sure we always treat this as separate seat if we detect this, just
like other "Pluggable" devices.
(David: write commit-message)
Richard Maw [Thu, 2 Jul 2015 13:04:34 +0000 (13:04 +0000)]
util: fall back in rename_noreplace when renameat2 isn't implemented
According to README we only need 3.7, and while it may also make sense
to bump that requirement when appropriate, it's trivial to fall back
when renameat2 is not available.
Zbigniew Jędrzejewski-Szmek [Thu, 2 Jul 2015 13:41:32 +0000 (09:41 -0400)]
Merge pull request #472 from keszybz/documentation-updates2
Documentation updates
Zbigniew Jędrzejewski-Szmek [Thu, 2 Jul 2015 13:25:59 +0000 (09:25 -0400)]
Merge pull request #470 from marineam/escape
escape: fix exit code
Zbigniew Jędrzejewski-Szmek [Thu, 2 Jul 2015 13:24:04 +0000 (09:24 -0400)]
Merge pull request #427 from keszybz/man-list-fixes
Update Makefile-man.am after recent changes and fix regeneration of Makefile-man.am
Fixes fallout from https://github.com/systemd/systemd/pull/282.
Zbigniew Jędrzejewski-Szmek [Tue, 30 Jun 2015 00:34:45 +0000 (20:34 -0400)]
man: update sysctl example about netfilter
It turns out that since kernel 3.18 netfilter on bridged packets
is off anyway, so the example should be reworded (and the module
name updated).
Zbigniew Jędrzejewski-Szmek [Tue, 30 Jun 2015 00:19:56 +0000 (20:19 -0400)]
man: information about available properties
https://bugzilla.redhat.com/show_bug.cgi?id=1144496
David Herrmann [Thu, 2 Jul 2015 10:14:27 +0000 (12:14 +0200)]
sd-bus: don't leak kdbus notifications
When we get notifications from the kernel, we always turn them into
synthetic dbus1 messages. This means, we do *not* consume the kdbus
message, and as such have to free the offset.
Right now, the translation-helpers told the caller that they consumed the
message, which is wrong. Fix this by explicitly releasing all kernel
messages that are translated.
Michael Marineau [Thu, 2 Jul 2015 06:46:42 +0000 (23:46 -0700)]
escape: fix exit code
r == 0 indicates success, not failure
Daniel Mack [Wed, 1 Jul 2015 23:26:01 +0000 (19:26 -0400)]
Merge pull request #409 from teg/networkd-enslave-segfault
fix segfault when cancelling enslaving of links by netdevs
Daniel Mack [Wed, 1 Jul 2015 23:01:28 +0000 (19:01 -0400)]
Merge pull request #466 from rivanvx/master
timedatectl: trim non-local RTC warning to 80 chars wide
Vedran Miletić [Wed, 1 Jul 2015 22:13:31 +0000 (00:13 +0200)]
timedatectl: trim non-local RTC warning to 80 chars wide
Daniel Mack [Wed, 1 Jul 2015 20:52:02 +0000 (16:52 -0400)]
Merge pull request #459 from ctrochalakis/reuse-port-before-bind
socket: Set SO_REUSEPORT before bind()
Daniel Mack [Wed, 1 Jul 2015 17:45:33 +0000 (13:45 -0400)]
Merge pull request #419 from eworm-de/man-protecthome
man: ProtectHome= protects /root as well
Daniel Mack [Wed, 1 Jul 2015 17:42:16 +0000 (13:42 -0400)]
Merge pull request #463 from dvdhrm/udev-run
udev: destroy manager before cleaning environment
David Herrmann [Wed, 1 Jul 2015 17:25:30 +0000 (19:25 +0200)]
udev: destroy manager before cleaning environment
Due to our _cleanup_ usage for the udev manager, it will be destroyed
after the "exit:" label has finished. Therefore, it is the last
destruction done in main(). This has two side-effects:
- mac_selinux is destroyed before the udev manager is, possible causing
use-after-free if the manager-cleanup accesses selinux data
- log_close() is called *before* the manager is destroyed, possibly
re-opening the log if you use --debug (and thus not re-applying the
--debug option)
Avoid this by moving the manager-handling into a new function called
run(). This function will be left before we enter the "exit:" label in
main(), hence, the manager object will be destroyed early.
Kay Sievers [Wed, 1 Jul 2015 17:20:59 +0000 (19:20 +0200)]
udevd: force --debug mode to stderr
https://github.com/systemd/systemd/issues/462
David Herrmann [Wed, 1 Jul 2015 16:31:18 +0000 (18:31 +0200)]
bus-proxy: never apply policy when sending signals
Unlike dbus-daemon, the bus-proxy does not know the receiver of a
broadcast (as the kernel has exclusive access on the bus connections).
Hence, and "destination=" matches in dbus1 policies cannot be applied.
But kdbus does not place any restrictions on *SENDING* broadcasts, anyway.
The kernel never returns EPERM to KDBUS_CMD_SEND if KDBUS_MSG_SIGNAL is
set. Instead, receiver policies are checked. Hence, stop checking sender
policies for signals in bus-proxy and leave it up to the kernel.
This fixes some network-manager bus-proxy issues where NM uses weird
dst-based matches against interface-based matches. As we cannot perform
dst-based matches, our bus-proxy cannot properly implement this policy.
David Herrmann [Wed, 1 Jul 2015 13:05:01 +0000 (15:05 +0200)]
login: re-use VT-sessions if they already exist
Right now, if you start a session via 'su' or 'sudo' from within a
session, we make sure to re-use the existing session instead of creating a
new one. We detect this by reading the session of the requesting PID.
However, with gnome-terminal running as a busname-unit, and as such
running outside the session of the user, this will no longer work.
Therefore, this patch makes sure to return the existing session of a VT if
you start a new one.
This has the side-effect, that you will re-use a session which your PID is
not part of. This works fine, but will break assumptions if the parent
session dies (and as such close your session even though you think you're
part of it). However, this should be perfectly fine. If you run multiple
logins on the same session, you should really know what you're doing. The
current way of silently accepting it but choosing the last registered
session is just weird.
Daniel Mack [Wed, 1 Jul 2015 14:34:40 +0000 (10:34 -0400)]
Merge pull request #460 from xnox/bootchart-warning
bootchart: do not report warning when disk is missing model.
Dimitri John Ledkov [Wed, 1 Jul 2015 13:49:15 +0000 (14:49 +0100)]
bootchart: do not report warning when disk is missing model.
In VMs / virtio drives there is no model. Also don't print "Disk:
(null)" in output if no model is available.
Christos Trochalakis [Wed, 1 Jul 2015 11:39:53 +0000 (14:39 +0300)]
socket: Set SO_REUSEPORT before bind()
bind() fails if it is called before setting SO_REUSEPORT and another
process is already binded to the same addess.
A new reuse_port option has been introduced to socket_address_listen()
to set the option as part of socket initialization.
David Herrmann [Wed, 1 Jul 2015 11:02:58 +0000 (13:02 +0200)]
sysv-generator: fix coding-style
Fix weird coding-style:
- proper white-space
- no if (func() >= 0) bail-outs
- fix braces
- avoid 'r' for anything but errno
- init _cleanup_ variables unconditionally, even if not needed
David Herrmann [Wed, 1 Jul 2015 10:54:58 +0000 (12:54 +0200)]
Revert "kmod-setup: don't print warning on -ENOSYS"
This partially reverts commit
78d298bbc57e412574ea35e6e66f562d97fd9ebc.
The changed coding-style is kept, but the ENOENT->ENOSYS conversion is
reverted.
kmod was fixed upstream to no longer return ENOSYS. Also see:
https://git.kernel.org/cgit/utils/kernel/kmod/kmod.git/commit/?id=
114ec87c85c35a2bd3682f9f891e494127be6fb5
The kmod fix is marked for backport, so no reason to bump the kmod
version we depend on.
Martin Pitt [Wed, 1 Jul 2015 05:34:23 +0000 (07:34 +0200)]
sysv-generator test: Fix random ordering failure
test_simple_escaped() sometimes fails with
AssertionError: Lists differ: ['foo\\x2b.service', 'foo-admin.service'] != ['foo-admin.service', 'foo\\x2b.service']
We don't need to assume any order here, so compare them as a set, not a list.
Kay Sievers [Tue, 30 Jun 2015 20:32:45 +0000 (22:32 +0200)]
Merge pull request #411 from teg/udev-simplify-exec-envp
udev: event - simplify udev_event_spawn() logic
David Herrmann [Tue, 30 Jun 2015 20:15:55 +0000 (22:15 +0200)]
Merge pull request #398 from teg/netlink-container-rework
netlink container rework
Allocate containers as separate structs instead of individual arrays for each member field.
Martin Pitt [Tue, 30 Jun 2015 18:33:15 +0000 (20:33 +0200)]
Merge pull request #434 from kaysievers/wip
udev: remove WAIT_FOR key
Kay Sievers [Tue, 30 Jun 2015 17:54:37 +0000 (19:54 +0200)]
udev: remove WAIT_FOR key
This facility was never a proper solution, but only papered over
real bugs in the kernel. There are no known sysfs "timing bugs"
since a long time.
Christian Hesse [Tue, 30 Jun 2015 17:12:20 +0000 (19:12 +0200)]
man: ProtectHome= protects /root as well
Tom Gundersen [Tue, 30 Jun 2015 16:39:39 +0000 (18:39 +0200)]
Merge pull request #430 from gmacario/fix-issue404-v2
bootchart: Ensure that /proc/schedstat is read entirely (v2)
Tom Gundersen [Tue, 30 Jun 2015 16:24:14 +0000 (18:24 +0200)]
Merge pull request #429 from richardmaw-codethink/nspawn-userns-uid-shift-autodetection-fix
nspawn: determine_uid_shift before forking
Tom Gundersen [Tue, 30 Jun 2015 16:16:02 +0000 (18:16 +0200)]
Merge pull request #428 from richardmaw-codethink/nspawn-userns-remount-fail
nspawn: Don't remount with fewer options
Gianpaolo Macario [Tue, 30 Jun 2015 15:09:02 +0000 (15:09 +0000)]
bootchart: Ensure that /proc/schedstat is read entirely
On multi-core systems file /proc/schedstat may be
larger than 4096 bytes and pread() will only read part of it.
Fix issue https://github.com/systemd/systemd/issues/404
Lennart Poettering [Tue, 30 Jun 2015 14:58:35 +0000 (10:58 -0400)]
Merge pull request #424 from endocode/iaguis/shutdown-log-null
core: handle --log-target=null when calling systemd-shutdown
Richard Maw [Tue, 30 Jun 2015 13:41:41 +0000 (13:41 +0000)]
nspawn: determine_uid_shift before forking
It is needed in one branch of the fork, but calculated in another
branch.
Failing to do this means using --private-users without specifying a uid
shift always fails because it tries to shift the uid to UID_INVALID.
Richard Maw [Tue, 30 Jun 2015 13:21:14 +0000 (13:21 +0000)]
nspawn: Don't remount with fewer options
When we do a MS_BIND mount, it inherits the flags of its parent mount.
When we do a remount, it sets the flags to exactly what is specified.
If we are in a user namespace then these mount points have their flags
locked, so you can't reduce the protection.
As a consequence, the default setup of mount_all doesn't work with user
namespaces. However if we ensure we add the mount flags of the parent
mount when remounting, then we aren't removing mount options, so we
aren't trying to unlock an option that we aren't allowed to.
Zbigniew Jędrzejewski-Szmek [Tue, 30 Jun 2015 13:56:44 +0000 (09:56 -0400)]
build-sys: use wildcard glob in update-man-list again
The idea is that after adding a new man page, make update-man-list
will be used to regenerate part of the makefile. So the data already
present in the makefile cannot be used to do that.
Also, renames filter out generated xml files in make-man-rules.py
itself in order to make Makefile.am a bit simpler, and rename files
to dist_files to better reflect new meaning.
Zbigniew Jędrzejewski-Szmek [Tue, 30 Jun 2015 13:29:48 +0000 (09:29 -0400)]
build-sys: update Makefile-man
Follow up for
e6de49abfd28098c65b8a0be05bb84cf6cf780ae.
Iago López Galeiras [Tue, 30 Jun 2015 13:08:49 +0000 (15:08 +0200)]
core: handle --log-target=null when calling systemd-shutdown
When shutting down, if systemd was started with --log-target=null,
systemd-shutdown was being called with --log-target=console.
Tom Gundersen [Mon, 29 Jun 2015 21:30:14 +0000 (23:30 +0200)]
Merge pull request #412 from fsateler/sysv-invalid-names-v2
sysv-generator: detect invalid names and escape them V2
Daniel Mack [Mon, 29 Jun 2015 20:23:25 +0000 (22:23 +0200)]
Merge pull request #413 from jaystrictor/manpages
man: remove repeated word "the" and polish
Jay Strict [Mon, 29 Jun 2015 19:20:02 +0000 (21:20 +0200)]
man: remove repeated word "the" and polish
Felipe Sateler [Sun, 28 Jun 2015 00:00:32 +0000 (21:00 -0300)]
sysv-generator: escape names when translating from sysv name
While the LSB suggests only [A-Za-z0-9], that doesn't prevent admins
from doing the wrong thing. Lets not generate invalid names in
that case.
Felipe Sateler [Sun, 28 Jun 2015 00:02:53 +0000 (21:02 -0300)]
sysv-generator: detect invalid provided unit names
Do not assume that a non-service unit type is a target.
Daniel Mack [Mon, 29 Jun 2015 18:02:14 +0000 (20:02 +0200)]
Merge pull request #410 from teg/docs-gitignore
docs: remove stale .gitignore
Tom Gundersen [Sun, 28 Jun 2015 21:42:52 +0000 (23:42 +0200)]
udev: event - simplify udev_event_spawn() logic
Push the extraction of the envp + argv as close as possible to their use, to avoid code
duplication. As a sideeffect fix logging when delaing execution.
Tom Gundersen [Mon, 29 Jun 2015 17:45:10 +0000 (19:45 +0200)]
docs: remove stale .gitignore
This is no longer useful as the udev docs are gone.
Daniel Mack [Mon, 29 Jun 2015 16:58:19 +0000 (18:58 +0200)]
Merge pull request #408 from ColdPie1/fix_resp
man: Remove instances of pseudo-English "resp."
Andrew Eikum [Fri, 26 Jun 2015 16:02:00 +0000 (11:02 -0500)]
man: Remove instances of pseudo-English "resp."
Me again :) Just noticed one of these in a manpage and did another pass
to clean them up. See
16dad32e437fdf2ffca03cc60a083d84bd31886f for
explanation, though the link needs updating:
<http://transblawg.eu/2004/02/26/resp-and-other-non-existent-english-wordsnicht-existente-englische-worter/>
Tom Gundersen [Mon, 29 Jun 2015 14:02:33 +0000 (16:02 +0200)]
Merge pull request #387 from kaysievers/wip
udev: Remove accelerometer helper
Tom Gundersen [Mon, 29 Jun 2015 12:24:40 +0000 (14:24 +0200)]
networkd: netdev - avoid hanging transactions in failure cases
If a link is attempted t obe enslaved by a netdev that has already failed, we
must fail immediately and not save the callback for later, as it will then
never get triggered.
Tom Gundersen [Mon, 29 Jun 2015 12:23:17 +0000 (14:23 +0200)]
networkd: fix segfault when cancelling callbacks
This only happens when something has gone wrong, so is not easy to hit. However,
if a bridge (say) is configured on a system without bridge support we will hit
this.
Fixes issue #299.
Kay Sievers [Mon, 29 Jun 2015 08:59:35 +0000 (10:59 +0200)]
Merge pull request #403 from cedricde/patch-1
Process persistent storage rules for cciss devices
Cédric Delmas [Mon, 29 Jun 2015 07:54:58 +0000 (09:54 +0200)]
Process cciss devices
Do not skip the persistent storage rules for cciss devices
Daniel Mack [Mon, 29 Jun 2015 03:43:26 +0000 (05:43 +0200)]
Merge pull request #402 from systemd-mailing-devs/
1435512180-3659-1-git-send-email-ebiggers3@gmail.com
util: fix incorrect escape sequence in string_is_safe()
Daniel Mack [Mon, 29 Jun 2015 03:03:38 +0000 (05:03 +0200)]
Merge pull request #399 from gmacario/fix-issue341-v2
bootchart: reset list_sample_data head before generating SVG
Tom Gundersen [Sun, 28 Jun 2015 21:10:46 +0000 (23:10 +0200)]
Merge pull request #388 from fsateler/doc-pidfile-removal
systemd.service.xml: document that systemd removes the PIDFile
Eric Biggers [Sun, 28 Jun 2015 17:23:00 +0000 (12:23 -0500)]
util: fix incorrect escape sequence in string_is_safe()
Gianpaolo Macario [Sat, 27 Jun 2015 07:17:07 +0000 (07:17 +0000)]
bootchart: reset list_sample_data head before generating SVG
Until commit 1f2ecb0 ("bootchart: kill a bunch of global variables")
variable "head" was declared global and this action was performed by svg_header.
Now that "head" is local and passed to each function called by svg_do(...)
move the code at the beginning of svg_do(...) to restore the correct behaviour.
Tom Gundersen [Fri, 26 Jun 2015 10:02:53 +0000 (12:02 +0200)]
sd-netlink: message - remove unused next_rta_offset field
This was a left-over from before we supported containers.
Tom Gundersen [Thu, 25 Jun 2015 22:02:55 +0000 (00:02 +0200)]
netlink: rework containers
Instead of representing containers as several arrays, make a new
netlink_container struct and keep one array of these structs. We
also introduce netlink_attribute structs that in the future will
hold meta-information about each atribute.
Tom Gundersen [Thu, 25 Jun 2015 22:07:25 +0000 (00:07 +0200)]
sd-netlink: make a couple of helper functions static
Also rename from rtnl_* to netlink_*.
Tom Gundersen [Tue, 23 Jun 2015 11:18:18 +0000 (13:18 +0200)]
sd-netlink: mark union containers as nested
This was an oversight, they are no different from regular containers in this respect.
Felipe Sateler [Sat, 27 Jun 2015 20:25:06 +0000 (17:25 -0300)]
systemd.service.xml: document that systemd removes the PIDFile
Bastien Nocera [Sat, 27 Jun 2015 19:48:52 +0000 (21:48 +0200)]
udev: Remove accelerometer helper
It's moved to the iio-sensor-proxy D-Bus service.
Tom Gundersen [Fri, 26 Jun 2015 19:41:44 +0000 (21:41 +0200)]
Merge pull request #377 from zonque/logind
logind: fix delayed execution regression
Greg Kroah-Hartman [Fri, 26 Jun 2015 16:51:11 +0000 (09:51 -0700)]
Merge pull request #353 from kaysievers/hid
rules: remove all power management from udev
Kay Sievers [Fri, 26 Jun 2015 09:33:04 +0000 (11:33 +0200)]
Merge pull request #379 from whot/hwdb-updates
Revert "hwdb: add a touchpad hwdb"
Peter Hutterer [Fri, 26 Jun 2015 06:09:48 +0000 (16:09 +1000)]
Revert "hwdb: add a touchpad hwdb"
The main purpose of this hwdb was to tag touchpads that have the physical
trackstick buttons wired to the touchpad (Lenovo Carbon X1 3rd, Lenovo *50
series). This hwdb is not required on kernels 4.0 and above, the kernel now
re-routes button presses through the trackstick's device node. Userspace does
not need to do anything.
See kernel commit
cdd9dc195916ef5644cfac079094c3c1d1616e4c.
This reverts commit
001a247324b44c0e0b8fdba41a6fc66e7465b8b6.
Daniel Mack [Mon, 8 Jun 2015 20:58:50 +0000 (22:58 +0200)]
logind: fix delayed execution regression
Commit
c0f32805 ("logind: use sd_event timer source for inhibitor
logic") reworked the main loop logic of logind so that it uses a
real timeout callback handler to execute delayed functions.
What the old code did, however, was to call those functions on
every iteration in the main loop, not only when the timeout
expired.
Restore that behavior by bringing back manager_dispatch_delayed(),
and call it from manager_run(). The internal event source callback
manager_inhibit_timeout_handler() was turned into a wrapper of
manager_dispatch_delayed() now.
Daniel Mack [Thu, 25 Jun 2015 14:38:41 +0000 (16:38 +0200)]
Merge pull request #367 from msekletar/install-unit-file-list-assert
install: explicitly return 0 on success
Daniel Mack [Thu, 25 Jun 2015 14:37:06 +0000 (16:37 +0200)]
Merge pull request #366 from gmacario/fix-issue139-v5
bootchart: Account CPU time spent in non-main threads of processes (v5)
Michal Sekletar [Thu, 25 Jun 2015 14:06:40 +0000 (16:06 +0200)]
install: explicitly return 0 on success
Maybe there is some left-over value stored in r from previous function
call. Let's make sure we always return consistent error code when we reach end of
the function body.
Fixes following crash of test-install,
Assertion 'r == 0' failed at src/test/test-install.c:52, function main(). Aborting.
[1] 11703 abort (core dumped) ./test-install
Gianpaolo Macario [Thu, 11 Jun 2015 10:03:30 +0000 (10:03 +0000)]
bootchart: Account CPU time spent in non-main threads of processes (v5)
Fix for issue https://github.com/systemd/systemd/issues/139
- Implement fixes suggested by @teg to -v2
- Implement fixes suggested by @zonque to -v3 and -v4
Kay Sievers [Thu, 25 Jun 2015 12:36:59 +0000 (14:36 +0200)]
Merge pull request #363 from zonque/proxy
bus-proxy: ignore 'log' attributes in XML policy
Daniel Mack [Thu, 25 Jun 2015 11:13:17 +0000 (13:13 +0200)]
bus-proxy: ignore 'log' attributes in XML policy
'log' is unsupported but nothing to warn about. Ignore it just like we
ignore 'eavesdrop'.
Tom Gundersen [Thu, 25 Jun 2015 11:02:53 +0000 (13:02 +0200)]
Merge pull request #355 from dvdhrm/netlink
sd-netlink cleanups
Lennart Poettering [Wed, 24 Jun 2015 12:52:21 +0000 (08:52 -0400)]
Merge pull request #335 from aroig/gh/fix_check_unneeded
core: fix reversed dependency check in unit_check_unneeded
Lennart Poettering [Wed, 24 Jun 2015 12:40:09 +0000 (08:40 -0400)]
Merge pull request #347 from poettering/check-api-docs
build-sys: make sure check-api-docs sees each symbol just once
David Herrmann [Wed, 24 Jun 2015 11:27:34 +0000 (13:27 +0200)]
sd-netlink: don't export internal type-system details
The kernel bonding layer allows passing an array of ARP IP targets as
bond-configuration. Due to the weird implementation of arrays in netlink
(which we haven't figure out a generic way to support, yet), we usually
hard-code the supported array-sizes. However, this should not be exported
from sd-netlink.
Instead, make sure the caller just uses it's current hack of enumerating
the types, and the sd-netlink core will have it's own list of supported
array-sizes (to be removed in future extensions, btw!). If either does not
match, we will just return a normal error.
Note that we provide 2 constants for ARP_IP_TARGETS_MAX now. However, both
have very different reasons:
- the constant in netdev-bond.c is used to warn the user that the given
number of targets might not be supported by the kernel (even though the
kernel might increase that number at _any_ time)
- the constant in sd-netlink is solely used due to us missing a proper
array implementation. Once that's supported in the type-system, it can
be removed without notice
Last but not least, this patch turns the log_error() into a log_warning().
Given that the previous condition was off-by-one, anyway, it never hit at
the right time. Thus, it was probably of no real use.
David Herrmann [Tue, 23 Jun 2015 10:10:38 +0000 (12:10 +0200)]
sd-netlink: don't treat NULL as root type-system
Explicitly export the root type-system to the type-system callers. This
avoids treating NULL as root, which for one really looks backwards (NULL
is usually a leaf, not root), and secondly prevents us from properly
debugging calling into non-nested types.
Also rename the root to "type_system_root". Once we support more than
rtnl, well will have to revisit that, anyway.
David Herrmann [Tue, 23 Jun 2015 10:03:10 +0000 (12:03 +0200)]
sd-netlink: don't treat type_system->count==0 as invalid
Empty type-systems are just fine. Avoid the nasty hack in
union-type-systems that treat empty type-systems as invalid. Instead check
for the actual types-array and make sure it's non-NULL (which is even true
for empty type-systems, due to "empty_types" array).
David Herrmann [Tue, 23 Jun 2015 08:47:44 +0000 (10:47 +0200)]
sd-netlink: make sure the root-level type is nested
In sd-netlink-message, we always guarantee that the currently selected
type-system is non-NULL. Otherwise, we would be unable to parse any types
in the current container level. Hence, this assertion must be true:
message->container_type_system[m->n_containers] != NULL
During message_new() we currently do not verify that this assertion is
true. Instead, we blindly access nl_type->type_system and use it (which
might be NULL for basic types and unions). Fix this, by explicitly
checking that the root-level type is nested.
Note that this is *not* a strict requirement of netlink, but it's a strict
requirement for all message types we currently support. Furthermore, all
the callers of message_new() already verify that only supported types are
passed, therefore, this is a pure cosmetic check. However, it might be
needed on the future, so make sure we don't trap into this once we change
the type-system.
David Herrmann [Tue, 23 Jun 2015 09:54:43 +0000 (11:54 +0200)]
sd-netlink: drop NETLINK_TYPE_META
The NETLINK_TYPE_META pseudo-type is actually equivalent to an empty
nested type. Drop it and define an empty type-system instead.
This also has the nice side-effect that m->container_type_system[0] is
never NULL (which has really nasty side-effects if you try to read
attributes).
David Herrmann [Tue, 23 Jun 2015 09:46:48 +0000 (11:46 +0200)]
sd-netlink: turn 'max' into 'count' to support empty type-systems
Right now we store the maximum type-ID of a type-system. This prevents us
from creating empty type-systems. Store the "count" instead, which should
be treated as max+1.
Note that type_system_union_protocol_get_type_system() currently has a
nasty hack to treat empty type-systems as invalid. This might need some
modification later on as well.
David Herrmann [Tue, 23 Jun 2015 09:18:53 +0000 (11:18 +0200)]
sd-netlink: avoid casting size_t into int
size_t is usually 64bit and int 32bit on a 64bit machine. This probably
does not matter for netlink message sizes, but nevertheless, avoid
hard-coding it anywhere.
David Herrmann [Tue, 23 Jun 2015 09:07:59 +0000 (11:07 +0200)]
sd-netlink: make NLTypeSystem internal
Same as NLType, move NLTypeSystem into netlink-types.c and hide it from
the outside. Provide an accessor function for the 'max' field that is used
to allocate suitable array sizes.
Note that this will probably be removed later on, anyway. Once we support
bigger type-systems, it just seems impractical to allocate such big arrays
for each container entry. An RBTree would probably do just fine.
David Herrmann [Tue, 23 Jun 2015 09:03:10 +0000 (11:03 +0200)]
sd-netlink: make NLType internal
If we extend NLType to support arrays and further extended types, we
really want to avoid hard-coding the type-layout outside of
netlink-types.c. We already avoid accessing nl_type->type_system outside
of netlink-types.c, extend this to also avoid accessing any other fields.
Provide accessor functions for nl_type->type and nl_type->size and then
move NLType away from the type-system header.
With this in place, follow-up patches can safely turn "type_system" and
"type_system_union" into a real "union { }", and then add another type for
arrays.
David Herrmann [Tue, 23 Jun 2015 08:51:25 +0000 (10:51 +0200)]
sd-netlink: don't access type->type_system[_union] directly
Make sure we never access type->type_system or type->type_system_union
directly. This is an implementation detail of the type-system and we
should always use the accessors. Right now, they only exist for 2-level
accesses (type-system to type-system). This patch introduces the 1-level
accessors (type to type-system) and makes use of it.
This patch makes sure the proper assertions are in place, so we never
accidentally access sub-type-systems for non-nested/union types.
Note that this places hard-asserts on the accessors. This should be fine,
as we expect callers to only access sub type-systems if they *know*
they're dealing with nested types.
David Herrmann [Tue, 23 Jun 2015 07:56:59 +0000 (09:56 +0200)]
sd-netlink: rename NLA_ to NETLINK_TYPE_
The NLA_ names are used to name real datatypes we extract out of netlink
messages. The kernel has an internal enum with the same names
(NLA_foobar), which is *NOT* binary compatible to our types. Furthermore,
we support a different set of types than the kernel (as we try to treat
some kernel peculiarities as our own types to simplify the API).
Rename NLA_ to NETLINK_TYPE_ to make clear that this is our own set of
types.
Kay Sievers [Wed, 24 Jun 2015 11:10:07 +0000 (13:10 +0200)]
rules: remove all power management from udev
It is not udev's task to apply any of these setting that way, or
from udev rules files. Things need to be sortet out in the kernel,
or explicit whitelist can possibly be added to the hardware database.
Until that is sorted out, and general agreement, udev is not
willing to maintain any such lists or power management settings
in general.
"Thanks for digging this out! I thought my Kinesis keyboard got broken
and ordered a new one, only to find out that the new one doesn't work
as well. I'm not sure whether we should start collecting a blacklist
of keyboards which don't work with USB autosuspend, or rather a
whitelist? Or revert this wholesale?"
https://github.com/systemd/systemd/issues/340
Daniel Mack [Wed, 24 Jun 2015 08:09:43 +0000 (10:09 +0200)]
Merge pull request #346 from poettering/install-bad-memory
install: fix minor bad memory access
Kay Sievers [Wed, 24 Jun 2015 00:27:30 +0000 (02:27 +0200)]
Merge pull request #349 from systemd-mailing-devs/
1435103298-2439-1-git-send-email-jengelh@inai.de
ata_id: unbotch format specifier
Jan Engelhardt [Tue, 23 Jun 2015 23:48:18 +0000 (01:48 +0200)]
ata_id: unbotch format specifier
Commit v218-247-g11c6f69 broke the output of the utility. "%1$" PRIu64
"x" expands to "%1$lux", essentially "%lux", which shows the problem.
u and x cannot be combined, u wins as the type character, and x gets
emitted verbatim to stdout.
References: https://bugzilla.redhat.com/show_bug.cgi?id=1227503
Lennart Poettering [Tue, 23 Jun 2015 23:16:18 +0000 (19:16 -0400)]
install: fix bad memory access
Lennart Poettering [Tue, 23 Jun 2015 19:32:38 +0000 (21:32 +0200)]
build-sys: make sure check-api-docs sees each symbol just once
Given that some symbols are exposed by multiple libraries (due to the
compatibility libraries), let's ensure "make check-api-docs" only shows
each symbol once by filtering out duplicates.
Daniel Mack [Tue, 23 Jun 2015 22:12:28 +0000 (00:12 +0200)]
Merge pull request #339 from teg/udev-coverity
coverity fixes in udev