1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-23 21:35:11 +03:00
Commit Graph

82 Commits

Author SHA1 Message Date
Yu Watanabe
0e42004f3e networkd-test.py: disable IPv6AcceptRA= if not necessary
To speed up the test. Otherwise, it takes about few seconds interfaces
to enter the configured state. And may networkd-wait-online timeouts.
2024-11-25 10:07:26 +00:00
Yu Watanabe
9e05e33871 networkd-test.py: fix interface state checker
After 259125d53d, network interfaces
declared by .netdev files are created after systemd-networkd sends READY
notification. So, even when networkd is started, the netdevs may not
be created yet, and 'ip' command may fail. Let's also check the return
code of the command.

This also
- drops never worked stdout checks,
- makes the test fail if the interface is not created within the timeout.
2024-11-23 17:33:43 +09:00
Yu Watanabe
f1ca3479ec networkd-test.py: show current status when wait-online failed
For easier debugging on failure.
2024-11-14 10:17:19 +09:00
Mike Yuan
c9837c17d5
networkctl-status-link: show netdev files associated with link 2024-09-09 23:20:42 +02:00
Yu Watanabe
1f4345b5ed networkd-test: first wait for interface being configured
DNS setting propagation to resolved may take some time.
2024-05-31 10:00:21 +02:00
Yu Watanabe
1ef586af23 test: applying timezone is asynchronous
So, we need to try to read timezone several times.
Also, on failure, show journal of timedated instead of hostnamed,
as the timezone is handled by timedated.

Hopefully fixes #33007.
2024-05-25 11:27:19 +02:00
Yu Watanabe
013359ac65 network: pin file descriptor of persistent storage
This also drop the support of /run/systemd/netif/persistent-storage-ready,
as the file is anyway removed when networkd is stopped.
Let's use $SYSTEMD_NETWORK_PERSISTENT_STORAGE_READY=1 instead on testing.
2024-03-16 01:12:05 +09:00
Yu Watanabe
c84a5f5eaf test-network: add support for systemd-networkd-persistent-storage.service 2024-03-12 01:57:16 +09:00
Yu Watanabe
9bb589dc2d networkd-test.py: prefix .network and .netdev files with digits
Otherwise config files generated by systemd-network-generator may
match with the test interfaces.
2023-11-09 07:16:56 +09:00
Yu Watanabe
2e978188cb networkd-test.py: hide default .network files
To make the test works fine with -Ddefault-network=True.
2023-11-09 07:16:56 +09:00
Yu Watanabe
5063f027ef networkd-test.py: disable global DNS= setting
Otherwise, queries may be passed to unexpected DNS servers.
2023-06-16 10:57:51 +09:00
Yu Watanabe
55f9d72a5d networkd-test.py: do not query IPv6 address
From changelog of dnsmasq v2.87:
====
Note in manpage the change in behaviour of -address. This behaviour
actually changed in v2.86, but was undocumented there. From 2.86 on,
(eg) --address=/example.com/1.2.3.4 ONLY applies to A queries. All other
types of query will be sent upstream. Pre 2.86, that would catch the
whole example.com domain and queries for other types would get
a local NODATA answer. The pre-2.86 behaviour is still available,
by configuring --address=/example.com/1.2.3.4 --local=/example.com/
====
2023-06-16 10:44:16 +09:00
Yu Watanabe
77725adedd networkd-test.py: replace deprecated option IPv6AcceptRouterAdvertisements=
Also, use 'yes' or 'no' for boolean options.
2023-06-16 10:43:06 +09:00
Yu Watanabe
eeb88ea41d networkd-test.py: show more debugging logs on failure 2023-06-16 10:43:06 +09:00
Daan De Meyer
a2640646f1 network: Show network and link file dropins in networkctl status
Fixes #24428
2023-01-12 13:44:52 +09:00
Yu Watanabe
3f504b892b network/bridge: fix UseBPDU= and AllowPortToBeRoot=
Fixes bugs caused by 7f9915f0de.

Fixes #24268.
2022-08-14 06:56:05 +09:00
Zbigniew Jędrzejewski-Szmek
3e8caa34d6 docs: use lowercase "qemu" and other minor tweaks to test docs
We used both "qemu" and "QEMU", let's use the lower-case version everywhere
since it's also the name of the binary and the version that people are
most familiar with.

The stuff under test/ is not only for the integeration tests, but also
for various other test-related stuff, so adjust the docs a bit.
2022-05-04 12:58:43 +02:00
Luca Boccassi
471cac19a6 networkd-test: lazy umount tmp directories
In Semaphore CI, for some reason, /run/systemd/resolve is busy so the umount
fails at the end of the test run:

Verify link states with Unmanaged= settings, cold-plug. ... umount: /run/systemd/resolve: target is busy.14:57
ok14:57
ERROR14:57
======================================================================14:57
ERROR: tearDownModule (__main__)14:57
----------------------------------------------------------------------14:57
Traceback (most recent call last):14:57
  File /tmp/autopkgtest-lxc.6islza9t/downtmp/build.A9b/src/test/networkd-test.py, line 94, in tearDownModule14:57
    subprocess.check_call([umount, d])14:57
  File /usr/lib/python3.9/subprocess.py, line 373, in check_call14:57
    raise CalledProcessError(retcode, cmd)14:57
subprocess.CalledProcessError: Command '['umount', '/run/systemd/resolve']' returned non-zero exit status 32.14:57
----------------------------------------------------------------------14:58
Ran 35 tests in 138.868s14:58
FAILED (errors=1, skipped=2)

Use lazy umount to avoid erroring out.
2022-04-09 10:27:10 +09:00
Michael Biebl
ad337e55a3 tree-wide: fix duplicated words
the the
in in
not not
we we
2022-03-18 08:14:01 +09:00
Santa Wiryaman
97f27f8a16 Add support for isolated parameter
Add the "Isolated" parameter in the *.network file, e.g.,

[Bridge]
Isolated=true|false

When the Isolated parameter is true, traffic coming out of this port
will only be forward to other ports whose Isolated parameter is false.

When Isolated is not specified, the port uses the kernel default
setting (false).

The "Isolated" parameter was introduced in Linux 4.19.
See man bridge(8) for more details.
But even though the kernel and bridge/iproute2 recognize the "Isolated"
parameter, systemd-networkd did not have a way to set it.
2022-02-09 17:37:37 +09:00
Michael Biebl
528dd6a423 networkd-test: fix resolved_domain_restricted_dns
megasearch.net was meant to be a non-existing bogus domain, and had been
for a long time. But it seems some domain grabber recently registered
it, and it's an actual thing now:

  $ host megasearch.net
  megasearch.net has address 207.148.248.143

This causes the test to fail randomly.

Use search.example.com instead which yields

  $ host search.example.com
  Host search.example.com not found: 3(NXDOMAIN)

Fixes: #18357
2021-10-01 14:34:00 +09:00
Dan Streetman
05575a104b test/networkd-test: in bridge test, wait for online after restart systemd-networkd
without waiting for online, there is a race condition between systemd-networkd
actually setting the new values and the test checking those values

This also sets the link down before restarting systemd-networkd, to avoid
the wait for online being a no-op
2021-05-28 12:26:33 +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
Lennart Poettering
489344f24b networkd-test: reenable dnssec while testing
We need to list the synthesized domains as NTAs, otherwise the DNSSEC
validation of course cannot succeed.

Fixes: #10487 #5029
2021-02-18 14:12:42 +00:00
Zbigniew Jędrzejewski-Szmek
6bfbfce795 networkd-test: add final newlines in generated files, use .format() 2020-12-10 14:31:39 +09:00
Yu Watanabe
db9ecf0501 license: LGPL-2.1+ -> LGPL-2.1-or-later 2020-11-09 13:23:58 +09:00
Michael Biebl
3aa645f0c0 test-network: stop networkd and its socket
With the changes from 2c0dffe82d, starting
systemd-networkd.service will also activate systemd-networkd.socket.
When tearing down a test, we need to stop the socket as well, to make
sure networkd can't be activated accidentally with the wrong
configuration.
2020-08-28 21:03:09 +02:00
Dimitri John Ledkov
1c7466aa2e resolve: lift limits on search domains count or length
glibc 2.26 lifted restrictions on search domains count or length to
unlimited. This has also been backported to 2.17 in some distributions (RHEL 7
and derivatives). Other softwares may have their own limits for search domains,
but we should not restrict what is written out any more.

https://sourceware.org/legacy-ml/libc-announce/2017/msg00001.html
2020-08-18 10:06:25 +02:00
Yu Watanabe
571f953934 test-network: wait for addresses are not in tentative state 2020-07-15 17:15:25 +09:00
Yu Watanabe
fc79e6ff5e test-network: suppress logs in status command 2020-01-07 22:20:43 +09:00
Frantisek Sumsal
345997f393 test: print an error when networkctl returns an unexpected EC
If networkctl crashes, like recently with SIGABRT, it returns absolutely
no output, which may be confusing during debugging. Help it a little
with a short informative message.
2019-07-31 16:33:12 +02:00
Frantisek Sumsal
2de705cd1c test: use useradd instead of adduser
`adduser` is in certain cases a standalone package which provides a
better user experience. In other cases it's just a symlink to `useradd`.
And some distributions don't have `adduser` at all, like Arch Linux.
Let's use the `useradd` binary instead, which should provide the same
functionality everywhere.
2019-07-30 20:26:25 +02:00
Zbigniew Jędrzejewski-Szmek
6c34ed5111 test: use newer verb to set log levels 2019-04-03 08:19:08 +02:00
Martin Pitt
09b8826ea3 networkd-test: ignore failures of test_route_only_dns* in containers
This test exposes a race condition when running in LXC, see issue #11848
for details. Until that is understood and fixed, skip the test as it's
not a recent regression.
2019-02-27 23:15:31 +01:00
Martin Pitt
829c0672e0 networkd-test: specify Address= with prefix length
This avoids a warning:

    An address '192.168.42.100' is specified without prefix length. The
    behavior of parsing addresses without prefix length will be changed
    in the future release. Please specify prefix length explicitly.
2019-02-27 22:53:57 +01:00
Martin Pitt
74c13b7659 networkd-test: show service journal on startup failure
This provides easier evaluation of failed tests.
2019-02-27 22:53:57 +01:00
Martin Pitt
f5cf985e9c networkd-test: fix test_dropin()
- This test needs resolved, so make sure it is started. In some Debian
   environments it is not.
 - It was an unnecessary, and now failing assumption that name servers
   get atomically written to the resolved's resolv.conf. Wait until both
   expected name servers are in the file.
2019-02-21 12:37:08 +01:00
Martin Pitt
ca56805c8d networkd-test: use a complete domain name in test_route_only_dns()
Since version 241 (commit ea4678?), querying MX type records for
single-label domains does not actually forward the query to the DNS
server any more. Use "example.com" instead, which is the recommended
test domain anyway.
2019-02-21 12:37:08 +01:00
Martin Pitt
6592c9c850 networkd-test: disable DNSSEC in domain-restricted DNS test
dnsmasq 2.80 changed behaviour when being queried by resolved with
enabled DNSSEC: It returns errors for SOA and DS queries which cause the
entire query to fail. As we don't configure DNSSEC in this test anyway,
just disable it so that we retain compatibility with old and new dnsmasq
versions.
2019-02-21 12:37:06 +01:00
Lennart Poettering
1750854916 resolved: bind .local domains to mDNS with DNS_SCOPE_YES, similar LLMNR
Previously, we'd return DNS_SCOPE_MAYBE for all domain lookups matching
LLMNR or mDNS. Let's upgrade this to DNS_SCOPE_YES, to make the binding
stronger.

The effect of this is that even if "local" is defined as routing domain
on some iface, we'll still lookup domains in local via mDNS — if mDNS is
turned on. This should not be limiting, as people who don't want such
lookups should turn off mDNS altogether, as it is useless if nothing is
routed to it.

This also has the nice benefit that mDNS/LLMR continue to work if people
use "~." as routing domain on some interface.

Similar for LLMNR and single label names.

Similar also for the link local IPv4 and IPv6 reverse lookups.

Fixes: #10125
2018-12-21 11:41:45 +01:00
Lennart Poettering
0373fc5b6f networkd-test: change test_transient_hostname_with_static to use an explicit static hostname
Previously, the test would use the existing static hostname. However,
this woud not work as expected in the static hostname was "localhost"
because the transient hostname will override the static one in that case
anyway, as the assumption hostnamed makes is that "localhost" is a
non-initialized hostname.

Hence when testing this, let's first set the static hostname to
something specific first (that is not "localhost").
2018-12-07 12:25:24 +01:00
Lennart Poettering
8e0ba0c984 networkd-test: restart hostnamed after reverting /etc/hostname too
Otherwise hostnamed will not report the right data in the next test
2018-12-07 12:25:24 +01:00
Lennart Poettering
fef740aed3 networkd-test: add write_config()
The call was removed in ec89276c2a, but is
still used. Not sure why noone noticed this.
2018-12-07 12:25:24 +01:00
Lennart Poettering
ff7507295d networkd-test: set right access modes for /run/systemd/netif
Otherwise networkd isn't happy.

Let's also make addition of the "systemd-network" non-fatal. The user
exists on many machines anyway, hence it shouldn't fail if it already
exists.
2018-12-07 12:25:24 +01:00
Michael Biebl
3deb28f20a tests: update networkd-test.py to use resolvectl instead of systemd-resolve (#10486)
The latter is merely a compat symlink nowadays.
2018-10-23 07:29:03 +09:00
Zbigniew Jędrzejewski-Szmek
62fb7e80fc Revert "resolve: enable DynamicUser= for systemd-resolved.service"
This reverts commit 0187368cad.
(systemd.conf.m4 part was already reverted in 5b5d82615011b9827466b7cd5756da35627a1608.)
2018-09-20 16:52:02 +02:00
Martin Pitt
c4a0a2d5f8 test: Fix networkd test for an already running service
Mount tmpfses over the networkd and resolved config and state
directories, and stop the services beforehand. This ensures that the
test does not mess with an existing networkd/resolved setup. At least
for ethernet setups, this does not sever existing links, so is good
enough for the CI cases we are interested in (QEMU and LXC).

Relax the skip check to only skip the test when trying to run this on
real iron, but start running it in virtual machines now.

This allows us to run the test on Ubuntu 18.04 LTS in CI, which uses
both services by default.
2018-07-09 16:44:03 +02:00
Martin Pitt
207f5f4d93 test: Reset systemd-resolved.service in networkd test
Like s-networkd.service itself, it can happen that s-resolved.service
runs into restart limits. Don't enforce a successful call, as on
machines without resolved the unit might not be loaded.
2018-07-09 16:42:32 +02:00
Martin Pitt
c44c1b8ab5 test: fix networkd-test.py rate limiting and dynamic user
- Reset systemd-networkd.service before each test run, to avoid running
   into restart limits.
 - Our networkd-test-router.service unit needs to run as root and thus
   can't use `User=`; but networkd still insists on the
   `systemd-network` system user to exist, so create it.
2018-07-03 14:49:50 +02:00
Lennart Poettering
810adae9e9 tree-wide: use proper unicode © instead of (C) where we can
Let's use a proper unicode copyright symbol where we can, it's prettier.

This important patch is very important.
2018-06-14 10:20:20 +02:00