Commit Graph

24461 Commits

Author SHA1 Message Date
Jonathon Kowalski 791cd15993 Fail RequisiteOf units with oneshots
Fixes: #11422

Oneshots going to inactive directly without ever entering UNIT_ACTIVE is
considered success. This however means that if something both Requires=
and Requisites= a unit of such nature, the verify-active job getting
merged into the start job makes it lose this property of failing the
depending jobs, as there, the start job has the result JOB_DONE on
success, so we never walk over RequisiteOf units.

This change makes sure that such units always go down. It is also only
meaningful with After=, but so is Requisite= itself. Also, we also catch
cases like a oneshot having RemainAfterExit= true making us start up
properly in such a setting, but then removing it, reloading the unit,
and restarting it. In such a case, we go down due to restart propagation
before them, and our start job waits on theirs, properly failing with
the JOB_DEPENDENCY result.

This covers cases where ConditionXYZ= creates a similar situation as
well.
2019-02-15 13:42:54 +01:00
Thomas Haller a15ff62d76 netlink: fix netlink type for routing-rule FRA_L3MDEV
Fixes: bce67bbee3
2019-02-15 20:18:27 +09:00
Lennart Poettering 84e4b0b893
Merge pull request #11716 from ssahani/drop-autoconf-address
networkd: ipv6ra allow to ignore addresses
2019-02-15 12:17:46 +01:00
Lennart Poettering bbd8598f8b
Merge pull request #11589 from yuwata/udevd-is-device-busy
udevd: refactoring is_device_busy()
2019-02-15 12:16:37 +01:00
Michael Olbrich 646876105f v4l_id: use device_caps if available
According to the specification[1] the 'capabilities' describe the physical
device as a whole and the 'device_caps' describe the current device node.
The existence of 'device_caps' is indicated by the V4L2_CAP_DEVICE_CAPS
capability flag.
Use the 'device_caps' if available to generate the correct
ID_V4L_CAPABILITIES for the current device node.

This is relevant for UVC devices with current kernels: Two /dev/videoX
devices exist for those. One for video and one for metadata. The
 V4L2_CAP_VIDEO_CAPTURE flag is present in the 'capabilities' for both
device nodes but only in the 'device_caps' of the video device node.

Without this, the ID_V4L_CAPABILITIES of the metadata device node
incorrectly contains 'capture'.

[1] https://www.linuxtv.org/downloads/v4l-dvb-apis-new/uapi/v4l/vidioc-querycap.html
2019-02-15 12:14:05 +01:00
Lennart Poettering eca3d5d567
Merge pull request #9594 from filbranden/cpu_quota_period1
core: add CPUQuotaPeriodSec=
2019-02-15 12:11:42 +01:00
Lennart Poettering 5c5c21835a
Merge pull request #11634 from yuwata/rfe-11622
busctl: add 'emit' command
2019-02-15 11:56:32 +01:00
Lennart Poettering a0279563d7
Merge pull request #11719 from yuwata/networkctl-wildcards
networkctl: accept wildcards to specify links
2019-02-15 11:44:24 +01:00
Thomas Haller 13f1fd0376 dhcp: ignore padding of 'chaddr' in DHCP server response
The "chaddr" field is 16 bytes long, with "hlen" being the
length of the address.

https://tools.ietf.org/html/rfc2131#section-4.3.1 says:

    The server MUST return to the client:

    ...

    o Any parameters specific to this client (as identified by
      the contents of 'chaddr' or 'client identifier' in the DHCPDISCOVER
      or DHCPREQUEST message), e.g., as configured by the network
      administrator,

It's not clear, whether only the first 'hlen' bytes of 'chaddr'
must correspond or all 16 bytes.

Note that https://tools.ietf.org/html/rfc4390#section-2.1 says for IPoIB

    "chaddr" (client hardware address) field MUST be zeroed.

with having "hlen" zero. This indicates that at least in this case, the
bytes after "hlen" would matter.

As the DHCP client always sets the trailing bytes to zero, we would expect
that the server also replies as such and we could just compare all 16 bytes.
However, let's be liberal and accept any padding here.

This in practice only changes behavior for infiniband, where we
previously would enforce that the first ETH_ALEN bytes are zero.
That seems arbitrary for IPoIB. We should either check all bytes or
none of them. Let's do the latter and don't enforce RFC 4390 in this
regard.
2019-02-15 11:41:06 +01:00
Lennart Poettering 8e6b3f49fe
Merge pull request #11636 from yuwata/network-in-addr-is-null
network, sd-netlink: unify several functions and fixes coding style
2019-02-15 11:40:34 +01:00
Lennart Poettering 683a1e7fd9
Merge pull request #11594 from yuwata/udev-rule-cleanups
udev-rule, ethtool: several coding style cleanups
2019-02-15 11:37:11 +01:00
Lennart Poettering 19df3047f3
Merge pull request #9262 from ssahani/ignore-carrier-9111
networkd: allow to retain configs even if carrier is lost
2019-02-15 11:35:43 +01:00
Lennart Poettering bd0a4a3da8
Merge pull request #11617 from topimiettinen/backlight-handle-zero-file-load
backlight: handle loading truncated file
2019-02-15 11:32:58 +01:00
Lennart Poettering dcf3c3c3d9 core: export $PIDFILE env var for services, derived from PIDFile= 2019-02-15 11:32:19 +01:00
Lennart Poettering 7ca9289ca2
Merge pull request #11373 from tomty89/auto
mount/generators: do not make unit wanted by its device unit
2019-02-15 11:31:55 +01:00
Lennart Poettering e5d21c24a0
Merge pull request #11382 from keszybz/udev-predictable-macs
Allow MACAddressPolicy=persistent for all virtual devices
2019-02-15 11:31:25 +01:00
Lennart Poettering c49adafa82
Merge pull request #11506 from bl33pbl0p/reload-fix
Return -EAGAIN instead of -EALREADY from unit_reload
2019-02-15 11:31:00 +01:00
Yu Watanabe fe3ab8458b login: add a missing error check for session_set_leader()
session_set_leader() may fail. If it fails, then manager_start_scope()
will trigger assertion.

This may be related to RHBZ#1663704.
2019-02-15 11:29:34 +01:00
Yu Watanabe a696290474 networkctl: accept wildcards to specify links
Closes #10840.
2019-02-15 13:47:48 +09:00
Filipe Brandenburger 527ede0c63 core: downgrade CPUQuotaPeriodSec= clamping logs to debug
After the first warning log, further messages are downgraded to LOG_DEBUG.
2019-02-14 11:04:42 -08:00
Filipe Brandenburger 10f2864111 core: add CPUQuotaPeriodSec=
This new setting allows configuration of CFS period on the CPU cgroup, instead
of using a hardcoded default of 100ms.

Tested:
- Legacy cgroup + Unified cgroup
- systemctl set-property
- systemctl show
- Confirmed that the cgroup settings (such as cpu.cfs_period_ns) were set
  appropriately, including updating the CPU quota (cpu.cfs_quota_ns) when
  CPUQuotaPeriodSec= is updated.
- Checked that clamping works properly when either period or (quota * period)
  are below the resolution of 1ms, or if period is above the max of 1s.
2019-02-14 11:04:42 -08:00
Filipe Brandenburger 7b61ce3c44 time-util: Introduce parse_sec_def_infinity
This works like parse_sec() but defaults to USEC_INFINITY when passed an
empty string or only whitespace.

Also introduce config_parse_sec_def_infinity, which can be used to parse
config options using this function.

This is useful for time options that use "infinity" for default and that
can be reset by unsetting them.

Introduce a test case to ensure it works as expected.
2019-02-14 11:04:42 -08:00
Tom Yan d0fe45cb15 mount: remove unused mount_is_auto and mount_is_automount 2019-02-15 00:16:54 +08:00
Tom Yan 142b8142d7 mount/generators: do not make unit wanted by its device unit
As device units will be reloaded by systemd whenever the corresponding device generates a "changed" event, if the mount unit / cryptsetup service is wanted by its device unit, the former can be restarted by systemd unexpectedly after the user stopped them explicitly. It is not sensible at all and can be considered dangerous. Neither is the behaviour conventional (as `auto` in fstab should only affect behaviour on boot and `mount -a`) or ever documented at all (not even in systemd, see systemd.mount(5) and crypttab(5)).
2019-02-15 00:16:54 +08:00
Susant Sahani 062c2eea3a networkd: ipv6ra allow to ignore addresses
Allows to ignore prefixes.

```
UseAutonomousPrefix=
UseOnLinkPrefix=
```

closes #9582
2019-02-14 21:05:17 +05:30
Lennart Poettering 6d586a1371 sd-bus: if we receive an invalid dbus message, ignore and proceeed
dbus-daemon might have a slightly different idea of what a valid msg is
than us (for example regarding valid msg and field sizes). Let's hence
try to proceed if we can and thus drop messages rather than fail the
connection if we fail to validate a message.

Hopefully the differences in what is considered valid are not visible
for real-life usecases, but are specific to exploit attempts only.
2019-02-14 10:27:37 +01:00
Zbigniew Jędrzejewski-Szmek dc9cced4ac
Merge pull request #11704 from yuwata/fix-oss-fuzz-12980
udev-rule: make rule_add_key() return negative errno when too much tokens
2019-02-13 23:27:12 +01:00
Peter Hutterer dc4b6f8d2c sd-hwdb: fix matching for characters with an ord > 127
Devices like the "Microsoft Microsoft® 2.4GHz Transceiver v9.0 Mouse" contain
characters higher than 127. That ® is correctly stored in the hwdb and passed
into the search field during query, but the comparison fails.

Our search string is a const char *, trie_string() returns a const char * but
the current character is cast to uint8_t. This causes anything over 127 to
fail the match. Fix this, we're dealing with characters everywhere here after
all.
2019-02-13 23:19:20 +01:00
Zbigniew Jędrzejewski-Szmek 0471921b3e
Merge pull request #11487 from poettering/unprotect-errno
Make sure NSS modules can change errno if they want
2019-02-13 23:18:13 +01:00
Yu Watanabe 31cbd20253 udev: check whether systemd is running, and do not use cg_kill() if not
Fixes #11645.
2019-02-13 17:07:56 +01:00
Yu Watanabe 6e2efb6c73 udev-rule: make rule_add_key() return negative errno when too much tokens
As OPTIONS= rule introduce multiple tokens.

Fixes oss-fuzz#12980.
2019-02-13 04:14:21 +09:00
Susant Sahani 0e2fdb83bb networkd: honour LinkLocalAddressing
Closes #9890
2019-02-13 02:36:15 +09:00
Alberts Muktupāvels 52c6c9eaec core: when we uninstall a job, add unit to dbus queue
Commit e6d05912cb added unit to dbus
queue on job install. Do same on job uninstall to make sure we get
PropertiesChanged signal.
2019-02-12 16:55:45 +01:00
Stephan E ac8956efa2 Update mount.c
typo in output
2019-02-13 00:41:57 +09:00
Yu Watanabe 76b9bdd96f udev-rule: check function retun value is negative or not, instead of non-zero
One exception is udev_event_spawn(), which returns negative or positive
value on failure.
2019-02-12 11:03:40 +09:00
Yu Watanabe 605aa52f83 udev-rule: make match_key() and match_attr() return boolean value 2019-02-12 11:03:40 +09:00
Yu Watanabe bb175a0338 udev-rule: drop unnecessary parentheses 2019-02-12 11:03:40 +09:00
Yu Watanabe ee60be466b ethtool: make find_feature_index() return negative errno 2019-02-12 11:03:40 +09:00
Yu Watanabe 704dbfb279 udev-rule: make get_key() return negative errno 2019-02-12 11:03:40 +09:00
Yu Watanabe 1f362ff185 udev-rule: drop unnecessary assignments 2019-02-12 11:03:39 +09:00
Yu Watanabe ef660d072f udev-rule: propagate error cause in add_token() 2019-02-12 11:03:39 +09:00
Zbigniew Jędrzejewski-Szmek 14648b762f test-json: do not pass ephemeral array as intializer to JSON_BUILD_STRV
Fixes #11600.

The code was effectively doing:
  json_build(..., ({ char **_x = ((char**) ((const char*[]) {"one", "two", "three", "four", NULL })); _x; }));
but there was no guarantee that the storage for the array that _x points to
survives pass the end of the block. Essentially, STRV_MAKE cannot be used
inline inside of a block like this.
2019-02-11 11:53:07 +01:00
Yu Watanabe 4624289279 network/tunnel: fix log message 2019-02-11 01:29:56 +09:00
Yu Watanabe b7c2bb4c9e network: refuse AF_UNSPEC for Tunnel devices 2019-02-11 01:29:56 +09:00
Yu Watanabe 9e64c1f8b5 network: unify netdev_{ipip,sit}_fill_message_create() 2019-02-11 01:29:56 +09:00
Yu Watanabe 3affe303d3 network: unify netdev_vti{,6}_fill_message_create() 2019-02-11 01:29:56 +09:00
Yu Watanabe 10490d9025 network/geneve: fix log message 2019-02-11 01:29:49 +09:00
Yu Watanabe 434094864c network: use netlink_message_append_{in_addr,sockaddr}_union() 2019-02-11 01:28:09 +09:00
Yu Watanabe 67b19a4961 sd-netlink: unify sd_netlink_message_append_in{,6}_addr() and _sockaddr_in{,6}() 2019-02-11 01:28:09 +09:00
Yu Watanabe bd930cbdeb network: shorten code by using SYNTHETIC_ERRNO() 2019-02-11 01:28:09 +09:00