]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
4 years agomeson: use jinja2 for src/login
Zbigniew Jędrzejewski-Szmek [Sun, 16 May 2021 11:57:00 +0000 (13:57 +0200)] 
meson: use jinja2 for src/login

{% raw %} is needed to avoid trouble with {%k, which jinja thinks
is trying to access variable 'k'.

4 years agomeson: use jinja2 for tmpfiles.d templates
Zbigniew Jędrzejewski-Szmek [Sun, 16 May 2021 11:35:51 +0000 (13:35 +0200)] 
meson: use jinja2 for tmpfiles.d templates

HAVE_SMACK_RUN_LABEL was dropped back in 348b44372f36010d48d9a7dda14ef67155753a71,
so one line in etc.conf was not rendered as expected ;(
Checking if names are defined is paying for itself!

4 years agomeson: drop unnecessary listification
Zbigniew Jędrzejewski-Szmek [Sun, 16 May 2021 11:02:04 +0000 (13:02 +0200)] 
meson: drop unnecessary listification

4 years agounits: strip out the developer comment in .service unit again
Zbigniew Jędrzejewski-Szmek [Sun, 16 May 2021 17:08:50 +0000 (19:08 +0200)] 
units: strip out the developer comment in .service unit again

The comment talks about upstream development steps and doesn't make
sense for users. We used special '## ' syntax to strip it out during
build, but it got inadvertently reformatted as a normal comment
in 3982becc92197b920d86f03c3c52ae085e26ca60.

4 years agomeson: use jinja2 for unit templates
Zbigniew Jędrzejewski-Szmek [Sun, 16 May 2021 09:55:36 +0000 (11:55 +0200)] 
meson: use jinja2 for unit templates

We don't need two (and half) templating systems anymore, yay!

I'm keeping the changes minimal, to make the diff manageable. Some enhancements
due to a better templating system might be possible in the future.

For handling of '## ' — see the next commit.

4 years agomeson: replace some m4 templates with jinja2
Zbigniew Jędrzejewski-Szmek [Sun, 16 May 2021 09:55:36 +0000 (11:55 +0200)] 
meson: replace some m4 templates with jinja2

m4 was nice in '85, but the syntax feels a bit dated. Since we use python for
meson, let's use a popular python templating engine to replace some m4 usage.

A little nicety is that typos are caught:

FAILED: sysusers.d/systemd-remote.conf
/usr/bin/meson --internal exe --capture sysusers.d/systemd-remote.conf -- /home/zbyszek/src/systemd/tools/meson-render-jinja2.py config.h ../sysusers.d/systemd-remote.conf.j2
Traceback (most recent call last):
  File "/home/zbyszek/src/systemd/tools/meson-render-jinja2.py", line 28, in <module>
    print(render(sys.argv[2], defines))
  File "/home/zbyszek/src/systemd/tools/meson-render-jinja2.py", line 24, in render
    return template.render(defines)
  File "/usr/lib/python3.9/site-packages/jinja2/environment.py", line 1090, in render
    self.environment.handle_exception()
  File "/usr/lib/python3.9/site-packages/jinja2/environment.py", line 832, in handle_exception
    reraise(*rewrite_traceback_stack(source=source))
  File "/usr/lib/python3.9/site-packages/jinja2/_compat.py", line 28, in reraise
    raise value.with_traceback(tb)
  File "<template>", line 8, in top-level template code
jinja2.exceptions.UndefinedError: 'HAVE_MICROHTTP' is undefined

This checking mirrors what 349cc4a507c4d84fcadf61f42159ea6412717896 did for C defines.

4 years agomeson, mkosi: pull in jinja2 as required
Zbigniew Jędrzejewski-Szmek [Sun, 16 May 2021 13:31:00 +0000 (15:31 +0200)] 
meson, mkosi: pull in jinja2 as required

In preparation for subsequent changes.

4 years agomodules-load: inline interator variable
Zbigniew Jędrzejewski-Szmek [Fri, 7 May 2021 11:24:03 +0000 (13:24 +0200)] 
modules-load: inline interator variable

4 years agotest/run-unit-tests: make script compatible with python3.6
Zbigniew Jędrzejewski-Szmek [Tue, 18 May 2021 08:21:34 +0000 (10:21 +0200)] 
test/run-unit-tests: make script compatible with python3.6

dataclasses were added in python3.7, but bionic has python3.6.
Yes, the new code is a travesty, but it does the job.

Fixes #19640.

4 years agoman: only the system manager does not pass vars in ManagerEnvironment=
Anita Zhang [Tue, 18 May 2021 08:23:36 +0000 (01:23 -0700)] 
man: only the system manager does not pass vars in ManagerEnvironment=

User managers always pass their environment on to their children.
Make that clear in the description of ManagerEnvironment= which
states that none of those args will get passed to child processes of
service managers.

4 years agofix bash shebangs
Jörg Thalheim [Mon, 17 May 2021 18:14:39 +0000 (18:14 +0000)] 
fix bash shebangs

4 years agonspawn: bring back the word `may` in error text
Olle Lundberg [Mon, 17 May 2021 14:20:23 +0000 (16:20 +0200)] 
nspawn: bring back the word `may` in error text

In the change set 6c045a999800c62368470938307951bb669f5afc the error
text for the old flag `--private-users-chown` was repurposed for the
new flag `--private-users-ownership=own` and while doing so the word
`may` was dropped leading to a grammatically incorrect error text.

4 years agotest: Allow running only a subset of integration tests by setting SELECTED_TESTS
Balint Reczey [Mon, 10 May 2021 18:46:37 +0000 (20:46 +0200)] 
test: Allow running only a subset of integration tests by setting SELECTED_TESTS

4 years agomkosi: stop pulling in workaround packages
Zbigniew Jędrzejewski-Szmek [Mon, 17 May 2021 07:59:02 +0000 (09:59 +0200)] 
mkosi: stop pulling in workaround packages

libfido2 was pulled in recently [1], and the dependency on libzstd has been
present for a long time.

nano is now the default editor in Fedora [2], but we still want to pull it in
to have an editor in minimal images.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1949505
[2] https://fedoraproject.org/wiki/Changes/UseNanoByDefault

4 years agoci: build with gcc-11 as well
Frantisek Sumsal [Sun, 16 May 2021 10:42:08 +0000 (12:42 +0200)] 
ci: build with gcc-11 as well

Focal builds for gcc-11 are finally available, so let's put them into
some use.

4 years agoFixed a typo
ei-ke [Sun, 16 May 2021 16:12:12 +0000 (18:12 +0200)] 
Fixed a typo

4 years agodocs: Update link to journal file format codebase
Milan [Sun, 16 May 2021 09:09:34 +0000 (11:09 +0200)] 
docs: Update link to journal file format codebase

4 years agodocs: Update link to journal-def.h
Milan [Sat, 15 May 2021 21:27:23 +0000 (23:27 +0200)] 
docs: Update link to journal-def.h

4 years agonetwork:dhcp4_server_configure returns if not able to get timezone
tramsay [Mon, 5 Apr 2021 22:12:49 +0000 (17:12 -0500)] 
network:dhcp4_server_configure returns if not able to get timezone

When /etc/localtime is a symbolic link pointing to another symbolic
link, get_timezone will return -EINVAL instead of the timezone.
This issue can cause systemd-networkd DHCPServer to fail.

Instead of returning failure, log a warning indicating that that
the timezone will not be sent.

modified:   networkd-dhcp-server.c

4 years agoAdd crypttab option silent
Sebastian Blunt [Sat, 15 May 2021 03:39:54 +0000 (20:39 -0700)] 
Add crypttab option silent

Adds a crypttab option 'silent' that enables the AskPasswordFlag
ASK_PASSWORD_SILENT. This allows usage of systemd-cryptsetup to default
to silent mode, rather than requiring the user to press tab every time.

4 years agotest: combine stdout/stderr from failed test
Dan Streetman [Fri, 30 Apr 2021 00:21:10 +0000 (20:21 -0400)] 
test: combine stdout/stderr from failed test

Printing stdout and stderr from a failed test makes it harder to
interpret what the specific problem was; instead let's print out
the lines in order as we got them when the test was run

Also save failed test output to file if ARTIFACT_DIRECTORY is defined

4 years agoMerge pull request #19612 from keszybz/meson-0.58-quieting
Zbigniew Jędrzejewski-Szmek [Sat, 15 May 2021 08:49:10 +0000 (10:49 +0200)] 
Merge pull request #19612 from keszybz/meson-0.58-quieting

Make meson output quiet again

4 years agoresolved: fix braino with reference counting and linked lists
Zbigniew Jędrzejewski-Szmek [Fri, 14 May 2021 08:49:24 +0000 (10:49 +0200)] 
resolved: fix braino with reference counting and linked lists

In 0e0fd08fc832b8f42e567d722d388eba086da5ff I added reference counts to keep
track of the DnsQueryCandidate objects. Unfortunately, dns_query_unref_candidates()
was written as

     while (q->candidates)
           dns_query_candidate_unref(q->candidates);

i.e. it would keep dropping the reference count as many times as needed for it
to hit 0, making the patch less than fully effective.

dns_query_unref_candidates() is renamed to dns_query_detach_candidates() and
changed to drop exactly one reference from each of the linked candidates.

Example failure:
==463== Invalid read of size 8
==463==    at 0x419C93: dns_query_candidate_go (resolved-dns-query.c:159)
==463==    by 0x41A143: dns_query_candidate_notify (resolved-dns-query.c:304)
==463==    by 0x434BD6: dns_transaction_complete (resolved-dns-transaction.c:437)
==463==    by 0x436A0F: dns_transaction_process_dnssec (resolved-dns-transaction.c:976)
==463==    by 0x4378C1: dns_transaction_process_reply (resolved-dns-transaction.c:1387)
==463==    by 0x437CE9: on_dns_packet (resolved-dns-transaction.c:1444)
==463==    by 0x4B2DC9B: source_dispatch (sd-event.c:3512)
==463==    by 0x4B2FB1F: sd_event_dispatch (sd-event.c:4077)
==463==    by 0x4B2FFFA: sd_event_run (sd-event.c:4138)
==463==    by 0x4B301D6: sd_event_loop (sd-event.c:4159)
==463==    by 0x464A24: run (resolved.c:92)
==463==    by 0x464B3C: main (resolved.c:99)
==463==  Address 0x5f409d0 is 32 bytes inside a block of size 72 free'd
==463==    at 0x48410E4: free (vg_replace_malloc.c:755)
==463==    by 0x418EDF: mfree (alloc-util.h:48)
==463==    by 0x4197E8: dns_query_candidate_free (resolved-dns-query.c:67)
==463==    by 0x4198B7: dns_query_candidate_unref (resolved-dns-query.c:70)
==463==    by 0x41A2E3: dns_query_unref_candidates (resolved-dns-query.c:337)
==463==    by 0x41C5FE: dns_query_cname_redirect (resolved-dns-query.c:1028)
==463==    by 0x41CA04: dns_query_process_cname_one (resolved-dns-query.c:1128)
==463==    by 0x41CA80: dns_query_process_cname_many (resolved-dns-query.c:1157)
==463==    by 0x40C0BD: bus_method_resolve_hostname_complete (resolved-bus.c:198)
==463==    by 0x41B312: dns_query_complete (resolved-dns-query.c:562)
==463==    by 0x41C1AC: dns_query_accept (resolved-dns-query.c:922)
==463==    by 0x41C2C4: dns_query_ready (resolved-dns-query.c:955)
==463==    by 0x41A162: dns_query_candidate_notify (resolved-dns-query.c:314)
==463==    by 0x434BD6: dns_transaction_complete (resolved-dns-transaction.c:437)
==463==    by 0x438995: dns_transaction_prepare (resolved-dns-transaction.c:1728)
==463==    by 0x43921D: dns_transaction_go (resolved-dns-transaction.c:1928)
==463==    by 0x419C7C: dns_query_candidate_go (resolved-dns-query.c:163)
==463==    by 0x41A143: dns_query_candidate_notify (resolved-dns-query.c:304)
==463==    by 0x434BD6: dns_transaction_complete (resolved-dns-transaction.c:437)
==463==    by 0x436A0F: dns_transaction_process_dnssec (resolved-dns-transaction.c:976)
==463==    by 0x4378C1: dns_transaction_process_reply (resolved-dns-transaction.c:1387)
==463==    by 0x437CE9: on_dns_packet (resolved-dns-transaction.c:1444)
==463==    by 0x4B2DC9B: source_dispatch (sd-event.c:3512)
==463==    by 0x4B2FB1F: sd_event_dispatch (sd-event.c:4077)
==463==    by 0x4B2FFFA: sd_event_run (sd-event.c:4138)
==463==    by 0x4B301D6: sd_event_loop (sd-event.c:4159)
==463==    by 0x464A24: run (resolved.c:92)
==463==    by 0x464B3C: main (resolved.c:99)
==463==  Block was alloc'd at
==463==    at 0x483E86F: malloc (vg_replace_malloc.c:380)
==463==    by 0x418F81: malloc_multiply (alloc-util.h:96)
==463==    by 0x419378: dns_query_candidate_new (resolved-dns-query.c:23)
==463==    by 0x41B42C: dns_query_add_candidate (resolved-dns-query.c:582)
==463==    by 0x41BB7A: dns_query_go (resolved-dns-query.c:762)
==463==    by 0x40CE3A: bus_method_resolve_hostname (resolved-bus.c:464)
==463==    by 0x4A84B86: method_callbacks_run (bus-objects.c:414)
==463==    by 0x4A87961: object_find_and_run (bus-objects.c:1323)
==463==    by 0x4A87FEE: bus_process_object (bus-objects.c:1443)
==463==    by 0x4AA3434: process_message (sd-bus.c:2964)
==463==    by 0x4AA3623: process_running (sd-bus.c:3006)
==463==    by 0x4AA4110: bus_process_internal (sd-bus.c:3226)
==463==    by 0x4AA41EF: sd_bus_process (sd-bus.c:3253)
==463==    by 0x4AA5343: io_callback (sd-bus.c:3604)
==463==    by 0x4B2DC9B: source_dispatch (sd-event.c:3512)
==463==    by 0x4B2FB1F: sd_event_dispatch (sd-event.c:4077)
==463==    by 0x4B2FFFA: sd_event_run (sd-event.c:4138)
==463==    by 0x4B301D6: sd_event_loop (sd-event.c:4159)
==463==    by 0x464A24: run (resolved.c:92)
==463==    by 0x464B3C: main (resolved.c:99)

Fixes #19376.

4 years agoRevert "tools/make-directive-index: parallelize"
Zbigniew Jędrzejewski-Szmek [Fri, 14 May 2021 15:53:31 +0000 (17:53 +0200)] 
Revert "tools/make-directive-index: parallelize"

This reverts commit a2031de849da52aa85b7e4326c0112ed7e5b5672.

The patch itself seems OK, but it exposes a bug in lxml or libxml2-2.9.12 which
was just released. This is being resolved in
https://gitlab.gnome.org/GNOME/libxml2/-/issues/255, but it might be while. So
let's revert this for now to unbreak our CI.

Fixes #19601.

4 years agomeson: revert the change to unquote commands in add_install_script 19612/head
Zbigniew Jędrzejewski-Szmek [Fri, 14 May 2021 14:12:51 +0000 (16:12 +0200)] 
meson: revert the change to unquote commands in add_install_script

Old meson fails with:
Element not a string: [<Holder: <ExternalProgram 'sh' -> ['/bin/sh']>>, '-c', 'test -n "$DESTDIR" || /bin/journalctl --update-catalog']

I'm doing it as a revert so that it's easy to undo the revert when we require
newer meson. The effect is not so bad, maybe a dozen or so lines about finding
'sh'.

4 years agofix typo
Yu Watanabe [Fri, 14 May 2021 16:59:23 +0000 (01:59 +0900)] 
fix typo

4 years agoMerge pull request #19609 from keszybz/networkd-dhcp-man
Lennart Poettering [Fri, 14 May 2021 14:26:18 +0000 (16:26 +0200)] 
Merge pull request #19609 from keszybz/networkd-dhcp-man

Tweak man page ordering for DHCPv[46] options

4 years agomeson: print autodetected sbat fields
Zbigniew Jędrzejewski-Szmek [Fri, 14 May 2021 12:20:33 +0000 (14:20 +0200)] 
meson: print autodetected sbat fields

...
Message: sbat-distro (from ID): fedora
Message: sbat-distro-summary (from NAME): Fedora
Message: sbat-distro-url (from BUG_REPORT_URL): https://bugzilla.redhat.com/
...

4 years agomeson: call find_program() once and reuse the variable everywhere
Zbigniew Jędrzejewski-Szmek [Fri, 14 May 2021 12:16:17 +0000 (14:16 +0200)] 
meson: call find_program() once and reuse the variable everywhere

Meson 0.58 has gotten quite bad with emitting a message every time
a quoted command is used:
Program /home/zbyszek/src/systemd-work/tools/meson-make-symlink.sh found: YES (/home/zbyszek/src/systemd-work/tools/meson-make-symlink.sh)
Program sh found: YES (/usr/bin/sh)
Program sh found: YES (/usr/bin/sh)
Program sh found: YES (/usr/bin/sh)
Program sh found: YES (/usr/bin/sh)
Program sh found: YES (/usr/bin/sh)
Program sh found: YES (/usr/bin/sh)
Program xsltproc found: YES (/usr/bin/xsltproc)
Configuring custom-entities.ent using configuration
Message: Skipping bootctl.1 because ENABLE_EFI is false
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Message: Skipping journal-remote.conf.5 because HAVE_MICROHTTPD is false
Message: Skipping journal-upload.conf.5 because HAVE_MICROHTTPD is false
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Message: Skipping loader.conf.5 because ENABLE_EFI is false
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
Program ln found: YES (/usr/bin/ln)
...

Let's suffer one message only for each command. Hopefully we can silence
even this when https://github.com/mesonbuild/meson/issues/8642 is
resolved.

4 years agoman: reword descriptions of two DHCPv4 options 19609/head
Zbigniew Jędrzejewski-Szmek [Fri, 14 May 2021 07:04:30 +0000 (09:04 +0200)] 
man: reword descriptions of two DHCPv4 options

4 years agoman: reorder items in [DHCPv4] and [DHCPv6] sections
Zbigniew Jędrzejewski-Szmek [Fri, 14 May 2021 06:58:44 +0000 (08:58 +0200)] 
man: reorder items in [DHCPv4] and [DHCPv6] sections

The settings were listen in a completely random order, also different
between the v4 and v6 sections. Order by "options sent", "options received",
"communication settings" in both sections.

Also minor formatting changes are done, e.g. "=" is added in various places.

4 years agonetwork: shorten code a bit and update log message
Yu Watanabe [Fri, 14 May 2021 03:08:49 +0000 (12:08 +0900)] 
network: shorten code a bit and update log message

4 years agoMerge pull request #19592 from yuwata/network-introduce-describe-bus-method
Zbigniew Jędrzejewski-Szmek [Fri, 14 May 2021 07:34:06 +0000 (09:34 +0200)] 
Merge pull request #19592 from yuwata/network-introduce-describe-bus-method

network: introduce Describe() bus method and use it in networkctl

4 years agoshell-completion: support --json option for hostnamectl 19592/head
Yu Watanabe [Wed, 12 May 2021 16:37:41 +0000 (01:37 +0900)] 
shell-completion: support --json option for hostnamectl

4 years agonetworkctl: introduce --json option for "status" and "list" commands
Yu Watanabe [Wed, 12 May 2021 15:22:14 +0000 (00:22 +0900)] 
networkctl: introduce --json option for "status" and "list" commands

When `--json` option is specified, "status" and "list" commands gives
the same information, as originally "list" just gives partial
information of "status" in different format.

4 years agojson: make JSON_VARIANT_ARRAY/OBJECT_FOREACH() nestable
Yu Watanabe [Fri, 14 May 2021 00:05:20 +0000 (09:05 +0900)] 
json: make JSON_VARIANT_ARRAY/OBJECT_FOREACH() nestable

4 years agonetworkctl: use table_set_empty_string()
Yu Watanabe [Wed, 12 May 2021 16:12:58 +0000 (01:12 +0900)] 
networkctl: use table_set_empty_string()

4 years agonetwork: introduce Describe() method for manager and links
Yu Watanabe [Wed, 12 May 2021 13:11:09 +0000 (22:11 +0900)] 
network: introduce Describe() method for manager and links

4 years agoudev,network: make link_get_type_string() return negative errno on failure
Yu Watanabe [Wed, 12 May 2021 12:07:14 +0000 (21:07 +0900)] 
udev,network: make link_get_type_string() return negative errno on failure

And make net_match_config() propagate the error.

4 years agonetwork: move and rename network_get() -> link_get_network()
Yu Watanabe [Wed, 12 May 2021 11:58:06 +0000 (20:58 +0900)] 
network: move and rename network_get() -> link_get_network()

This also drops test_network_get(). But it tests almost nothing. So, it
should be ok to not re-implement something like test_link_get_network().

4 years agorun: update checks to allow running with a user's bus
Anita Zhang [Thu, 13 May 2021 08:17:51 +0000 (01:17 -0700)] 
run: update checks to allow running with a user's bus

systemd-run is documented to as being able to connect and run on a
specific user bus with "--user --machine=lennart@.host" arguments.
This PR updates some logic that prevented this from working.

4 years agotools/make-directive-index: parallelize
Zbigniew Jędrzejewski-Szmek [Wed, 12 May 2021 09:24:25 +0000 (11:24 +0200)] 
tools/make-directive-index: parallelize

I occasionally do 'build/man/man systemd.directives' when working on man pages,
and it's annoying slow. By paralellizing the parsing of xml, we can make it a
bit faster.

This is still rather innefficient. Only the parsing part is serialized, xml is
still produced serially at the end, which is hard to avoid.

$ ninja -C build man/systemd.directives.xml
before:
8.20s user 0.21s system 99% cpu 8.460 total
8.33s user 0.18s system 98% cpu 8.619 total
8.72s user 0.19s system 98% cpu 9.019 total

after:
13.99s user 0.73s system 345% cpu 4.262 total
14.15s user 0.35s system 348% cpu 4.161 total
14.33s user 0.35s system 339% cpu 4.321 total

I.e. it uses almost twice as much cpu, but cuts the wallclock time down (on a
2-core/4-thread cpu) to about half too, which is an overall win if you're just
trying to render the man page.

The change from list and .append() to set and .add() is something that could
have been done before too, but it's noticable now. It cuts down on the
serialization/deserialization time (about .2s).

4 years agoAdd Microsoft Pro Intellimouse MOUSE_DPI to hwdb
Simon Watts [Wed, 12 May 2021 21:22:39 +0000 (22:22 +0100)] 
Add Microsoft Pro Intellimouse MOUSE_DPI to hwdb

- Internet specifications give 1600 DPI @ 1000Hz for this sensor
- Confirmed experimentally via `mouse-dpi-tool`
- vid, pid, and name match string from `mouse-dpi-tool`

4 years agoUpdate Korean translation (#19083)
Seong-ho Cho [Thu, 13 May 2021 08:19:48 +0000 (17:19 +0900)] 
Update Korean translation (#19083)

Co-authored-by: Seong-ho Cho <shcho@gnome.org>
4 years agoMerge pull request #19590 from keszybz/comments-and-service-modernization
Yu Watanabe [Thu, 13 May 2021 03:17:19 +0000 (12:17 +0900)] 
Merge pull request #19590 from keszybz/comments-and-service-modernization

Comments and service modernization

4 years agoMerge pull request #19567 from poettering/ipv4-ipv6-lowercase
Zbigniew Jędrzejewski-Szmek [Wed, 12 May 2021 10:21:58 +0000 (12:21 +0200)] 
Merge pull request #19567 from poettering/ipv4-ipv6-lowercase

various follow-ups to socket-bind logic

4 years agoresolved.conf.in: add missing Quad9 servers
Michael Catanzaro [Tue, 11 May 2021 13:24:55 +0000 (08:24 -0500)] 
resolved.conf.in: add missing Quad9 servers

The example configuration is missing half of Quad9's addresses.

4 years agoresolved: be more careful with weird links with low MTUs
Lennart Poettering [Tue, 11 May 2021 20:21:52 +0000 (22:21 +0200)] 
resolved: be more careful with weird links with low MTUs

Apparently CAN links will show up in rtnetlink with very low MTUs. We
shouldn't consider them relevant if no IP is spoken over them, since
these MTUs are irrelevant for us then.

Hence, let's check if there's an address assigned to the link before
considering its MTU.

As additional safety net filter out MTUs smaller than the minimum DNS
packet size, too.

Finally, in case we don't find any suitable interface MTU, let's default
to 1500 as the generic Ethernet MTU.

Fixes: #19396
4 years agopam: fix typo try_authtok → use_authtok
Lennart Poettering [Wed, 12 May 2021 08:33:27 +0000 (10:33 +0200)] 
pam: fix typo try_authtok → use_authtok

This was a copy/paste mistae apparently, there's not "try_authtok" and
this was supposed to copy what Fedora uses, which uses "use_authtok"
correctly. Hence adjust this.

Fixes: #19369
4 years agoMerge pull request #19533 from yuwata/network-queue
Zbigniew Jędrzejewski-Szmek [Wed, 12 May 2021 10:12:22 +0000 (12:12 +0200)] 
Merge pull request #19533 from yuwata/network-queue

network: introduce queue to configure address, route, etc

4 years agocore/service: modernization 19590/head
Zbigniew Jędrzejewski-Szmek [Mon, 10 May 2021 10:56:04 +0000 (12:56 +0200)] 
core/service: modernization

4 years agotest-bpf-foreign-programs: fix message
Zbigniew Jędrzejewski-Szmek [Mon, 10 May 2021 10:54:52 +0000 (12:54 +0200)] 
test-bpf-foreign-programs: fix message

4 years agodocs/HACKING: wrap long lines
Zbigniew Jędrzejewski-Szmek [Mon, 10 May 2021 06:35:21 +0000 (08:35 +0200)] 
docs/HACKING: wrap long lines

4 years agosd-event: tweak comments
Zbigniew Jędrzejewski-Szmek [Sat, 8 May 2021 09:40:47 +0000 (11:40 +0200)] 
sd-event: tweak comments

4 years agotimedated: make ntp_synced() static
Zbigniew Jędrzejewski-Szmek [Wed, 12 May 2021 07:39:28 +0000 (09:39 +0200)] 
timedated: make ntp_synced() static

No need to have this in basic.

4 years agoMerge pull request #18986 from poettering/oomd-varlink-fix
Zbigniew Jędrzejewski-Szmek [Wed, 12 May 2021 09:36:32 +0000 (11:36 +0200)] 
Merge pull request #18986 from poettering/oomd-varlink-fix

varlink ref fix

4 years agoMerge pull request #19506 from xnox/ship-stub-elf
Zbigniew Jędrzejewski-Szmek [Wed, 12 May 2021 07:45:36 +0000 (09:45 +0200)] 
Merge pull request #19506 from xnox/ship-stub-elf

boot/efi: install ELF linux.elf.stub in addition to PE linux.efi.stub

4 years agoMerge pull request #19581 from yuwata/specifier-refuse-too-long-results
Lennart Poettering [Wed, 12 May 2021 07:42:08 +0000 (09:42 +0200)] 
Merge pull request #19581 from yuwata/specifier-refuse-too-long-results

specifier: refuse too long results

4 years agonetlink,network: drop "const" from opaque object parameters in supposed-to-be-public...
Lennart Poettering [Tue, 11 May 2021 15:08:00 +0000 (17:08 +0200)] 
netlink,network: drop "const" from opaque object parameters in supposed-to-be-public APIs

This drops the "const" specifier from the opaque object parameters to
various functions in our API.

This effectively reverts #19292 and more.

Why drop this? Our public APIs should not leak too much information
about how stuff is implemented internally. In our public APIs we
shouldn't give too many guarantees we don#t want to necessarily keep.
Specifically: in many cases it makes sense that getters actually
generate/parse/allocate data on the fly, storing/caching the result
internally, to speed things up, do things lazily or to track memory
allocations so that they can be freed later. Doing this means we need to
change the objects, even though the getters are semantically a read
operation.

We want to retain the freedom that we can change things around
internally. By exposing the objects as "const" we remove a good chunk of
that, for little gain.

See sd_bus_creds_get_description() for a real example of a getter that
implicitly caches and thus modifies the relevant object.

This removes the "const" decorators from sd-dhcp and sd-netlink, two
APIs that we intend to make public eventually even though they still are
not, leaving us the chance to still fix this before it becomes set in
stone.

4 years agotest-network: wait for the interfaces are configured after reloading .network files 19533/head
Yu Watanabe [Wed, 5 May 2021 14:05:02 +0000 (23:05 +0900)] 
test-network: wait for the interfaces are configured after reloading .network files

4 years agotest-network: wait for the intreface is configured if it is expected
Yu Watanabe [Wed, 5 May 2021 14:04:24 +0000 (23:04 +0900)] 
test-network: wait for the intreface is configured if it is expected

4 years agonetwork: make route_configure() return all created routes
Yu Watanabe [Thu, 29 Apr 2021 14:18:29 +0000 (23:18 +0900)] 
network: make route_configure() return all created routes

4 years agonetwork: make log_route_debug() show multipath routes and Gateway=_dhcp4 or _ipv6ra
Yu Watanabe [Thu, 29 Apr 2021 14:30:51 +0000 (23:30 +0900)] 
network: make log_route_debug() show multipath routes and Gateway=_dhcp4 or _ipv6ra

4 years agonetwork: use request queue to configure addresses, routes, and nexthops
Yu Watanabe [Wed, 5 May 2021 13:46:44 +0000 (22:46 +0900)] 
network: use request queue to configure addresses, routes, and nexthops

Why is this necessary? Several examples below.

- When a route sets prefsrc, then the address must be already assigned
  (see issue #19285), and also it must be ready if IPv6.
- When a route or nexthop sets gateway, then the address must be reachable.
- When a route sets nexthop ID, then the corresponding nexthop must be
  assigned.
- When a route sets multipath routes on another interface, then the
  interface must exist and be ready to configure.
- When configuring address, the same address must not be under removing
  (see issue #18108).
Etc,. etc,...

So, this makes all requests about addresses, routes, and nethops are once
stored in the queue, and will be processed when they are ready to configure.

Fixes #18108 and #19285.

4 years agonetwork: use request queue to configure neighbors
Yu Watanabe [Fri, 7 May 2021 07:05:31 +0000 (16:05 +0900)] 
network: use request queue to configure neighbors

4 years agonetwork: use request queue to configure routing policy rules
Yu Watanabe [Fri, 7 May 2021 06:57:13 +0000 (15:57 +0900)] 
network: use request queue to configure routing policy rules

4 years agonetwork: introduce link_is_ready_to_configure() helper function
Yu Watanabe [Fri, 7 May 2021 06:45:28 +0000 (15:45 +0900)] 
network: introduce link_is_ready_to_configure() helper function

This will be used in later commits.

4 years agonetwork: add skeleton of request queue
Yu Watanabe [Fri, 7 May 2021 06:39:16 +0000 (15:39 +0900)] 
network: add skeleton of request queue

This will be used in later commits.

4 years agonetwork: nexthop: add NextHop object before sending netlink request
Yu Watanabe [Fri, 7 May 2021 11:52:49 +0000 (20:52 +0900)] 
network: nexthop: add NextHop object before sending netlink request

Otherwise, if nexthop_add() fails, then assertion about nexthop_messages in
static_nexthop_handler() will be triggered.

4 years agonetwork: split out common part of route or address handlers
Yu Watanabe [Fri, 7 May 2021 08:32:51 +0000 (17:32 +0900)] 
network: split out common part of route or address handlers

4 years agonetwork: change order of dropping network configs
Yu Watanabe [Fri, 7 May 2021 07:35:42 +0000 (16:35 +0900)] 
network: change order of dropping network configs

As routes may requires nexthops and addresses, nexthops may requires
addresses.

4 years agonetwork: simplify and rename routing_policy_rule_copy()
Yu Watanabe [Thu, 6 May 2021 20:16:32 +0000 (05:16 +0900)] 
network: simplify and rename routing_policy_rule_copy()

4 years agonetwork: introduce route_dup()
Yu Watanabe [Thu, 6 May 2021 19:47:26 +0000 (04:47 +0900)] 
network: introduce route_dup()

The function will be used in later commits.

4 years agosd-netlink: introduce multipath_route_dup()
Yu Watanabe [Thu, 6 May 2021 19:45:02 +0000 (04:45 +0900)] 
sd-netlink: introduce multipath_route_dup()

The function will be used in later commits.

4 years agonetwork: introduce manager_address_is_reachable()
Yu Watanabe [Thu, 6 May 2021 19:37:58 +0000 (04:37 +0900)] 
network: introduce manager_address_is_reachable()

The function will be used in later commits.

4 years agonetwork: introduce link_has_route()
Yu Watanabe [Thu, 6 May 2021 19:31:20 +0000 (04:31 +0900)] 
network: introduce link_has_route()

The function will be used in later commits.

4 years agonetwork: delay resolving interface specifier in MultiPathRoute=
Yu Watanabe [Thu, 6 May 2021 19:29:52 +0000 (04:29 +0900)] 
network: delay resolving interface specifier in MultiPathRoute=

The interface may not exist when .network files are loaded.

4 years agonetwork: introduce manager_has_address()
Yu Watanabe [Thu, 6 May 2021 19:03:21 +0000 (04:03 +0900)] 
network: introduce manager_has_address()

The function will be used in later commits.

4 years agoordered-set: introduce ordered_set_clear/free_with_destructor()
Yu Watanabe [Mon, 26 Apr 2021 14:52:40 +0000 (23:52 +0900)] 
ordered-set: introduce ordered_set_clear/free_with_destructor()

4 years agohashmap,set: make hashmap_clear_with_destructor() or friends safer
Yu Watanabe [Sat, 8 May 2021 06:32:52 +0000 (15:32 +0900)] 
hashmap,set: make hashmap_clear_with_destructor() or friends safer

4 years agonetwork: use IPV4_ADDRESS_FMT_STR/VAL macros and in6_addr_to_string() or friends
Yu Watanabe [Thu, 6 May 2021 08:15:01 +0000 (17:15 +0900)] 
network: use IPV4_ADDRESS_FMT_STR/VAL macros and in6_addr_to_string() or friends

4 years agoin-addr-util: move IPV4_ADDRESS_FMT_STR/VAL macros from networkd-address.h
Yu Watanabe [Thu, 6 May 2021 07:21:18 +0000 (16:21 +0900)] 
in-addr-util: move IPV4_ADDRESS_FMT_STR/VAL macros from networkd-address.h

4 years agoin-addr-util: introduce in6_addr_to_string() or friends
Yu Watanabe [Thu, 6 May 2021 07:17:47 +0000 (16:17 +0900)] 
in-addr-util: introduce in6_addr_to_string() or friends

4 years agonetwork: use in6_addr_is_link_local() or friends
Yu Watanabe [Thu, 6 May 2021 07:11:33 +0000 (16:11 +0900)] 
network: use in6_addr_is_link_local() or friends

4 years agonetwork: rename routing_policy_rule_configure_internal() and make it take callback
Yu Watanabe [Mon, 26 Apr 2021 07:10:39 +0000 (16:10 +0900)] 
network: rename routing_policy_rule_configure_internal() and make it take callback

4 years agonetwork: make nexthop_configure() take callback
Yu Watanabe [Mon, 26 Apr 2021 07:05:04 +0000 (16:05 +0900)] 
network: make nexthop_configure() take callback

4 years agonetwork: make neighbor_configure() take callback
Yu Watanabe [Mon, 26 Apr 2021 07:04:07 +0000 (16:04 +0900)] 
network: make neighbor_configure() take callback

4 years agotree-wide: refuse too long strings earlier in specifier_printf() 19581/head
Yu Watanabe [Sun, 9 May 2021 16:46:48 +0000 (01:46 +0900)] 
tree-wide: refuse too long strings earlier in specifier_printf()

We usually call specifier_printf() and then check the validity of
the result. In many cases, validity checkers, e.g. path_is_valid(),
refuse too long strings. This makes specifier_printf() refuse such
long results earlier.

Moreover, unit_full_string() and description field in sysuser now
refuse results longer than LONG_LINE_MAX. config_parse() already
refuses the line longer than LONG_LINE_MAX. Hence, it should be ok
to set the same value as the maximum length of the resolved string.

4 years agodns-domain: use DNS_LABEL_MAX at one more place
Yu Watanabe [Wed, 12 May 2021 01:12:18 +0000 (10:12 +0900)] 
dns-domain: use DNS_LABEL_MAX at one more place

4 years agocreds-util: introduce CREDENTIAL_NAME_MAX
Yu Watanabe [Wed, 12 May 2021 01:20:47 +0000 (10:20 +0900)] 
creds-util: introduce CREDENTIAL_NAME_MAX

4 years agofd-util: introduce FDNAME_MAX
Yu Watanabe [Wed, 12 May 2021 01:19:19 +0000 (10:19 +0900)] 
fd-util: introduce FDNAME_MAX

4 years agogpt: introduce GPT_LAVEL_MAX
Yu Watanabe [Wed, 12 May 2021 01:16:36 +0000 (10:16 +0900)] 
gpt: introduce GPT_LAVEL_MAX

4 years agotest: move test_specifier_printf() to test-specifier.c
Yu Watanabe [Sun, 9 May 2021 15:13:14 +0000 (00:13 +0900)] 
test: move test_specifier_printf() to test-specifier.c

4 years agospecifier: rename variable
Yu Watanabe [Sun, 9 May 2021 12:39:34 +0000 (21:39 +0900)] 
specifier: rename variable

4 years agospecifier: use SD_ID128_STRING_MAX
Yu Watanabe [Sun, 9 May 2021 12:23:32 +0000 (21:23 +0900)] 
specifier: use SD_ID128_STRING_MAX

4 years agocore: don't accidentally unref a varlink connection twice 18986/head
Lennart Poettering [Fri, 12 Mar 2021 21:21:58 +0000 (22:21 +0100)] 
core: don't accidentally unref a varlink connection twice

Let's make sure that our close handler unrefs a connection again that we
are already unreffing a few stack frames up by invalidating the pointer
first, and dropping the ref counter only after that.

Replaces: 39ad3f1c092b5dffcbb4b1d12eb9ca407f010a3c

Fixes: #18025
4 years agoRevert "varlink: avoid using dangling ref in varlink_close_unref()"
Lennart Poettering [Fri, 12 Mar 2021 21:21:40 +0000 (22:21 +0100)] 
Revert "varlink: avoid using dangling ref in varlink_close_unref()"

This reverts commit 39ad3f1c092b5dffcbb4b1d12eb9ca407f010a3c.

4 years agocgroup: drop explicit NULL comparisons 19567/head
Lennart Poettering [Mon, 10 May 2021 15:47:32 +0000 (17:47 +0200)] 
cgroup: drop explicit NULL comparisons

4 years agotree-wide: move variables to innermost scope
Lennart Poettering [Mon, 10 May 2021 15:47:19 +0000 (17:47 +0200)] 
tree-wide: move variables to innermost scope

4 years agotree-wide: use af_to_ipv4_ipv6() + af_from_ipv4_ipv6() helpers at various places
Lennart Poettering [Mon, 10 May 2021 15:24:48 +0000 (17:24 +0200)] 
tree-wide: use af_to_ipv4_ipv6() + af_from_ipv4_ipv6() helpers at various places