1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-25 06:03:40 +03:00

51344 Commits

Author SHA1 Message Date
Luca Boccassi
2d4efd1dba build tests: check that Github pages can be built successfully 2021-05-19 23:25:34 +02:00
Lennart Poettering
2adcf6f4f7
Merge pull request #19662 from yuwata/memdup
util: make memdup() or friends safer
2021-05-19 23:24:55 +02:00
Lennart Poettering
ed056c560b
Merge pull request #19653 from poettering/greedy-realloc-more
malloc_usable_size() tweaks
2021-05-19 23:22:44 +02:00
Lennart Poettering
374c80df67
Merge pull request #19603 from yuwata/network-link-get-by-name
network: introduce link_get_by_name() and use it in resolving interface name specifier in MultiPathRoute=
2021-05-19 21:35:48 +02:00
Lennart Poettering
aa4d11a4eb
Merge pull request #19656 from yuwata/network-trivial-cleanups
network: several trivial cleanups
2021-05-19 21:34:59 +02:00
Franck Bui
0495728429 kbd-model-map: add mapping 'es-dvorak'
And update test-keymap-util accordingly.

While at it, make sure to use tabs everywhere.
2021-05-19 21:34:40 +02:00
Yu Watanabe
834f3ba1a0 test: reduce debugging logs in test-event
The logs mostly give no information, but fill CI results.
2021-05-19 21:34:17 +02:00
Lennart Poettering
1d406dceb7 systemctl: re-align colon in status output 2021-05-19 21:33:59 +02:00
Lennart Poettering
319a4f4bc4 alloc-util: simplify GREEDY_REALLOC() logic by relying on malloc_usable_size()
We recently started making more use of malloc_usable_size() and rely on
it (see the string_erase() story). Given that we don't really support
sytems where malloc_usable_size() cannot be trusted beyond statistics
anyway, let's go fully in and rework GREEDY_REALLOC() on top of it:
instead of passing around and maintaining the currenly allocated size
everywhere, let's just derive it automatically from
malloc_usable_size().

I am mostly after this for the simplicity this brings. It also brings
minor efficiency improvements I guess, but things become so much nicer
to look at if we can avoid these allocation size variables everywhere.

Note that the malloc_usable_size() man page says relying on it wasn't
"good programming practice", but I think it does this for reasons that
don't apply here: the greedy realloc logic specifically doesn't rely on
the returned extra size, beyond the fact that it is equal or larger than
what was requested.

(This commit was supposed to be a quick patch btw, but apparently we use
the greedy realloc stuff quite a bit across the codebase, so this ends
up touching *a*lot* of code.)
2021-05-19 16:42:37 +02:00
Lennart Poettering
99480504d4 alloc-util: add MALLOC_ELEMENTSOF() helper
This is a wrapper around malloc_usable_size() but is typesafe, and
divides by the element size.

A test it is also added ensuring what it does it does correcly.
2021-05-19 16:42:19 +02:00
Lennart Poettering
6df28e1f84 alloc-util: introduce MALLOC_SIZEOF_SAFE() helper
It's a wrapper around malloc_usable_size() that is supposed to be
compatible with _FORTIFY_SOURCES=1, by taking the
__builtin_object_size() data into account, the same way as the
_FORTIFY_SOURCES=1 logic does.

Fixes: #19203
2021-05-19 16:42:00 +02:00
Lennart Poettering
871a3a33bb
Merge pull request #19608 from keszybz/resolved-pahole
Pahole optimization for resolved's DnsQuery
2021-05-19 16:35:16 +02:00
Yu Watanabe
6db7b533c6
Merge pull request #19163 from sipraga/online-if-required
network: introduce an online state that respects RequiredForOnline=
2021-05-19 23:08:18 +09:00
Luca Boccassi
a9833ed01d
Merge pull request #19659 from keszybz/mkosi-naming-adjustment
Mkosi dependency naming adjustment
2021-05-19 14:33:56 +01:00
Yu Watanabe
550721c2e3 alloc-util: use memcpy_safe() in memdup() or friends 2021-05-19 21:22:23 +09:00
Yu Watanabe
d1f3b08098 memory-util: make memcpy_safe() return pointer to destination 2021-05-19 21:20:49 +09:00
Frantisek Sumsal
943edd04b5
Merge pull request #19661 from keszybz/restore-liquid-compatibility
Restore liquid compatibility
2021-05-19 13:58:35 +02:00
Zbigniew Jędrzejewski-Szmek
ba777d019f docs: prettify two external links 2021-05-19 13:53:51 +02:00
Zbigniew Jędrzejewski-Szmek
c9d311c787 docs: use {% raw %} to wrap jinja2 tags in documentation
As reported by @mrc0mmand:
> Since 89f52a780e (diff-b842e6ab4a95a695d9449d106f091e6a134d9eac8d2aee1cd8b169fcb6b3a98bR109)
> the GH pages fail to build, since they use the Liquid templating language,
> which coincidentally uses a very similar tags as jinja:
> https://shopify.github.io/liquid/tags/control-flow/
>
>> The tag elif on line 112 in HACKING.md is not a recognized Liquid tag.
2021-05-19 13:53:51 +02:00
Frantisek Sumsal
31db4c20ea test: reintroduce m4 dependency for TEST-06-SELINUX
m4 is required to build the test SELinux module:

```
[   31.321789] sh[483]: /bin/sh: line 1: m4: command not found
[   31.882668] sh[488]: Compiling targeted systemd_test module
[   32.120862] sh[492]: /bin/sh: line 1: m4: command not found
[   32.159897] sh[458]: make: *** [/usr/share/selinux/devel/include/Makefile:156: tmp/systemd_test.mod] Error 127
```
2021-05-19 13:01:07 +02:00
Zbigniew Jędrzejewski-Szmek
c648c176bc mkosi: stop pulling in vi
We have 'nano' everywhere, and it's enough for a casual edit.
2021-05-19 10:55:03 +02:00
Zbigniew Jędrzejewski-Szmek
6c72b0b737 mkosi/fedora: use pkgconfig virtual provides to refer to packages
... and /usr/bin/ path for a library package which provides an executable we
care about (libxslt).

This way the mkosi dependency list corresponds directly to the names which are
used in the dependency() and find_program() lines in meson.build. It also makes
the thing more resilient to package splits and renames.
2021-05-19 10:54:08 +02:00
Zbigniew Jędrzejewski-Szmek
ded2e247e2 mkosi/fedora: drop python3-devel req
I think it was only used for building the python wrappers.

C.f. ec9ca01d16.
2021-05-19 10:54:04 +02:00
Yu Watanabe
70a2d9dd31 network: route: check validity of interface name in MultiPathRoute= 2021-05-19 16:28:53 +09:00
Yu Watanabe
8ed87c4983 network: route: parse earlier if device specifier in MultiPathRoute= is ifindex 2021-05-19 16:28:53 +09:00
Yu Watanabe
0b54c87081 network: introduce link_get_by_name() 2021-05-19 16:28:53 +09:00
Yu Watanabe
8e4b1b35bc network: drop redundant condition
When Network::unmanaged is set, then the Network object is not assigned
to any Link object. Hence, the condition is always false.
2021-05-19 16:25:02 +09:00
Yu Watanabe
3a1dfdb43f network: drop unnecessary call of manager_rtnl_process_address()
The reply should be NLMSG_DONE or NLMSG_ERROR.
Moreover, calling the function for reply of address label configuration
is completely wrong.
2021-05-19 16:17:23 +09:00
Yu Watanabe
f4cc13646f network: drop unused "callback" arguments in route_remove() and address_remove() 2021-05-19 10:38:57 +09:00
Yu Watanabe
50b7477064 network: dhcp4: re-request DHCP4 address and routes immediately
It is not necessary to wait for removal is finished, as network queue
already do the same thing.
2021-05-19 10:38:57 +09:00
Alvin Šipraga
7e59cfe951 man: describe overall online status in networkctl(1) 2021-05-19 10:34:06 +09:00
Alvin Šipraga
1940b3a7cd networkd-test: support online state in networkctl status output
networkctl status now outputs an online state. Fix up the tests to
account for this.
2021-05-19 10:34:06 +09:00
Alvin Šipraga
4a481ec4ae network: show online state in networkctl status output
In case the link online state is invalid, networkctl will print
"unknown", which is sufficiently neutral. The same goes for the overall
manager online state if there are no managed links, or if
RequiredForOnline=no for all managed links.

Example output:

  $ networkctl status
  ●        State: routable
    Online state: partial
         Address: 172.22.0.130 on wlan0
  ...

  $ networkctl status wlan0
  ● 3: wlan0
               Link File: /lib/systemd/network/99-default.link
            Network File: /etc/systemd/network/50-wlan0.network
                    Type: wlan
                   State: routable (configured)
            Online state: online
  ...
2021-05-19 10:34:06 +09:00
Alvin Šipraga
553022c4af man: clarify RequiredFamilyForOnline= behaviour for online state
With new "online state" semantics in networkd, make the description of
RequiredFamilyForOnline= a little more broad. Some rewording has been
done to make the passage easier to understand.
2021-05-19 10:34:06 +09:00
Alvin Šipraga
6c95e09388 man: clarify RequiredForOnline= behaviour for online state
With new "online state" semantics in networkd, make the description of
RequiredForOnline= a little more broad.
2021-05-19 10:34:06 +09:00
Alvin Šipraga
84a257ab65 network: use the overall online state in network_is_online()
Since networkd advertises a reliable online state, use it in
network_is_online(). If for some reason networkd does not know the
online state (e.g. it does not manage any of the network interfaces),
fall back to the original best-guess logic.
2021-05-19 10:34:06 +09:00
Alvin Šipraga
bcdcc59648 network: add an online state for links and manager
Add a new state of type LinkOnlineState which indicates whether a link
is online or not. The state is also used by networkd's manager to expose
the overall online state of the system.

The possible states are:

  offline  the link (or system) is offline
  partial  at least one required link is online (see below)
  online   all required links are online

For links, a link is defined to be "online" if:
  - it is managed; and
  - its operational state is within the range defined by
    RequiredForOnline=; and
  - it has an IPv4 address if RequiredFamilyForOnline=ipv4 or =both; and
  - it has an IPv6 address if RequiredFamilyForOnline=ipv6 or =both.

A link is defined to be "offline" if:
  - it is managed; and
  - it is not online, i.e. its operational state is not within the range
    defined by RequiredForOnline=, and/or it is missing an IP address in
    a required address family.

Otherwise, the link online state is undefined (represented internally as
_LINK_ONLINE_STATUS_INVALID or -EINVAL). Put another way, networkd will
only offer a meaningful online state for managed links where
RequiredForOnline=yes.

For the manager, the online state is a function of the online state of
all links which are requried for online, i.e. RequiredForOnline=yes. If
all required links are online, then the manager online state is defined
to be "online". If at least one of the required links is online, then
the manager online state is defined to be "partial". If none of
the required links are online, then the manager online state is defined
to be "offline". If there are no managed links, or RequiredForOnline=no
for all managed links, then the manager online state is undefined as
above.

The purpose of the "partial" state is analogous to the --any switch in
systemd-networkd-wait-online.service(8). For example, a required link
which lacks a carrier on boot will not force the overall (manager)
online state to "offline" if there is an alternative link available.
2021-05-19 10:33:55 +09:00
Yu Watanabe
e7901aba14
Merge pull request #19611 from yuwata/network-dhcp-server-introduce-server-address
network: dhcp-server: introduce ServerAddress= setting
2021-05-19 10:29:43 +09:00
Yu Watanabe
734b3115d6
Merge pull request #19631 from yuwata/network-fix-reference-counting-issues
network: fix reference counting issues
2021-05-19 10:29:16 +09:00
Yu Watanabe
6b87254ad1
Merge pull request #19630 from keszybz/jinja2
Use jinja2 for templating
2021-05-19 10:27:21 +09:00
Zbigniew Jędrzejewski-Szmek
89f52a780e docs/HACKING: add note about template engines 2021-05-19 10:25:26 +09:00
Zbigniew Jędrzejewski-Szmek
17a2017f69 meson: add workaround for old meson
Recent meson versions include the directory name in the target name,
so there is no conflict for files with the same name in different
directories. But at least with meson-0.49.2 in buster we have conflict
with sysusers.d/systemd.conf.
2021-05-19 10:25:26 +09:00
Zbigniew Jędrzejewski-Szmek
392ed18542 ci: drop py2 lxml, pull in jinja2 2021-05-19 10:25:26 +09:00
Zbigniew Jędrzejewski-Szmek
71ae5ce544 units: generate ReadWritePaths= in the template 2021-05-19 10:25:26 +09:00
Zbigniew Jędrzejewski-Szmek
491bf10c80 meson: sort conf paths alphabetically
The order was a complete mess. Let's make it a bit more tidy.
2021-05-19 10:25:26 +09:00
Zbigniew Jędrzejewski-Szmek
23b8071d47 man: use readable names for entities
Let's use the same names as in the jinja2 substitutions.
2021-05-19 10:25:26 +09:00
Zbigniew Jędrzejewski-Szmek
fd3a3e31b3 meson: drop "_YES_NO" variables
We can generate the right string in the template directly.
2021-05-19 10:25:26 +09:00
Zbigniew Jędrzejewski-Szmek
46c4f8dc8a meson: use jinja2 also for custom-entities.ent
This doesn't matter too much, but makes things a bit more consistent.
A minor advantage is that the file is not a configuration file for meson
anymore, so:
 a) It is not built unless pulled in by another target. Since
    we don't usually build man pages by default, this saves a tiny
    amount of work.
 b) When the .in file is updated, meson does not reconfigure everything,
    but just rebuilds the dependent targets.

Now that the conversion is finished, time for benchmarking:
a full build with default settings (and -Dstandalonebinaries=true), yields

before this pull request: 1687 targets, 148.13s user 35.17s system 317% cpu 57.697 total
with the full pull request: 1714 targets, 143.07s user 27.87s system 314% cpu 54.369 total

The difference doesn't seem significant. Partial rebuilds might be faster as
mentioned before.
2021-05-19 10:25:26 +09:00
Zbigniew Jędrzejewski-Szmek
b1ac8498ac meson: drop "substs"
We had two big 'configuration_data' objects in meson config. (There are in fact
more. On is added in this series, and there's one for efi… But those others
have a handful variables only for specific purposes and don't matter). The two
sets are 'conf' and 'substs', and were inherited from the original autotools
system. In the past there was even a third set ('m4_defines'), but @yuwata
removed it in 348b44372f36010d48d9a7dda14ef67155753a71. And those two/three
systems had very similar data, but with different variable names, because of
historical reasons. They also used subtly different quoting (.set()
vs. .set10() vs. .set_quoted()), which was required because the templating
engines were not flexible enough. This meants we had more work when changing
things, and we needed to search for different variable names, etc.

With a more flexible templating engine we can do with just one
configuration_data object.
2021-05-19 10:25:26 +09:00
Zbigniew Jędrzejewski-Szmek
5908656c57 meson: use jinja2 in shell-completion/ 2021-05-19 10:25:26 +09:00