Commit graph

38423 commits

Author SHA1 Message Date
Anita Zhang 7ca69792e5 core: add ':' prefix to ExecXYZ= skip env var substitution 2019-02-20 17:58:14 +01:00
Lennart Poettering 542e546010
Merge pull request #11556 from yuwata/udev-ctrl-use-sd-event
udev: make `udevadm control` send multiple control commands in a single connection
2019-02-20 17:55:28 +01:00
Lennart Poettering eb5149ba74
Merge pull request #11682 from topimiettinen/private-utsname
core: ProtectHostname feature
2019-02-20 14:12:15 +01:00
Topi Miettinen 99894b867f units: enable ProtectHostname=yes 2019-02-20 10:50:44 +02:00
Topi Miettinen aecd5ac621 core: ProtectHostname= feature
Let services use a private UTS namespace. In addition, a seccomp filter is
installed on set{host,domain}name and a ro bind mounts on
/proc/sys/kernel/{host,domain}name.
2019-02-20 10:50:44 +02:00
Franck Bui 37ed15d7ed namespace: make MountFlags=shared work again
Since commit 0722b35934, the root mountpoint is
unconditionnally turned to slave which breaks units that are using explicitly
MountFlags=shared (and no other options that would implicitly require a slave
root mountpoint).

Here is a test case:

  $ systemctl cat test-shared-mount-flag.service
  # /etc/systemd/system/test-shared-mount-flag.service
  [Service]
  Type=simple
  ExecStartPre=/usr/bin/mkdir -p /mnt/tmp
  ExecStart=/bin/sh -c "/usr/bin/mount -t tmpfs -o size=10M none /mnt/tmp && sleep infinity"
  ExecStop=-/bin/sh -c "/usr/bin/umount /mnt/tmp"
  MountFlags=shared

  $ systemctl start test-shared-mount-flag.service
  $ findmnt /mnt/tmp
  $

Mount on /mnt/tmp is not visible from the host although MountFlags=shared was
used.

This patch fixes that and turns the root mountpoint to slave when it's really
required.
2019-02-20 06:20:40 +09:00
Yu Watanabe 6371db9358 man: udevadm: mention that no control command can be specified after --exit 2019-02-20 06:17:42 +09:00
Yu Watanabe 78467aeb95 udev-ctrl: split out logic of waiting for reply to udev_ctrl_wait()
This makes `udevadm control` can send multiple commands in one
connection.
2019-02-20 06:17:42 +09:00
Zbigniew Jędrzejewski-Szmek a0b60b8a1b udevadm: print error if the commands fail
We'd exit with an error but no output. Print the error in the usual fashion.
2019-02-20 06:17:42 +09:00
Yu Watanabe d02c6f5461 udev-ctrl: use sd_event and introduce udev_ctrl_start()
Now the new callback function get enum udev_ctrl_msg_type.
So, this commit also drops udev_ctrl_connection and udev_ctrl_msg.
2019-02-20 06:17:42 +09:00
Yu Watanabe 204e9c3e29 udev: drop unused Manager::uevent_event 2019-02-20 06:17:42 +09:00
Yu Watanabe 53bba2fb1d udev-ctrl: refactor udev_ctrl_enable_receiving() 2019-02-20 06:17:42 +09:00
Yu Watanabe 100bc5bf98 udev-ctrl: make udev_ctrl_new() return negative errno on failure 2019-02-20 06:17:42 +09:00
Yu Watanabe ebf963c551 util: make base64_append() add a whitespace before appending data
Follow-up for 4bb91a950a.
2019-02-20 06:16:11 +09:00
Yu Watanabe 2dcaf38020
Merge pull request #11764 from yuwata/network-verify
network: introduce network_verify() and drop incompatible settings
2019-02-20 06:13:53 +09:00
Yu Watanabe 0cc972aac3 test-network: add tests for meaningless settings which should be ignored by networkd 2019-02-20 06:12:54 +09:00
Yu Watanabe 0321cea7b7 network: introduce network_verify()
Some settings cannot set simultaneously. Let's warn and drop
incompatible settings.

Currently, it is not comprehensive. But this may be a good first step.
2019-02-20 06:12:54 +09:00
Yu Watanabe 41f62accad network: warn about deprecated value in DHCP= 2019-02-20 06:12:53 +09:00
Yu Watanabe dffcf2b471 network: update enum value assignments for AddressFamilyBoolean 2019-02-20 06:12:48 +09:00
Yu Watanabe 71064bd5ac
Merge pull request #11759 from yuwata/fix-test-dropin
test-network: check whether ethtool support driver field for dummy interfaces
2019-02-20 06:11:11 +09:00
Yu Watanabe b1b10691be
Merge pull request #11757 from yuwata/test-udev-continuation
test-udev: add more tests for line continuations and comments
2019-02-20 06:10:37 +09:00
Yu Watanabe 232152bcb1 test-network: check whether ethtool support driver field for dummy interfaces
Fixes #11758.
2019-02-19 22:00:06 +09:00
Beniamino Galvani 22a3fd2da9 dhcp: don't stop receiving packets when the link goes down
When the link goes down, DHCP client_receive_message*() functions return an
error and the related I/O source is removed from the main loop. With the
current implementation of systemd-networkd this doesn't matter because the DHCP
client is always stopped on carrier down and restarted on carrier up. However
it seems wrong to have the DHCP client crippled (because no packet can be
received anymore) once the link goes temporarily down.

Change the receive functions to ignore a ENETDOWN event so that the client will
be able to receive packets again after the link comes back.
2019-02-19 20:19:36 +09:00
Yu Watanabe 825ace96b1 network: do not log wrong error cause
If sd_dhcp_lease_get_router() returns a positive value and the first
router is null, then invalid error cause was logged.

Follow-up for f8862395e8.
2019-02-19 20:14:27 +09:00
Yu Watanabe 4ee175454b man: drop unnecessary parenthesis 2019-02-19 11:35:54 +01:00
Yu Watanabe 798ebaf9ae
Merge pull request #11754 from poettering/bus-path-limit
sd-bus path limit fixes
2019-02-19 19:32:03 +09:00
Yu Watanabe 149b0ab25d
Merge pull request #11763 from yuwata/disable-test-dropin-driver
test-network: tentatively disable Driver field test
2019-02-19 19:27:01 +09:00
Yu Watanabe f32c600935 test-network: disable test for Driver field in networkctl
CentOS CI does not like the test. Let's at least tentatively disable the test.
2019-02-19 17:39:05 +09:00
Yu Watanabe fde66c2120 test-network: update format used by networkctl status 2019-02-19 17:38:30 +09:00
Yu Watanabe d35976c670 test-udev: add more tests for line continuations and comments 2019-02-19 09:22:45 +09:00
Yu Watanabe e37a5d90b0 test-udev: use proper semantics for too long line with continuation
Follow-up for 1e797cf596.
2019-02-19 09:21:58 +09:00
Riccardo Schirone f519a19bcd Allocate temporary strings to hold dbus paths on the heap
Paths are limited to BUS_PATH_SIZE_MAX but the maximum size is anyway too big
to be allocated on the stack, so let's switch to the heap where there is a
clear way to understand if the allocation fails.
2019-02-18 20:07:45 +01:00
Riccardo Schirone 61397a60d9 Refuse dbus message paths longer than BUS_PATH_SIZE_MAX limit.
Even though the dbus specification does not enforce any length limit on the
path of a dbus message, having to analyze too long strings in PID1 may be
time-consuming and it may have security impacts.

In any case, the limit is set so high that real-life applications should not
have a problem with it.
2019-02-18 20:07:45 +01:00
Lennart Poettering 5f06ba8018
Merge pull request #11478 from yuwata/enumerate-match-parent
sd-device-enumerator: support multiple parents
2019-02-18 18:35:47 +01:00
Alexander Tsoy 13e6f3831d resolved: correctly prove the non-existense of wildcard
* Current logic:
For each NSEC RR find the common suffix between the owner name and
the next name, append asterisk to that suffix and check that
generated wildcard is covered by the NSEC RR in question.

* New logic:
Find NSEC RR covering queried name, generate wildcard as
<asterisk>.<closest encloser> using this RR, then check if any
of the NSEC RRs covers generated wildcard.
2019-02-18 18:34:53 +01:00
Matthias Klumpp 4b05f0c9d9 core: Allow to configure execute_directories execution behavior
This adds a new bitfield to `execute_directories()` which allows to
configure whether to ignore non-zero exit statuses of binaries run and
whether to allow parallel execution of commands.
In case errors are not ignored, the exit status of the failed script
will now be returned for error reposrting purposes or other further
future use.
2019-02-18 16:16:02 +01:00
Lennart Poettering bde06abd4f
Merge pull request #10408 from keszybz/analyze-cat-presets
systemd-analyze cat-presets
2019-02-18 16:02:45 +01:00
Lennart Poettering 9c5675af76
Merge pull request #11729 from yuwata/fix-11721
sd-device: also store properties read from udev database to sd_device::properties_db
2019-02-18 16:02:26 +01:00
Lennart Poettering c014a33fac
Merge pull request #11208 from thom311/dhcp-router-option-list
dhcp: have DHCP library support multiple router entries in Router option (3)
2019-02-18 15:51:30 +01:00
Thomas Haller 202aa15976 netlink: fix routing-policy-rule integer type for FRA_TUN_ID
FRA_TUN_ID is a 64 big endian integer. Fix the policy.

FRA_TUN_ID is unused by networkd, hence I think this bug
has no actual consequences.

Fixes: bce67bbee3
2019-02-18 15:23:35 +01:00
Lennart Poettering 5bcffb4b54
Merge pull request #11457 from grooverdan/sendsigkill_no
service: killmode=cgroup|mixed, SendSIGKILL=no services are not multiprocess
2019-02-18 13:41:52 +01:00
Thomas Haller 189255d2b5 network: avoid inet_ntoa() in favor of inet_ntop()
inet_ntop() is not documented to be thread-safe, so it should not
be used in the DHCP library. Arguably, glibc uses a thread local
buffer, so indeed there is no problem with a suitable libc. Anyway,
just avoid it.
2019-02-18 13:34:22 +01:00
Thomas Haller 072320eab0 dhcp: move filtering of bogus DNS/NTP addresses out of DHCP client
The DHCP client should not pre-filter addresses beyond what RFC
requires. If a client's user (like networkd) wishes to skip/filter
certain addresses, it's their responsibility.

The point of this is that the DHCP library does not hide/abstract
information that might be relevant for certain users. For example,
NetworkManager exposes DHCP options in its API. When doing that, the
options should be close to the actual lease.

This is related to commit d9ec2e632d
(dhcp4: filter bogus DNS/NTP server addresses silently).
2019-02-18 13:34:22 +01:00
Thomas Haller f8862395e8 dhcp: handle multiple addresses for "Router" (option 3) in DHCP library
The Router DHCP option may contain a list of one or more
routers ([1]). Extend the API of sd_dhcp_lease to return a
list instead of only the first.

Note that networkd still only uses the first router (if present).
Aside from extending the internal API of the DHCP client, there
is almost no change in behavior. The only visible difference in
behavior is that the "ROUTER" variable in the lease file is now a
list of addresses.

Note how RFC 2132 does not define certain IP addresses as invalid for the
router option. Still, previously sd_dhcp_lease_get_router() would never
return a "0.0.0.0" address. In fact, the previous API could not
differenciate whether no router option was present, whether it
was invalid, or whether its first router was "0.0.0.0". No longer let
the DHCP client library impose additional restrictions that are not
part of RFC. Instead, the caller should handle this. The patch does
that, and networkd only consideres the first router entry if it is not
"0.0.0.0".

[1] https://tools.ietf.org/html/rfc2132#section-3.5
2019-02-18 13:34:22 +01:00
Thomas Haller c24b682162 network: don't return allocated buffer of zero length from deserialize_in_addrs()
deserialize_in_addrs() allocates the buffer before trying to parse
the IP address. Since a parsing error is silently ignored, the returned
size might be zero. In such a case we shouldn't return any buffer.

Anyway, there was no leak, because there are only two callers like

    r = deserialize_in_addrs(&lease->dns, dns);

which both keep the unused buffer and later release it.

Note that deserialize_in_addrs() doesn't free the pointer before
reassigning the new output. The caller must take care to to pass
"ret" with an allocated buffer that would be leaked when returning
the result.
2019-02-18 13:32:06 +01:00
Lennart Poettering 1ff3e129ae
Merge pull request #11746 from yuwata/udev-rules-cleanup
udev-rules: several cleanups for udev-rules.c
2019-02-18 13:05:34 +01:00
Yu Watanabe 3d61d3a03f meson: drop unused HAVE_STRUCT_FIB_RULE_{UID,PORT}_RANGE 2019-02-18 13:00:45 +01:00
Lennart Poettering 1cfece4a45
Merge pull request #11681 from yuwata/network-link-enslaved-operstate
network: introduce new 'enslaved' operstate
2019-02-18 13:00:13 +01:00
Lennart Poettering 702451b038
Merge pull request #11698 from yuwata/fix-network-route-table
network: honor specified route table
2019-02-18 12:58:32 +01:00
Yu Watanabe 380d19016e udev-event: make subst_format_var() always provide null-terminated string on success
Fixes #11731.
2019-02-18 12:54:53 +01:00