Commit Graph

35222 Commits

Author SHA1 Message Date
Yu Watanabe 738c74d7b1 test-execute: also check python3 is installed or not 2018-09-21 00:45:00 +09:00
Yu Watanabe 767eab4750 test-process-util: skip several verifications when running in unprivileged container 2018-09-21 00:44:29 +09:00
Yu Watanabe 9590065f37 test-fs-util: skip some tests when running in unprivileged container 2018-09-21 00:44:29 +09:00
Yu Watanabe cd90ec7544 test-seccomp: add log messages when skipping tests 2018-09-21 00:32:44 +09:00
Yu Watanabe 92f6a1b6bc test-process-util: logs something when skipping tests 2018-09-21 00:32:36 +09:00
Yu Watanabe 80f1b34442 sd-hwdb: initialize variable
The variable 'fn' was not initialized on compat mode.

Fixes CID#1395731.
2018-09-20 14:28:03 +02:00
João Paulo Rechi Vita 5c86583cf8 tmpfiles: Order tmpfiles-setup after journald
systemd-tmpfiles-setup.service needs to be ordered after
systemd-journald.service, so entries in /run/log/journal are already
created when systemd-tmpfiles tries to adjust its permissions.

This is specially problematic for setups using a volatile journal where
the initrd does not ship a machine-id (i.e. OSTree-based systems), where
logs from the initrd will be inaccessible for users in the
systemd-journal group. It also has a side effect of `journalctl --user`
failing with "No journal files were opened due to insufficient
permissions".

Fixes #10128.
2018-09-20 13:20:41 +02:00
Zbigniew Jędrzejewski-Szmek 3f491cccef meson: fix dirname/basename confusion in meson-and-wants.sh install helper (#10126)
We would create a useless empty directory under build/.
It seems we were lucky and all symlinks were installed into directories
which were alredy created because we installed something into the same
location earlier.

While at it, also add '-v' to 'mkdir -p'. This will print the names of
directories as they are created (just once), making it easier to see all of
what the install script is doing.
2018-09-20 16:01:58 +09:00
Patrik Flykt 65dd5e3105 networkd-manager: Fix route removals on shutdown
In order to shut down networkd properly, the delegated routes added
need to be removed properly, and as error reporting is wanted, the
network link is needed in the debug output.

Solve this by calling manager_dhcp6_prefix_remove_all(), which will
remove each prefix stored in the Manager structure, and while doing
that reference each link so that it isn't freed before the route
removal callback is called. This in turn causes the network link to
be referenced once more, and an explicit hashmap_remove() must be
called to remove the network link from the m->links hashmap.

Also, since the registered callback is not called when the DHCPv6
client is stopped with sd_dhcp6_client_stop(), an explicit call
to dhcp6_lease_pd_prefix_lost() needs to be made to clean up any
unreachable routes set up for the delegated prefixes.
2018-09-19 13:45:18 -06:00
Patrik Flykt e1d737ef9d networkd-manager: Update logging of route additions and removals
Log route additions and removals when the action is to be done, as
the reply rtnl message may contain only a success or failure.
2018-09-19 13:45:18 -06:00
Patrik Flykt 7c881490c1 sd-dhcp6-client: Reference and unreference a stored lease
In order to be able to properly free a DHCPv6 lease, unreference the
previous lease and reference the new one.
2018-09-19 13:45:18 -06:00
Patrik Flykt e9c9605293 networkd-dhcp6: Remove functions whose output is not used
Remove dhcp6_reset_pd_prefix_network() that returns the network, but
whose output is not used anywhere.
2018-09-19 13:45:18 -06:00
Patrik Flykt 494c868d1f networkd-dhcp6: Set one unreachable route per DHCPv6 delegated prefix
Instead of setting many small unreachable routes for each of the /64
subnets that were not distributed between the links requesting delegated
prefixes, set one unreachable route for the size of the delegated
prefix. Each subnet asssigned to a downstream link will add a routable
subnet for that link, and as the subnet assigned to the downstream link
has a longer prefix than the whole delegated prefix, the downstream
link subnet routes are preferred over the unroutable delegated one.
The unreachable route is not added when the delegated prefix is exactly
a /64 as the prefix size cannot be used to sort out the order of routing
into a bigger blocking subnet with the smaller /64 punching routable
"holes" into it.

When stopping the DHCPv6 client, the unroutable delegated prefix is
removed before the downstream link prefixes are unassigned.
2018-09-19 13:45:18 -06:00
Patrik Flykt 9a7225de67 dhcp6-client: Store lease timeouts T1 and T1 in client struct
Since we now have the possibility to request prefixes to be delegated
without corresponding IPv6 addresses, it does not make sense to store
lease T1 and T2 timeouts in the otherwise unused IA_NA structure.
Therefore lease timeouts T1 and T2 are moved to the DHCPv6 client
structure, as there will be only one set of stateful timeouts required
by RFC 7550, Section 4.3.
2018-09-19 13:45:18 -06:00
Patrik Flykt 134ebaa45e dhcp6-client: Select T1 and T2 timeouts from IA_NA and IA_PD
Select T1 and T2 timeouts based on whether addresses or prefixes were
requested and what the server offered. The address and prefix timeouts
values have been computed earlier when the relevant DHCPv6 options were
parsed.
2018-09-19 13:45:18 -06:00
Patrik Flykt 49228c7520 dhcp6-lease: Add function to fetch the IAID for the prefix
Add function to fetch the IAID for the delegated IA_PD prefix. In
order to keep things simple in the implemntation, the same IAID
is used with IA_NA addresses and IA_PD prefixes. But the DHCPv6
server can choose to return only IA_PD prefixes, and the client
can nowadays omit requesting of IA_NA addresses. Since the function
fetching said IAID from the lease looks only for IA_NA ones, it
will return an empty IAID, which of course does not match the one
set for prefixes.

Fix this by adding a function returning the IAID for the prefix.
2018-09-19 13:45:18 -06:00
Patrik Flykt 125f20b4de networkd-network: Introduce DHCPv6 PD knob for RFC 7084 WPD-4
RFC 7084, WPD-4, requires Customer Edge end routers to behave
according to the following:

"WPD-4:  By default, the IPv6 CE router MUST initiate DHCPv6 prefix
           delegation when either the M or O flags are set to 1 in a
           received Router Advertisement (RA) message.  Behavior of the
           CE router to use DHCPv6 prefix delegation when the CE router
           has not received any RA or received an RA with the M and the
           O bits set to zero is out of scope for this document."

Since it cannot be automatically detected whether DHCPv6 is to be
operated as an CE end router or whether to initiate an Informational
exchange to obtain other useful network information via DHCPv6 when the
Router Advertisement 'O' bit is set, a 'ForceDHCPv6PDOtherInformation'
boolean network configuration option in the '[DHCP]' section of a is
introduced. Setting this option causes DHCPv6 to be started in stateful
mode, although only the 'O' bit is seen in the Router Advertisement.

When 'ForceDHCPv6PDOtherInformation' is set and the Router Advertisement
has only the Other information 'O' bit set, disable requests for IA_NA
addresses.

Fixes #9745.
2018-09-19 13:45:17 -06:00
Patrik Flykt 7776f2aeff dhcp6-client: Add tests for address, information and prefix requests
Add simple test cases to ensure the request for addresses, prefixes
and information request are handled as expected.
2018-09-19 13:45:17 -06:00
Patrik Flykt f311a62bef dhcp6-client: Function for enabling/disabling IA_NA request
Add function to enable/disable IA_NA address requests. Internally
handle the request as a bit mask and add IA_PD prefix delegation
to the same bit mask instead of having a separate boolean. Thus
the calling code can set requests for prefix and address delegation
separately. This is handy when supporting RFC 7084.

Add a check in the code that at least something is requested from
the server in Managed mode. By default request IA_NA addresses from
the DHCPv6 server. Although a value has been defined for IA_TA,
temporay IA_TA addresses are not yet requested.
2018-09-19 13:45:17 -06:00
Patrik Flykt d8c51121bb dhcp6_client: Add helper for fetching Prefix Delegation information
Add helper function for fetching enabled/disabled state of Prefix
Delegation for a DHCPv6 client. Update function setting prefix
delegation to use an int instead of a boolean.
2018-09-19 13:45:17 -06:00
Zbigniew Jędrzejewski-Szmek 214bd9f310
Merge pull request #10113 from yuwata/unify-hwdb
hwdb,udevadm: unify duplicated code and move it to hwdb-util.c
2018-09-19 13:34:01 +02:00
Yu Watanabe d6609f8280 hwdb,udevadm: also unify hwdb_query() and hwdb_test() 2018-09-19 17:38:07 +09:00
Yu Watanabe e3b9fd0a27 sd-hwdb: use structured initializers 2018-09-19 17:36:19 +09:00
Yu Watanabe 6a34639e76 hwdb: unify duplicated code and move it to hwdb-util.c
Both 'systemd-hwdb update' and 'udevadm hwdb --update' creates hwdb
database. The database created by systemd-hwdb containes additional
information such that priority, line number, and source filename.
The unified function 'hwdb_update()' can take a flag 'compat' which
controls the format version of created database.
2018-09-19 17:36:03 +09:00
Yu Watanabe 73c63957d2 sd-hwdb: adjust included headers 2018-09-19 16:52:59 +09:00
Yu Watanabe 4d7783e937 hwdb: use _cleanup_ attribute at one more place 2018-09-19 16:52:59 +09:00
Yu Watanabe bf84dc168c hwdb: make trie_node_cleanup() can take NULL 2018-09-19 16:52:59 +09:00
javitoom 124b3686f9 Remove trailing space
Remove trailing space
2018-09-19 09:44:21 +02:00
javitoom 89686d7436 hwdb: Add accelerometer orientation quirk for the Teclast X98 Plus I (A5C6) tablet
Add accelerometer orientation quirk for the Teclast X98 Plus I (A5C6) tablet.
2018-09-19 09:44:21 +02:00
Yu Watanabe cf37f937ee nspawn: suppress one more log message when --quiet is passed
Fixes #10119.
2018-09-19 08:42:17 +02:00
Tony Novak 296b233d09 Support for Kensington Expert Mouse in hwdb
Fixes #10120.
2018-09-19 08:17:23 +02:00
Zbigniew Jędrzejewski-Szmek 5030a9393a
Merge pull request #10112 from yuwata/typesafe-qsort
tree-wide: use typesafe_qsort() or friends
2018-09-19 08:15:58 +02:00
Yu Watanabe dc5f9c6f39 busctl,sd-lldp: explicitly specify type of argument in compare function
Several functions are shared by qsort and hash_ops or Prioq.
This makes these functions explicitly specify argument type,
and cast to __compar_fn_t where necessary.
2018-09-19 08:28:54 +09:00
Yu Watanabe bc861c2e09 tree-wide: use typesafe_bsearch() or typesafe_bsearch_r() 2018-09-19 08:08:03 +09:00
Yu Watanabe f0f6d791fe util: introduce typesafe_bsearch() and typesafe_bsearch_r() 2018-09-19 08:06:57 +09:00
Yu Watanabe ba0a7bfb98 tree-wide: use typesafe_qsort_r() 2018-09-19 08:05:13 +09:00
Yu Watanabe 5532395be7 util: introduce typesafe_qsort_r() 2018-09-19 08:04:40 +09:00
Yu Watanabe 93bab28895 tree-wide: use typesafe_qsort() 2018-09-19 08:02:52 +09:00
Arseny Maslennikov b8e8823e63 udev: Fix "strtol" -> "strtoul" for unsigned source values 2018-09-18 20:13:42 +03:00
Arseny Maslennikov cdd63a03ce udev: Provide a fallback for IPoIB device port numbers
In older kernels IPoIB network devices expose the port number via
the sysfs attribute 'dev_id', which is not intended to be used this way.
Let's support both options for a while.
2018-09-18 20:13:42 +03:00
Arseny Maslennikov a0d415da3a udev: Disable HW-address-based naming for IB NICs
An InfiniBand network address is 20 bytes long. Only the least
significant 8 bytes can be interpreted as a persistent hardware unit
identifier; the other 12 are transiently derived at runtime from metadata
specific to the protocol stack.

However, since the network interface name length is hard-capped by
IFNAMSIZ at 16 chars and the 2-byte type prefix with '\0' at the end
leave us only at 13, we cannot squeeze a descriptive representation of a
HW address into an interface name. Thus, it makes the most sense to drop
the scheme for IPoIB interfaces entirely.

Currently udev just gets confused and does what it has been taught
to do: fetches the first six bytes and puts them into a permanent
device attribute.
2018-09-18 20:13:42 +03:00
Arseny Maslennikov 938d30aa98 udev: Introduce predictable naming for InfiniBand NICs
We've long neglected IP-over-InfiniBand network interfaces, let's treat
them the same way we treat anyone else.

IPoIB interfaces will retain the 'ib' prefix; otherwise the naming scheme
is the same one we use for other network interfaces. E.g. a IPoIB network
device provided by a PCI card at bus 21 slot 0 function 6 will be named
'ibp21s0f6'.
2018-09-18 20:13:42 +03:00
Zbigniew Jędrzejewski-Szmek 6058516a14 detect-virt: do not try to read all of /proc/cpuinfo
Quoting https://github.com/systemd/systemd/issues/10074:
> detect_vm_uml() reads /proc/cpuinfo with read_full_file()
> read_full_file() has a file max limit size of READ_FULL_BYTES_MAX=(4U*1024U*1024U)
> Unfortunately, the size of my /proc/cpuinfo is bigger, approximately:
> echo $(( 4* $(cat /proc/cpuinfo | wc -c)))
> 9918072
> This causes read_full_file() to fail and the Condition test fallout.

Let's just read line by line until we find an intersting line. This also
helps if not running under UML, because we avoid reading as much data.
2018-09-18 16:53:36 +02:00
Yu Watanabe 010d436e02 verbs: reset optind (#10116)
optind may be used in each verb, e.g., udevadm. So, let's initialize
optind before calling verbs.

Without this, e.g., udevadm -d hwdb --update causes error in parsing arguments.
2018-09-18 16:24:58 +02:00
Alexander Filippov 047de7e1b1 core: fix the check if CONFIG_CGROUP_BPF is on
Since the commit torvalds/linux@fdb5c4531c
the syscall BPF_PROG_ATTACH return EBADF when CONFIG_CGROUP_BPF is
turned off and as result the bpf_firewall_supported() returns the
incorrect value.

This commmit replaces the syscall BPF_PROG_ATTACH with BPF_PROG_DETACH
which is still work as expected.

Resolves openbmc/linux#159
See also systemd/systemd#7054

Signed-off-by: Alexander Filippov <a.filippov@yadro.com>
2018-09-18 16:19:51 +02:00
Zbigniew Jędrzejewski-Szmek eda7ed3363
Merge pull request #10114 from yuwata/namespace-logs
namespace: log message cleanups
2018-09-18 11:21:59 +02:00
Yu Watanabe aca835ed2e core/execute: do not use the negative errno when setup_namespace() returns -ENOANO
Without this, log shows meaningless error message 'No anode', e.g.,
===
Failed to unshare the mount namespace: Operation not permitted
foo.service: Failed to set up mount namespacing: No anode
foo.service: Failed at step NAMESPACE spawning /usr/bin/test: No anode
===

Follow-up for 1beab8b0d0.
2018-09-18 14:31:09 +09:00
Yu Watanabe 2e4a4faea8 core/namespace: add more log messages 2018-09-18 14:31:09 +09:00
Jon Ringle 5ff030402f doc: Fix link to CONTRIBUTING.md (#10109) 2018-09-18 12:29:36 +09:00
Evgeny Vereshchagin c1342d5597 tests: make UBSan print full backtraces
This should make it easier to get backtraces that can be
pasted into issues like https://github.com/systemd/systemd/issues/10096.
2018-09-16 19:16:07 +02:00