summaryrefslogtreecommitdiffstats
path: root/src/nspawn/nspawn-network.h (unfollow)
Commit message (Collapse)AuthorFilesLines
2021-05-19alloc-util: introduce MALLOC_SIZEOF_SAFE() helperLennart Poettering4-5/+17
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-19docs: prettify two external linksZbigniew Jędrzejewski-Szmek1-3/+5
2021-05-19docs: use {% raw %} to wrap jinja2 tags in documentationZbigniew Jędrzejewski-Szmek1-2/+3
As reported by @mrc0mmand: > Since https://github.com/systemd/systemd/commit/89f52a780e54b2eb0905a6e613f6d4afcb22256b#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-19test: reintroduce m4 dependency for TEST-06-SELINUXFrantisek Sumsal1-1/+1
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-19mkosi: stop pulling in viZbigniew Jędrzejewski-Szmek5-5/+0
We have 'nano' everywhere, and it's enough for a casual edit.
2021-05-19mkosi/fedora: use pkgconfig virtual provides to refer to packagesZbigniew Jędrzejewski-Szmek1-33/+35
... 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-19mkosi/fedora: drop python3-devel reqZbigniew Jędrzejewski-Szmek1-1/+0
I think it was only used for building the python wrappers. C.f. https://src.fedoraproject.org/rpms/systemd/c/ec9ca01d16bf6eda50b77f64dccf1caa06d29374?branch=rawhide.
2021-05-19man: describe overall online status in networkctl(1)Alvin Šipraga1-8/+40
2021-05-19networkd-test: support online state in networkctl status outputAlvin Šipraga1-0/+1
networkctl status now outputs an online state. Fix up the tests to account for this.
2021-05-19network: show online state in networkctl status outputAlvin Šipraga1-5/+42
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-19man: clarify RequiredFamilyForOnline= behaviour for online stateAlvin Šipraga1-7/+7
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-19man: clarify RequiredForOnline= behaviour for online stateAlvin Šipraga1-3/+3
With new "online state" semantics in networkd, make the description of RequiredForOnline= a little more broad.
2021-05-19network: use the overall online state in network_is_online()Alvin Šipraga1-9/+23
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-19network: add an online state for links and managerAlvin Šipraga13-3/+109
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-19docs/HACKING: add note about template enginesZbigniew Jędrzejewski-Szmek1-2/+20
2021-05-19meson: add workaround for old mesonZbigniew Jędrzejewski-Szmek1-1/+2
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-19ci: drop py2 lxml, pull in jinja2Zbigniew Jędrzejewski-Szmek4-3/+4
2021-05-19units: generate ReadWritePaths= in the templateZbigniew Jędrzejewski-Szmek2-7/+5
2021-05-19meson: sort conf paths alphabeticallyZbigniew Jędrzejewski-Szmek1-52/+51
The order was a complete mess. Let's make it a bit more tidy.
2021-05-19man: use readable names for entitiesZbigniew Jędrzejewski-Szmek4-15/+15
Let's use the same names as in the jinja2 substitutions.
2021-05-19meson: drop "_YES_NO" variablesZbigniew Jędrzejewski-Szmek2-4/+2
We can generate the right string in the template directly.
2021-05-19meson: use jinja2 also for custom-entities.entZbigniew Jędrzejewski-Szmek3-20/+20
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-19meson: drop "substs"Zbigniew Jędrzejewski-Szmek1-76/+0
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-19meson: use jinja2 in shell-completion/Zbigniew Jędrzejewski-Szmek4-81/+83
2021-05-19efi: use meson object directly instead of going through 'substs'Zbigniew Jędrzejewski-Szmek1-2/+2
2021-05-19meson: use jinja2 in src/journal-remoteZbigniew Jędrzejewski-Szmek3-25/+23
One stanza had "if install_sysconfdir_samples", while the other "if install_sysconfdir", which looks like a mistake. install_sysconfdir_samples is now used for both.
2021-05-19meson: use jinja2 in src/libsystemd/Zbigniew Jędrzejewski-Szmek2-9/+12
2021-05-19meson: use jinja2 for various files in src/core/Zbigniew Jędrzejewski-Szmek6-33/+31
2021-05-19meson: use jinja2 for src/libudev/Zbigniew Jędrzejewski-Szmek3-8/+13
2021-05-19meson: use jinja2 for src/resolve/Zbigniew Jędrzejewski-Szmek3-15/+18
2021-05-19meson: use jinja2 for rpm templatesZbigniew Jędrzejewski-Szmek16-87/+102
The naming of variables is very inconsistent. I tried to use more modern style naming (UNDERSCORED_TITLE_CASE), but I didn't change existing names too much. Only SYSTEM_DATA_UNIT_PATH is renamed to SYSTEM_DATA_UNIT_DIR to match SYSTEM_CONFIG_UNIT_DIR.
2021-05-19rpm: use %_bindir not @bindir@Zbigniew Jędrzejewski-Szmek1-12/+12
We were using both in various places. To keep things simple, let rpm do the substitution.
2021-05-19meson: use jinja2 in src/timesync/Zbigniew Jędrzejewski-Szmek2-9/+10
2021-05-19meson: use jinja2 in src/udevZbigniew Jędrzejewski-Szmek2-5/+8
2021-05-19meson: use jinja2 in src/vconsoleZbigniew Jędrzejewski-Szmek2-9/+9
2021-05-19meson: use jinja2 in sysctl.d/Zbigniew Jędrzejewski-Szmek2-15/+9
2021-05-19meson: use conf configuration_data object to generate test-sysusers.shZbigniew Jędrzejewski-Szmek1-1/+1
I wanted to use jinja2 templating here too, but it's hard to get right: custom_target() strips the executable bit by default (unlike configure_file apparently). custom_target() has install_mode setting, but it was only added in meson-0.47, so it can't be used while we support 0.46. And without the executable bit the test is not invoked properly. For example, "root-unittests" in the debian package calls test-* after installation, so the executable bit there is necessary. It would be possible to adjust the file mode after the fact, but it would make things more complicated. So let's use the native meson substitutions here. We don't need anything more fancy.
2021-05-19meson: use jinja2 for rules.d templatesZbigniew Jędrzejewski-Szmek5-18/+18
2021-05-19meson: use custom configuration_data() object for man/man and man/html helpersZbigniew Jędrzejewski-Szmek2-3/+5
I want to stop using 'substs'. But in this case, configure_file() is nicer than custom_target(), because it causes meson to immediately generate the helpers after configuration, so it's possible to do 'meson build && build/man/man ...', without building anything first. We only substitute one variable here, so let's use a custom configuration_data() object.
2021-05-19Drop dependency on m4Zbigniew Jędrzejewski-Szmek10-31/+2
m4 was hugely popular in the past, because autotools, automake, flex, bison and many other things used it. But nowadays it much less popular, and might not even be installed in the buildroot. (m4 is small, so it doesn't make a big difference.) (FWIW, Fedora dropped make from the buildroot now, https://fedoraproject.org/wiki/Changes/Remove_make_from_BuildRoot. I think it's reasonable to assume that m4 will be dropped at some point too.) The main reason to drop m4 is that the syntax is not very nice, and we should minimize the number of different syntaxes that we use. We still have two (configure_file() with @FOO@ and jinja2 templates with {{foo}} and the pythonesque conditional expressions), but at least we don't need m4 (with m4_dnl and `quotes').
2021-05-19meson: use jinja2 for READMEZbigniew Jędrzejewski-Szmek2-9/+8
2021-05-19meson: use jinja2 for the gperf templateZbigniew Jędrzejewski-Szmek2-259/+268
Jinja2 inserts an empty line after the first macro body, which I don't know how to get rid of. Only the first macro causes problems: the other ones don't have conditional statements at the end and the issue does not occur. As a work-around I moved ProtectHostname to the end of the first macro. Output is identical, except for horizontal whitespace and change in position of ProtectHostname.
2021-05-19meson: use jinja2 for src/loginZbigniew Jędrzejewski-Szmek6-62/+41
{% raw %} is needed to avoid trouble with {%k, which jinja thinks is trying to access variable 'k'.
2021-05-19meson: use jinja2 for tmpfiles.d templatesZbigniew Jędrzejewski-Szmek7-59/+42
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!
2021-05-19meson: drop unnecessary listificationZbigniew Jędrzejewski-Szmek1-1/+1
2021-05-19units: strip out the developer comment in .service unit againZbigniew Jędrzejewski-Szmek1-3/+3
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.
2021-05-19meson: use jinja2 for unit templatesZbigniew Jędrzejewski-Szmek65-160/+133
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.
2021-05-19meson: replace some m4 templates with jinja2Zbigniew Jędrzejewski-Szmek6-38/+54
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.
2021-05-19meson, mkosi: pull in jinja2 as requiredZbigniew Jędrzejewski-Szmek7-0/+12
In preparation for subsequent changes.
2021-05-19modules-load: inline interator variableZbigniew Jędrzejewski-Szmek1-3/+1