Commit graph

24827 commits

Author SHA1 Message Date
Lennart Poettering 350f9518ac logind: refactor logic of returning polkit challenge result into its own function
Let's share some code.
2019-03-05 16:52:46 +01:00
Lennart Poettering 97af80c5a7 systemctl: add support for booting into boot menu/entry
(This also removes support for booting into the EFI firmware setup
without logind. That's because otherwise the non-EFI fallback logind
implements can't work.)

Fixes: #9896
2019-03-05 16:52:46 +01:00
Lennart Poettering 31b221cf5e logind: add support for booting into the boot menu or a specific boot menu entry
This behaves similar to the "boot into firmware" logic, and also allows
either direct EFI operation (which sd-boot supports and others might
support eventually too) or override through env var.
2019-03-05 16:52:46 +01:00
Lennart Poettering eed7210a5c bootspec: validate bootpsec entry ids before we use them 2019-03-05 16:50:58 +01:00
Lennart Poettering 38bd74d67e bootspec: get rid of find_default_boot_entry() entirely
Now only two operations are left. Let's just move this into the caller,
since it should make things simpler, clearer and shorter, in particular
as there's only a single user for this.
2019-03-05 16:50:58 +01:00
Lennart Poettering b1a8771996 bootspec: rework find_default_boot_entry() to use boot_entries_load_config_auto()
it's pretty much the same code now, hence use it.
2019-03-05 16:50:58 +01:00
Lennart Poettering eea4ce1ec7 bootspec: introduce new helper boot_entries_load_config_auto()
It's a simple wrapper around boot_entries_load_config(), but determines
the ESP/XBOOTLDR paths automatically at first. Also, it looks for a path
/run/boot-loader-entries/ and loads the entries from there if it
exists. This is supposed to be a hook for other boot loaders to make our
tools aware of their own entries.
2019-03-05 16:50:58 +01:00
Lennart Poettering dba33c4a2c bootspec: correct error code shown in log msg 2019-03-05 16:50:58 +01:00
Lennart Poettering 93f14ce28d bootspec: move augmentation of loader-discovered entries into bootspec.c
Previously, bootctl would show boot loader entries discovered by the
boot loader which couldn't found locally separately in the output.

Let's move this code into bootspec.c, and beef it up a bit. This way we
can use it later on for logind, and correctly show automatically
discovered windows/macos entries too.
2019-03-05 16:50:58 +01:00
Lennart Poettering 5b1da1ba6d bootspec: simplify find_default_boot_entry()
If the only caller passes NULL for the two paths, let's remove the
parameter altogether.
2019-03-05 16:50:58 +01:00
Lennart Poettering c943e95f89 systemctl: let's FORK_WAIT where we can 2019-03-05 16:50:58 +01:00
Lennart Poettering 0f88d82979 systemctl: when something is not supported use EOPNOTSUPP 2019-03-05 16:50:58 +01:00
Lennart Poettering 78c38fe79c systemctl: be careful with boot loader entries lacking a 'linux' line
A boot loader entry might not have a 'linux' line, but an 'efi' line or
something else. Let's handle that case nicely.
2019-03-05 16:50:58 +01:00
Lennart Poettering 7800322ca5 bootspec: move log msg from systemctl.c to bootspec.c
find_default_boot_entry() is only used by systemctl.c, and currently
handles one log message in the caller instead of the callee. Let's
simplify that and move it over, too
2019-03-05 16:50:58 +01:00
Lennart Poettering 4629499e7f bootctl: tweak 'list' output a bit
Let's suppress the final newline in the list if it's the last entry we
are outputting.
2019-03-05 16:50:58 +01:00
Lennart Poettering e667266a74 logind: optionally support non-EFI reboot-to-firmware
This extends the reboot-to-firmware logic in logind, so that other than
EFI firmwares could be theoretically support. The scheme is like this:
if you want to support this, set the $SYSTEMD_REBOOT_TO_FIRMWARE=1 env
var for logind. If so, this will override the EFI logic, and cause a
file /run/systemd/reboot-to-firmware file to be created when
reboot-to-firmware is requested. This file has no contents, it's mere
existance indicates a reboot with reboot-to-firmware set.

The idea is that for alternative firmwares a drop-in for logind is added
that sets the env var, in combination with some code run during shutdown
that checks for the file and does the right thing.
2019-03-05 16:50:58 +01:00
Lennart Poettering 3279692370 efivars: extend character set that may be used in boot loader entry ids a bit
See https://github.com/systemd/systemd/pull/10495#discussion_r233992570
2019-03-05 16:22:17 +01:00
Zbigniew Jędrzejewski-Szmek bea3d64a73
Merge pull request #11896 from poettering/shutdown-fixes
move src/core/shutdown.c and helpers to src/shutdown/
2019-03-05 15:36:03 +01:00
Lennart Poettering 55dadc5c57 core: warn if people use the undocumented/depreacted ConditionNull=
Triggered by:

https://github.com/systemd/systemd/issues/11812
2019-03-05 13:54:20 +01:00
Franck Bui 3c37dadf62 udev: restore debug level when logging a failure in the external prog called by IMPORT{program}
It was already the case before commit a75211421f,
which upgraded the log to warning.

This seems an unintended side effect as the commit message doesn't mention it
and the old behavior looks more appropriate.
2019-03-05 13:53:25 +01:00
Lennart Poettering 9e71f5d983 shutdown: rearrange shutdown sources in source tree
Let's move the shutdown binary into its own subdirectory in
src/shutdown, after all it is relatively isolated from the normal PID 1
sources, being a different binary and all.

Unfortunately it's not possible to move some of the code, since it is
shared with PID 1, that I wished we could move, but I still think it's
worth it.
2019-03-05 12:21:17 +01:00
Lennart Poettering 3a736a3216 shutdown: (void)ify more stuff 2019-03-05 12:21:17 +01:00
Lennart Poettering 66034f9c07 shutdown: fix up return type of sync_making_progress()
We shouldn't return negative errnos as "bool", hence fix the type of the
function to "int".
2019-03-05 12:21:17 +01:00
Lennart Poettering 73622e02fb
Merge pull request #11881 from yuwata/networkd-vs-interface-renaming
Networkd vs interface renaming
2019-03-05 10:05:57 +01:00
Yu Watanabe 39a15c8a8d udev: run programs in the specified order
This fixes bugs introduced by 29448498c7
and d838e14515.

Previously, RUN and SECLABEL keys are stored in udev_list with its unique
flag is false. If the flag is false, then udev_list is just a linked
list and new entries are always added in the last.
So, we should use OrderedHashmap instead of Hashmap.

Fixes #11368.
2019-03-05 09:27:29 +01:00
Yu Watanabe 23041689ca dhcp: refuse to configure DHCP IAID if the interface is under renaming
systemd-networkd itself does not start dhcp client, but the code
may be used in other projects. So, check that the interface is under
renaming or not.
2019-03-05 12:48:26 +09:00
Yu Watanabe 299ad32d48 network: do not configure interfaces under renaming 2019-03-05 10:33:42 +09:00
Yu Watanabe 90ba130f00 util: introduce device_is_renaming()
It will be used in the later commit.
2019-03-05 10:33:41 +09:00
Yu Watanabe 30de2b89d1 network: always drop configs when interface is renamed
Before the renaming, wrong .network file may be assigned to the link.
So, let's always drop link configuration.
2019-03-05 10:33:27 +09:00
Yu Watanabe a4055a608e udev: set ID_RENAMING property when interface renaming is requested
And drop the property on the corresponding 'move' uevent.
2019-03-05 10:31:35 +09:00
Yu Watanabe 6d0fdf4513 udev: do not read UdevEvent object before checking it is non-NULL 2019-03-05 10:31:20 +09:00
Yu Watanabe 589384be8d udev: drop unnecessary copy of new interface name 2019-03-05 10:02:09 +09:00
Yu Watanabe 4d64309955 netlink: check new interface name is valid or not before sending request 2019-03-05 10:02:09 +09:00
Lennart Poettering bb5e88a226
Merge pull request #11841 from keszybz/dns-packet-speedup
DNS packet speedup
2019-03-04 19:30:23 +01:00
Lennart Poettering 1788875576
Merge pull request #11871 from yuwata/systemctl-show-format-unprintable
systemctl: format many entries in 'show' command
2019-03-04 19:04:27 +01:00
Lennart Poettering 38ba8c8874
Merge pull request #11888 from keszybz/non-atomic
Drop unused atomic operations
2019-03-04 19:03:46 +01:00
Zbigniew Jędrzejewski-Szmek dffb827772 resolved: when adding RR to an answer, avoid comparing keys twice
We'd call dns_resource_record_equal(), which calls dns_resource_key_equal()
internally, and then dns_resource_key_equal() a second time. Let's be
a bit smarter, and call dns_resource_key_equal() only once.

(before)
dns_resource_key_hash_func_count=514
dns_resource_key_compare_func_count=275
dns_resource_key_equal_count=62371
4.13s user 0.01s system 99% cpu 4.153 total

(after)
dns_resource_key_hash_func_count=514
dns_resource_key_compare_func_count=276
dns_resource_key_equal_count=31337
2.13s user 0.01s system 99% cpu 2.139 total
2019-03-04 15:53:37 +01:00
Zbigniew Jędrzejewski-Szmek 51969a5893 resolve: split the RR comparison function in two
No functional change.
2019-03-04 15:53:37 +01:00
Zbigniew Jędrzejewski-Szmek 2d34cf0c16 resolved: use a temporary Set to speed up dns question parsing
This doesn't necessarily make things faster, because we still spend more time
in dns_answer_add(), but it improves the compuational complexity of this part.
If we even make dns_resource_key_equal_faster, this will become worthwhile.
2019-03-04 15:53:37 +01:00
Yu Watanabe 305a285092 systemctl: format LogExtraFields= in 'show' command 2019-03-04 23:45:07 +09:00
Yu Watanabe 4c787df72f systemctl: format BindPaths= or TemporaryFileSystems= in 'show' command 2019-03-04 23:45:07 +09:00
Yu Watanabe 04749e4003 systemctl: print RestrictAddressFamilies= in 'show' command 2019-03-04 23:45:07 +09:00
Yu Watanabe 48d3358db1 systemctl: show nothing if no LoadError= 2019-03-04 23:45:07 +09:00
Yu Watanabe 56c6b69007 systemctl: format IPIngressBytes= or friends nicely 2019-03-04 23:45:07 +09:00
Yu Watanabe 9c1f946566 systemctl: show IPAddressAllow= and IPAddressDeny= in 'show' command 2019-03-04 23:45:07 +09:00
Yu Watanabe 9201eea137 test: add tests for test_in_addr_prefix_to_string() 2019-03-04 23:45:07 +09:00
Yu Watanabe 146cf7f05b test: move tests for in_addr_prefix_from_string() 2019-03-04 23:45:07 +09:00
Yu Watanabe d9143dac3e util: introduce in_addr_prefix_to_string() 2019-03-04 23:45:07 +09:00
Yu Watanabe 81260be12e util: use _cleanup_ attributes 2019-03-04 23:45:07 +09:00
Yu Watanabe a672f4fe8d core: fix received size of signal or status size
sd_bus_message_read_array() returns size of array in bytes, not number
of elements.

This also convert int to int32_t, as the dbus type 'i' is int32_t.
2019-03-04 23:44:29 +09:00