Commit graph

831 commits

Author SHA1 Message Date
Luca Boccassi fc3fe92bc8
Merge pull request #28508 from yuwata/network-next-dhcp4
network: several cleanups and fixes for DHCPv4 client
2023-07-29 12:15:38 +01:00
Susant Sahani ab2d9e2971 CI: network - Add test for rp_filter 2023-07-28 15:05:12 +05:30
Yu Watanabe 4001653ddb network/dhcp4: always honor specified gateway address
Follow-up for 77451f654a.

Now, gateway for routes to DNS or NTP servers should be correctly picked,
hence it is not necessary to adjust the gateway address in
dhcp4_request_route_auto() again.

Also, similar for classless static routes, let's always honor
gateway address specified in (non-classless) static routes.
2023-07-28 05:47:11 +09:00
Yu Watanabe 0ce86f5eeb network/dhcp4: always find suitable gateway for destination address
And if not found, refuse to configure the route.

If a DHCP server provides classless static or static routes, then we
should use the gateway for accessing a node in the range specified in
the route. E.g. if a DHCP server provides the default gateway is
192.168.0.1, and classless static route for 8.0.0.0/8 with gateway
192.168.0.2, then we should access 8.8.8.8 through 192.168.0.2 rather
than 192.168.0.1, but should use 192.168.0.1 for 9.9.9.9.

Fixes #28358.
2023-07-28 05:45:51 +09:00
Frantisek Sumsal 8bdece7479 network: fix fetching link properties
This fixes regression introduced in 5a0c810462 with which all requests
for link properties ended up with EINVAL as we kept hitting
the signature_is_single() assert in sd_bus_get_property().
2023-07-18 23:08:19 +02:00
Frantisek Sumsal 7e107bc31f test-network: probe a couple of uncovered networkctl codepaths 2023-07-18 21:42:39 +02:00
Frantisek Sumsal aca99a3a38 test-network: validate JSON where applicable 2023-07-18 21:42:39 +02:00
Frantisek Sumsal c1dd58b3b6 test-network: check for captive portals received via NDISC
This requires fairly recent radvd that supports sending RAs with captive
portals [0].

Also, this should hopefully provide coverage for issues like:
  - https://github.com/systemd/systemd/issues/28229
  - https://github.com/systemd/systemd/issues/28231
  - https://github.com/systemd/systemd/issues/28277

[0] https://github.com/radvd-project/radvd/pull/141
2023-07-18 11:38:58 +02:00
Frantisek Sumsal 5a000cd46f test-network: correctly support running systemd-udevd from the build dir
We create the udevadm -> systemd-udevd symlink during the install phase,
so it doesn't exist in the just compiled tree. This worked in CI since
the symlink is manually created there post-build.
2023-07-17 12:56:58 +02:00
Yu Watanabe fc25920c94 test-network: add tests for null addresses
For issue #26113.
2023-07-07 19:11:37 +09:00
Yu Watanabe 86f6760038 test-network: add one more testcase for DHCPv4 classless route
For issue #28280.
2023-07-07 06:57:08 +09:00
Yu Watanabe 62eaf8d039 test-network: drop ExecReload= in networkd.service and udevd.service
Follow-up for 0e07cdb0e7 and
f84331539d.
2023-07-06 14:55:58 +09:00
Ronan Pigott 1219391c9f test-network: add test for an invalid captive portal uri
This could probably be extended to include many more invalid uri
2023-07-03 13:47:12 -07:00
Yu Watanabe e4948bb2cd test-network: add test for static route with preferred source
This adds possible reproducer for issue #28009 (though, the issue is
highly racy, hence this may not trigger the issue reliably).
2023-07-03 16:13:49 +09:00
Yu Watanabe 7e30527806 test-network: check route more strictly 2023-07-03 16:06:17 +09:00
Yu Watanabe 86c2a76e09
Merge pull request #28132 from rpigott/dhcp-captive-portal
Implement RFC8910: captive portal dhcp options
2023-07-03 14:51:56 +09:00
Ronan Pigott dbe960f07f test-network: add tests for captive portal dhcp options 2023-07-02 01:13:43 -07:00
Frantisek Sumsal a5e478b24c test: fix test_vxlan with the latest iproute2
Some options were renamed and some options with default values are not
shown unless -d(etails) is repeated.

See: https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=1215e9d3862387353d8672296cb4c6c16e8cbb72
2023-06-30 17:33:40 +00:00
Yu Watanabe 856a247e19 test-network: add test for global IPv6PrivacyExtensions= setting 2023-06-29 21:58:23 +09:00
Yuxiang Zhu b67e8a4e3e
network: Add IgnoreDdontFragment= option for Fragmentation control (#28131)
From `ip-link(8)`:
> [no]ignore-df - enables/disables IPv4 DF
                      suppression on this tunnel.  Normally datagrams
                      that exceed the MTU will be fragmented; the
                      presence of the DF flag inhibits this, resulting
                      instead in an ICMP Unreachable (Fragmentation
                      Required) message.  Enabling this attribute causes
                      the DF flag to be ignored.

If this option is enabled for a GRE/GRETAP tunnel, the `DF` flag in the outer IP header
will not inherit the inner IP header's `DF` flag.

This is useful to transfer packets that exceed the MTU of the underlay
network.
2023-06-29 12:11:52 +02:00
Henrik Holst cf4dbd84ac
network: make degraded-carrier bond/bridge as routable (#27776)
This makes a bond or bridge interface in the degraded-carrier state but has a routable address
handled as routable operational state.

If the carrier is degraded but the address state is routable then the operational state should be
seen as routable and not degraded because that may be the case for bonds if some of the links are down,
but when that happens the bond as whole is still routable.

This also makes operational state to degraded if address state is degraded even if the link state is
degraded-carrier.

Fixes #22713.
2023-06-15 13:32:10 +09:00
Yu Watanabe 322bda8241
Merge pull request #27826 from yuwata/network-link-ready-without-ndisc-when-has-static-address
network: do not request dynamic addressing protocols finished when at…
2023-06-01 06:29:55 +09:00
Yu Watanabe 2f96a29c2c wait-online: request that at least one managed online interface exists
Fixes a regression caused by ab3aed4a03.

I thought the commit does not cause any severe regression. However,
drivers for network interfaces may be loaded later. So, we should wait
if no network interface is found.

Fixes #27822.
2023-05-31 22:12:03 +02:00
Yu Watanabe 9e7d91ed97 network: do not request dynamic addressing protocols finished when at least one static address is configured
The setting IPv6AcceptRA= is defaults to yes, hence, even if a .network
file for an interface has static IP address configuration, it may takes
few seconds for the interface being configured state, as NDisc for the
interface needs to be finished. That makes wait-online.service
needlessly slow. Typically, such delay is not necessary for statically
configured networks.

Let's make the required condition slightly relaxed; if a .network file
has static IP address configurations, then let's make the matching
interface enter the 'configured' state soon after the static addresses
configured on the interface.

Note, this does not change the default for IPv6AcceptRA=, hence, NDisc
still runs on interfaces by default. So, addresses, routes, DNS servers,
and so on based on RA will be assigned on interfaces later.

Strictly speaking, this breaks backward compatibility, but the previous
behavior is not clearly documented. If a user requested both static
IPv4 address and IPv6 SLAAC address configured before an interface being
entered to the 'configured' state, then '--ipv6' for wait-online can be
used. So, the behavior change should not cause severe regression.

Closes #27779.
2023-05-30 17:39:11 +09:00
Yu Watanabe 73d24e45f8 test-network: add tests for vlan QoS mapping 2023-05-24 11:15:44 +09:00
Yu Watanabe 82c60c939c test-network: add tests for static lease matching with chaddr
Follow-up for 4646cdaa37 (#27313).
2023-05-12 03:07:10 +09:00
Yu Watanabe 8e2449a5c9 test-network: add workaround for bug in iproute2 v6.2.0
Closes #27473.
2023-05-01 20:02:15 +02:00
Daan De Meyer 3ceb96e018 test: Install systemd-networkd-tests.py when install_tests is enabled 2023-03-29 12:18:42 +02:00
Dmitry V. Levin 30fd9a2dab treewide: fix a few typos in NEWS, docs and comments 2023-02-15 10:41:03 +00:00
Yu Watanabe e5e0743189 network: assume prefix length is full address size
The commit 0f707207b9 enables strong
warning about missing prefix length in Address= setting.
The change was done in v241, and was about 4 years ago.
Let's drop the legacy assumption and make the parser consistent with
'ip address' command.

C.f. #11307.
Closes #26102.
2023-01-19 22:09:10 +09:00
Yu Watanabe a93cc5d911 test-network: drop unused file 2023-01-19 21:22:22 +09:00
Yu Watanabe df0a741cdd test-network: reprocess the loopback network interface
Fixes the issue reported at https://github.com/systemd/systemd-centos-ci/pull/585#issuecomment-1385537641.
2023-01-18 14:08:14 +00:00
Yu Watanabe 56dfde0d54 test-network: add testcase for no managed interface 2022-12-22 16:42:55 +09:00
Yu Watanabe b09ec84700 test-network: split out wait-online related test case 2022-12-22 16:29:20 +09:00
Yu Watanabe 5432adae82 test-network: move one test case 2022-12-22 16:27:58 +09:00
Nick Rosbrook f68f644a16 test-network: add a test for renaming device to current altname 2022-12-15 10:36:14 -05:00
Yu Watanabe b448fc0a6f test-network: try to change MAC address more
Follow-up for 23b6bf274f.
2022-12-07 15:08:23 +01:00
Jian Zhang 23b6bf274f test-network: add test for bond mac address config
Signed-off-by: Jian Zhang <zhangjian.3032@bytedance.com>
2022-12-06 14:41:31 +08:00
Yu Watanabe 77d5f36d93 test-network: add tests for RTT and ACK filter for CAKE 2022-11-19 07:08:26 +09:00
Yu Watanabe 7618ab1b71 test-network: skip test_match if alternative name is not supported by kernel
Fixes #25259.
2022-11-10 10:05:43 +00:00
Yu Watanabe fcd7998880 test-network: wait for bound interface to be processed by udevd
If another bound interface (dummy98) will be removed before that dummy99
is processed by udevd, then removing dummy98 in the next step makes the
target interface (test1) bring down.

Follow-up for 3e2f7c46da.
2022-11-02 08:24:01 +09:00
Luca Boccassi 2f23762451
Merge pull request #25192 from yuwata/wait-online-altname
wait-online: support alternative interface names
2022-11-01 18:31:08 +01:00
Yu Watanabe d8746f1620 test-network: explicitly prepare default.link
On CentOS CI (Arch), 99-default.link is masked. Let's explicitly provide
the same .link file with a different prefix number.
2022-11-01 22:38:37 +09:00
Yu Watanabe b95d35b5ed test-network: resolve interface name from alternative name 2022-11-01 22:38:37 +09:00
Yu Watanabe d7ff72ec9c test-network: fix use of undeclared variable 2022-11-01 22:38:37 +09:00
Yu Watanabe dee6c26f3e test-network: make link_exists() support alternative names 2022-11-01 22:38:37 +09:00
Yu Watanabe 3e2f7c46da test-network: add a testcase that all bound interfaces removed
Closes #4202.
2022-11-01 10:28:57 +00:00
Luca Boccassi 0be7f1936c
Merge pull request #25143 from yuwata/network-reconfigure-interface-when-renamed
network: reconfigure interface when renamed
2022-10-31 21:14:24 +01:00
Luca Boccassi 4b9cfe08ba
Merge pull request #25166 from yuwata/network-router-preference
network: adjust route metric based on router preference
2022-10-31 20:59:36 +01:00
Yu Watanabe fa4d3fed46 test-network: add testcase for reconfiguring interface 2022-10-31 09:35:05 +09:00
Frantisek Sumsal f9073c24de test-network: suppress a couple of minor pylint complaints 2022-10-30 20:52:24 +01:00
Frantisek Sumsal ef11b841cd test-network: sort standard imports before "third-party" ones 2022-10-30 20:52:20 +01:00
Frantisek Sumsal e43776595c test-network: drop a couple of useless f-strings 2022-10-30 20:43:35 +01:00
Frantisek Sumsal 0677130e81 test-network: use raw strings where appropriate 2022-10-30 20:43:28 +01:00
Frantisek Sumsal b3de9d7bda test-network: re-enable test_macsec
The outstanding kernel panic should be already fixed in recent enough
kernels by [0]. To make the test safe to run anywhere, let's implement
a simple kernel version check and run the test only if we're running
with at least kernel 6.x. The patch might be in some 5.x kernels as
well, but let's be on the safe side and use 6.x as a baseline here
(which is currently the case for Arch and Fedora Rawhide anyway).

[0] https://lore.kernel.org/netdev/7b3fd03e1a46047e5ffe2a389fe74501f0a93206.1656519221.git.sd@queasysnail.net/T/#u
2022-10-30 20:42:11 +01:00
Yu Watanabe ee3cbfdbbc test-network: rewrite wait-online address family tests
Fixes #25154.
2022-10-28 12:26:52 +02:00
Yu Watanabe bb80f633bf test-network: add testcase for router preference 2022-10-28 15:56:59 +09:00
Yu Watanabe b4f4f1191e test-network: show only IPv4 routes 2022-10-28 11:35:28 +09:00
Zbigniew Jędrzejewski-Szmek 0923b4253c tree-wide: replace "plural(s)" by "plurals"
(s) is just ugly with a vibe of DOS. In most cases just using the normal plural
form is more natural and gramatically correct.

There are some log_debug() statements left, and texts in foreign licenses or
headers. Those are not touched on purpose.
2022-10-17 15:10:53 +02:00
Yu Watanabe 767bc538c5 test-network: fix matching string
This partially reverts 5515f2169c.
As the commit changes 'networkctl list', not 'networkctl status'.
2022-09-23 10:43:17 +09:00
Zbigniew Jędrzejewski-Szmek 5515f2169c networkctl: use "-" for empty fields
This looks nicer. Some fields were already using "-" as fallback, e.g. Speed,
so this makes things more consistent too.
2022-09-21 14:48:28 +02:00
Topi Miettinen a4640bed74 test: testing for networkd NetLabel feature 2022-08-29 14:23:17 +09:00
Yu Watanabe 8d2a55025b test-network: add missing online check 2022-08-28 08:07:25 +00:00
Yu Watanabe 93e898d624 test-network: add test for TCPCongestionControlAlgorithm= 2022-08-26 19:47:27 +09:00
Yu Watanabe b249834bc3 test-network: add test for issue #24377
The issue has been already fixed by
b05e52000b (PR #24020).
2022-08-20 20:50:02 +09:00
Yu Watanabe 5bd2a7c580 test-network: add helper functions for reading logs of networkd 2022-08-20 20:35:18 +09:00
Yu Watanabe 3af934bceb test-network: add tests for IPv4ACD and renewing DHCP address 2022-08-18 15:44:53 +09:00
Yu Watanabe fd022b1da5 test-network: drop unused .network file 2022-08-18 15:44:53 +09:00
Yu Watanabe 59edcf2b64 test-network: add/update module check
For https://github.com/systemd/systemd-centos-ci/pull/517.
2022-08-17 10:05:20 +00:00
Luca Boccassi e4e6cfaad0
Merge pull request #24301 from yuwata/network-tuntap
network/tuntap: introduce KeepFileDescriptor= setting
2022-08-16 23:06:16 +01:00
Yu Watanabe 21d0ed68ee test-network: add tests for MTUBytes= for bridge master and ports
Prompted by #24311.
2022-08-16 21:46:40 +00:00
Yu Watanabe ae014ecb3d test-network: add tests for KeepCarrier= for tuntap interfaces 2022-08-16 21:57:35 +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
Yu Watanabe 85b1a14d70 test-network: use "systemctl restart" to restart networkd 2022-08-14 03:56:01 +09:00
Yu Watanabe 93f5ae6ba2 test-network: also set StartLimitIntervalSec=0 for systemd-networkd.socket
The socket unit is frequently restarted during the test.
2022-08-14 03:49:00 +09:00
Yu Watanabe 23b3819209 test-network: split out qdisc and wait-online tests from NetworkdNetworkTests 2022-08-09 19:37:50 +09:00
Yu Watanabe 4c7d13f4b2 test-network: split test_qdisc() and test_qdisc2()
And check module availability in each tests.

This also sorts qdisc tests.
2022-08-09 19:37:50 +09:00
Yu Watanabe 854f989958 test-network: check qdisc feature by module existence 2022-08-09 19:37:50 +09:00
Yu Watanabe 5cdc7c89cb test-network: rename tun99 and tap99
The names seem to be used in AWS.

This also merges test_tun() and test_tap().
2022-08-09 19:37:49 +09:00
Yu Watanabe 17479d51cc test-network: show stdout and stderr on failure in check_output() 2022-08-09 19:37:49 +09:00
Yu Watanabe 66504b22e2 test-network: drop unused text= arguments 2022-08-09 19:37:49 +09:00
Yu Watanabe b05c4d6bbf test-network: also run timesyncd under sanitizer or valgrind 2022-08-09 19:37:49 +09:00
Yu Watanabe 67a9b3ec94 test-network: use timedatectl in build directory 2022-08-09 19:37:49 +09:00
Yu Watanabe 49ad287292 test-network: support the case that l2tp module is not supported
Hopefully fixes the issue reported at
https://github.com/systemd/systemd-centos-ci/pull/517#issuecomment-1205399798.
2022-08-04 18:39:04 +00:00
Yu Watanabe e4e0b239f6 test-network: add test case for #23197 2022-08-02 03:43:04 +09:00
Yu Watanabe 32ab27afe8 test-network: reload udevd when .link file is copied/removed 2022-07-23 15:05:22 +09:00
Yu Watanabe c9fbe0bd10
Merge pull request #24074 from yuwata/network-dhcp6-rapid-commit
network: dhcp6: re-introduce RapidCommit= setting
2022-07-23 08:10:01 +09:00
Yu Watanabe 91a7afdeae test-network: add tests for RapidCommit= 2022-07-22 21:28:24 +09:00
Yu Watanabe b1eaae53a2 test-network: drop unnecessary call of systemctl
As the units are not started at that stage.
2022-07-22 10:36:00 +09:00
Yu Watanabe 249b7eccf7 test-network: drop unnecessary default argument 2022-07-22 10:34:33 +09:00
Yu Watanabe 87b308c825 test-network: do not stop/restart udevd and related socket units
That's not necessary. Moreover, if the socket units are stopped in
`setUpModule()`, then there exists a short timespan that we cannot call
`udevadm control`, as the control socket may not be opened yet.

If we run whole tests, then the first test is
NetworkctlTests.test_altname, and it calls `udevadm control` in `setUp()`.
Hence, the test may fail.

Fixes https://github.com/systemd/systemd-centos-ci/pull/512#issuecomment-1191591008.
2022-07-22 10:31:38 +09:00
Yu Watanabe 72c747e6d1 test-network: add a test case for IPv4LLStartAddress= 2022-07-15 04:01:56 +09:00
Yu Watanabe f54dce2d4f test-network: save and restore timezone
Several DHCP client tests change the system timezone.
Let's save the current timezone at the beginning, and restore it with
the saved value at the end.
2022-07-13 10:30:48 +02:00
Yu Watanabe e11d0e3925 test-network: wait for L2TP tunnels being removed
Fixes #23985.
2022-07-13 02:36:14 +02:00
Yu Watanabe e755ad61ba test-network: support to remove routing policy rules with l3mdev flag 2022-07-11 22:39:26 +02:00
Yu Watanabe b5dac5b0de test-network: merge stdout and stderr of invoked command by call()
Otherwise, the logs may be messed up.
2022-07-11 22:38:21 +02:00
Yu Watanabe a962d85797 test-network: various cleanups
- introduce several helper functions
- do not list unit files, but remove the runtime unit directory in
  tearDown().
- do not list used interfaces, but remove all interfaces previously not
  exists in tearDown().
- save routes and routing policy rules before running tests, and flush
  unnecessary routes and rules in each tearDown() calls.
- drop many time.sleep() calls.
- call tearDown() after each sub tests.
- shorten code.
- several coding style fixes.
- etc, etc...

Hopefully, this improves performance of the test.
2022-07-11 19:57:24 +02:00
Yu Watanabe 286bf3a940 test-network: extend timeout for DHCP lease to be expired
Fixes #23964.
2022-07-11 16:54:45 +02:00
Yu Watanabe 37611ccb19 test-network: use wait_operstate() at one more place 2022-07-09 12:20:11 +09:00
Yu Watanabe 894ff7d1ab test-network: suppress periodic output in wait_operstate() 2022-07-09 12:19:52 +09:00
Yu Watanabe 163d095fc3 test-network: disable debugging logs from networkctl, resolvectl, and so on 2022-07-09 12:19:20 +09:00
Yu Watanabe 589af70b87 test-network: merge two DHCPv6 client tests 2022-07-09 11:44:25 +09:00
Yu Watanabe 4b31fc88ac test-network: replace sleep with wait_address() and wait_address_dropped() 2022-07-09 11:44:25 +09:00
Yu Watanabe 0730e3767d test-network: merge two more tests with test_dhcp_client_ipv4_only 2022-07-09 11:44:25 +09:00
Yu Watanabe 3d8e0aa2de test-network: merge tests for UseDNS= 2022-07-09 11:44:25 +09:00
Yu Watanabe 2d7a594fee test-network: merge two IPv4LL tests 2022-07-09 11:44:25 +09:00
Yu Watanabe 15519a81ac test-network: drop test_dhcp_client_ipv4_ipv6
As the test is covered by test_dhcp_client_reuse_address_as_static.
2022-07-09 11:44:25 +09:00
Yu Watanabe 2b6a24a602 test-network: check DHCPv4 address in more detail
Also, this drops redundant address check through networkctl.
2022-07-09 11:44:25 +09:00
Yu Watanabe e81083f2d8 test-network: drop 25-dhcp-v4-server-veth-peer.network 2022-07-09 11:44:25 +09:00
Yu Watanabe b17947d9cf test-network: drop meaningless test
On DHCPv6 lease renew, the kernel do not drop static routes, and hence
we do not try to reassign them. Hence, the test is mostly meaningless.
2022-07-09 11:44:25 +09:00
Yu Watanabe 063c7e9b13 test-network: introduce read_dnsmasq_log_file() helper function
This reduces the number of times that the log file is read.
Also, dropped unnecessary dump of the log file.
2022-07-09 11:44:25 +09:00
Yu Watanabe a102a52c34 test-network: shorten sleep time a bit
Network interfaces will be ready after lease is acquired.
Hence, it is not necessary to wait more than lease time.
2022-07-09 11:44:25 +09:00
Yu Watanabe 1a8e1d7853 test-network: introduce read_link_state_file() helper function 2022-07-09 11:44:21 +09:00
Yu Watanabe 18f2638f48 test-network: merge DHCP client tests to improve performance 2022-07-08 13:04:02 +00:00
Frantisek Sumsal f4586b70b2 test-network: drop unnecessary global
`global` is needed only when assigning a new value to the global
variable; it's not necessary when modifying a mutable object (in our
case we just append items to the global list).
2022-06-11 18:06:38 +02:00
Frantisek Sumsal d45476ef5c test-network: explicitly set encoding when open()ing text files 2022-06-11 18:03:28 +02:00
Frantisek Sumsal e4295d4ddc test-network: make use of f-strings in couple more places 2022-06-11 17:54:59 +02:00
Frantisek Sumsal 004daaf5a1 test-network: override networkctl bin w/ valgrind/sanitizers 2022-06-11 17:47:52 +02:00
Yu Watanabe 66dc5d82b5 test-network: call networkctl only when specified interface exists
Otherwise, this easily trigger another exception:
```
======================================================================
ERROR: test_erspan_tunnel_v0 (__main__.NetworkdNetDevTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./test/test-network/systemd-networkd-tests.py", line 686, in wait_online
    check_output(*args, env=env)
  File "./test/test-network/systemd-networkd-tests.py", line 65, in check_output
    return subprocess.check_output(command, universal_newlines=True, **kwargs).rstrip()
  File "/usr/lib64/python3.6/subprocess.py", line 356, in check_output
    **kwargs).stdout
  File "/usr/lib64/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/usr/lib/systemd/systemd-networkd-wait-online', '--timeout=20s', '--interface=erspan99:routable', '--interface=erspan98:routable', '--interface=dummy98:degraded']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./test/test-network/systemd-networkd-tests.py", line 1808, in test_erspan_tunnel_v0
    self.wait_online(['erspan99:routable', 'erspan98:routable', 'dummy98:degraded'])
  File "./test/test-network/systemd-networkd-tests.py", line 689, in wait_online
    output = check_output(*networkctl_cmd, '-n', '0', 'status', link.split(':')[0], env=env)
  File "./test/test-network/systemd-networkd-tests.py", line 65, in check_output
    return subprocess.check_output(command, universal_newlines=True, **kwargs).rstrip()
  File "/usr/lib64/python3.6/subprocess.py", line 356, in check_output
    **kwargs).stdout
  File "/usr/lib64/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/usr/bin/networkctl', '-n', '0', 'status', 'erspan99']' returned non-zero exit status 1.
```
2022-06-01 04:02:49 +09:00
Yu Watanabe 2f0260c1bb test-network: add tests for erspan version 0 and 2 2022-06-01 04:02:49 +09:00
Yu Watanabe 93a72170bd network: drop support for old kernels which cannot set prefix route with non-main route table
Not sure when the issue was fixed.
- kernel-3.10 on CentOS 7 has the issue,
- kernel-4.18 on CentOS 8 works fine.

Note, the workaround dropped by the commit is not incomplete:
with an old kernel which has the issue, all non-prefix routes are
configured on the specified route table, but the prefix route is
configured on the main table. That should not work for most cases,
hence, the workaround is mostly meaningless.
2022-05-21 15:09:53 +01:00
Yu Watanabe acfe3b65e1 test-network: add test for showing Bond parameters 2022-05-17 22:35:27 +09:00
Yu Watanabe f7ad162879 test-network: rename one .netdev to make the file removed after the test
Follow-up for 7809cab717.
2022-04-06 18:14:45 +09:00
Yu Watanabe 0c91c7a241 network: l2tp: change create type to independent
L2TP tunnel does not have underlying interface. Let's change its type to
independent.
2022-02-27 09:36:48 +09:00
Yu Watanabe 8b49ee2dcd network: l2tp: make Local= optionally take interface name 2022-02-27 09:36:48 +09:00
Luca Boccassi 6b3211c15e
Merge pull request #22611 from yuwata/network-activation-policy-stacked-netdevs
network: make activation policy also work for stacked netdevs
2022-02-24 22:57:35 +00:00
Yu Watanabe ee9918ae46 test-network: add test case for activation policy for stacked netdevs
For issue #22593.
2022-02-24 16:25:05 +09:00
Yu Watanabe 459c35d4c5 test-network: check existence before calling networkctl or ip command 2022-02-24 16:25:05 +09:00
Yu Watanabe 3c39b9cf37 test-network: remove unused configs 2022-02-24 08:37:30 +09:00
Yu Watanabe 6dcc087cb6 test-network: add testcases for address property change
This adds a testcase for issue #22515.
2022-02-24 07:37:50 +09:00
Yu Watanabe 07b7337aff network: dhcp-pd: allow to assign the same subnet prefix to multiple interfaces
There is no reason networkd refuses that. Especially, when multiple
downstream interfaces are connected to the same network, it is natural to
assign the same subnet prefix to them.

Prompted by #22571.
2022-02-22 20:39:32 +09:00
Yu Watanabe 38488babe7 network: dhcp-pd: fix prefix length of address assigned to upstream interface
This effectively revert ab0c82d9f7.

I have no idea why I did that...

Fixes #22559.
2022-02-22 20:39:28 +09:00
Daan De Meyer 1e86c83308 test: Prefix all network/netdev config files used by systemd-networkd-tests.py
Let's make sure these take preference over any generic network config files shipped
by the OS (in this case specifically, mkosi).
2022-02-15 22:53:43 +00:00
Daan De Meyer e2bf0a72ea test: Skip test_macsec() until kernel panic is fixed 2022-02-15 22:53:40 +00:00
Daan De Meyer 0f1853e230 mkosi: Support running systemd-networkd-tests.py in QEMU
This commit adds the necessary packages for Fedora and Arch.
2022-02-15 22:11:39 +00:00
Daan De Meyer 0765763e51 test: Stop using TextTestRunner in systemd-networkd-tests.py
If we assign our own test runner, passing arguments stops working
as unittest won't instantiate its own test runner after it parses
the arguments from sys.argv.

Consequence is that the tests will write to stderr now instead of
stdout since it doesn't seem possible to configure the stream that
unittest.main() will instantiate its test runner with so it'll
default to sys.stderr.
2022-02-15 23:32:06 +09:00
Yu Watanabe 2d88df457a
Merge pull request #22471 from yuwata/network-bridge-vlan-protocol
network: bridge: fix vlan protocol
2022-02-10 20:40:04 +09:00
Yu Watanabe ac7e18be76
Merge pull request #22452 from yuwata/network-ipv6ll
network: use sysctl to set IPv6LL address generation mode when the interface is already up
2022-02-10 20:38:56 +09:00
Yu Watanabe b6d5dab7bb test-network: add missing tests for bridge properties 2022-02-10 18:04:34 +09:00
Yu Watanabe 2becdbccd1 test-network: add testcase for re-generating IPv6LL address 2022-02-10 17:35:48 +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
Luca Boccassi 75844b44ee
Merge pull request #22408 from mrc0mmand/test-network-cleanup
test-network: code cleanup
2022-02-03 22:50:38 +00:00
Frantisek Sumsal 87bf983c55 test-network: disable irrelevant or one-time pylint checks 2022-02-03 19:31:15 +01:00
Frantisek Sumsal 54e2f32f50 test-network: use specific exceptions instead of the Exception class 2022-02-03 19:30:11 +01:00
Frantisek Sumsal a561bceeaa test-network: avoid name clashing/redefinition 2022-02-03 19:20:42 +01:00
Frantisek Sumsal 524cc9d1d8 test-network: disable 'no-member' warning for the Utilities class
The warning is correct, since we don't inherit the necessary
unittest.TestCase class, but that's on purpose, since the Utilities
class is not supposed to be instantiated on its own, but should
complement other classes' definitions which do inherit from the
unittest.TestCase class.
2022-02-03 19:13:06 +01:00
Frantisek Sumsal 283863a116 test-network: use raw strings for regexes with backslashes
It currently works because `\(` and `\)` are not valid escape sequences,
so they're not treated differently. Using raw strings (or double
backslashes) is a more correct solution.
2022-02-03 18:55:12 +01:00
Frantisek Sumsal 535e8107ee test-network: explicitly set check=False for subprocess.run()
since we're checking the returned error code explicitly via the
`returncode` member.
2022-02-03 18:49:35 +01:00
Frantisek Sumsal f7805a6c79 test-network: convert certain multiline strings to comments
Multiline comments are converted to docstrings only when they're the
first statement in a function/method. Even though they're still a no-op
otherwise, let's use "true" comments to make pylint happy.
2022-02-03 18:42:41 +01:00
Frantisek Sumsal 45dbd0b945 test-network: drop unused variables 2022-02-03 18:18:29 +01:00
Frantisek Sumsal 19aa7f99c7 test-network: drop unnecessary else statements 2022-02-03 18:18:29 +01:00
Frantisek Sumsal 6983bb0e5e test-network: drop unnecessary semicolons 2022-02-03 18:18:27 +01:00
Frantisek Sumsal 83bceef027 test-network: drop superfluous parens 2022-02-03 18:10:06 +01:00
Yu Watanabe 7809cab717 test-network: add testcase for external tunnel 2022-02-03 11:12:34 +09:00
Yu Watanabe 6a8ab6dd1e
Merge pull request #22332 from yuwata/network-dhcp-server-dns-server-address
network: dhcp-server: allow to specify server address for DNS= or friends
2022-02-02 07:07:22 +09:00
Yu Watanabe c5f7a08739 test-network: add tests for DNS=_server_address in [DHCPServer] 2022-02-02 05:01:59 +09:00
Luca Boccassi 98fd285c28
Merge pull request #22331 from yuwata/network-xfrm-interface-id
network: xfrm: refuse zero interface ID
2022-02-01 13:25:38 +00:00
Yu Watanabe 020483b248 test-network: set xfrm interface ID
This also unifies two tests for xfrm, and checks the output of
'ip link' command.

Fixes #22329.
2022-02-01 13:26:43 +09:00
Yu Watanabe a0e99a377a network: remove only managed configs on reconfigure or carrier lost
Otherwise, if the carrir of the non-managed interface is lost, the
configs such as addresses or routes on the interface will be removed by
networkd.
2022-02-01 11:30:37 +09:00
Yu Watanabe 073ad7ed1f test-network: wait for a while if manual policy is always-{up,down}
If wait_operstate() is called super quickly after ip command, then the
up/down state may not be changed and propagated to networkd, and
wait_operstate() mistakenly pass with the previous state.

To avoid such situation, wait for a while to make networkd actually
detect the interface brought up/down.
2022-01-28 07:29:37 +09:00
Yu Watanabe ebb5036ff2 test-network: dummy interface is initially down when activation policy is manual 2022-01-28 07:17:08 +09:00
Yu Watanabe cfbdc4387f test-network: wait for the link is activated
This fixes the following race:
1. when a dummy interface is created, it is initially down state,
2. hence, wait_operstate() may pass before the link is activated,
3. and the ip command bring up the interface before the activation,
4. and networkd activates, that is, brings down the interface,
5. thus, next wait_operstate() timedout, as it waits for the interface up.

To fix the race, let's wait the link is activated, before enter the loop
of wait_operstate().

Fixes #22267.
2022-01-28 07:02:03 +09:00
Yu Watanabe b67f3d73b0 test-network: always cleanup the testing environment
Previously, if a subtest fail, then the cleanup process does not run,
and affects the subsequent tests.
2022-01-28 06:59:52 +09:00
Yu Watanabe 1e8e9730d2 test-network: add testcases for configuring SR-IOV by .link file 2022-01-19 15:00:53 +09:00
Yu Watanabe a03ff4c0fe test-network: split out SR-IOV test to new class 2022-01-19 15:00:53 +09:00
Yu Watanabe 0eed039c92 test-network: silence check for alternative names 2022-01-19 15:00:53 +09:00
Yu Watanabe 902bbdc4b6 network: use scope link for direct unicast routes by default
Strictly speaking, this breaks the backward compatibility, but I guess
in most cases people already sets Scope=link for such routes.

This behavior matches with how 'ip route' command adds such route by
default.

Prompted by https://twitter.com/jplitza/status/1480500562391179270.
2022-01-13 22:46:52 +00:00
Yu Watanabe 14b451f20a test-network: add testcase for invalid AllowedIPs= 2021-12-31 02:31:12 +09:00
Yu Watanabe 49ad8da779 test-network: add testcase for vxlan local address auto selection 2021-12-25 15:32:06 +09:00
Yu Watanabe 7726526cc6
Merge pull request #21648 from yuwata/network-tunnel-local-automatic-address-selection
network: tunnel: automatic local address selection
2021-12-25 15:05:13 +09:00
Yu Watanabe 6a936c9c9a test-network: add tests for renewing/rebinding lease 2021-12-18 10:09:07 +09:00
Yu Watanabe 2616b5285f test-network: introduce dump_dnsmasq_log_file() 2021-12-18 10:09:07 +09:00
Yu Watanabe 4862fb693d test-network: use dnsmasq for testing DHCP4-6RD 2021-12-18 10:09:07 +09:00
Yu Watanabe f56af3b4c8 test-network: use --bind-interfaces option for dnsmasq
Also make the interface name and router address configurable.
2021-12-18 10:09:07 +09:00
Yu Watanabe fe87807eaa network: dhcp-pd: do not stack 6rd sit tunnel 2021-12-18 10:09:07 +09:00
Yu Watanabe 2347b6b94e test-network: wait for veth99 being configured
As the address, which should be kept, may not be just removed yet.
Let's check that the address is actually kept.
2021-12-17 00:14:30 +09:00
Yu Watanabe da7d684825 test-network: add testcase for automatic tunnel local address selection 2021-12-12 14:11:38 +09:00
Yu Watanabe 42592d0ad4 test-network: support the case that the default config files are not installed yet 2021-12-07 20:33:20 +09:00
Yu Watanabe 84cc85f983 test-network: add test for 6rd 2021-12-07 20:33:20 +09:00
Yu Watanabe a27588d4e7 network: dhcp-pd: rename [DHCPv6PrefixDelegation] -> [DHCPPrefixDelegation]
This just changes the names of settings, variables, functions, files, and so on.
No functionality is changed.

Preparation for supporting 6rd.
2021-12-07 20:30:30 +09:00
Yu Watanabe ab0c82d9f7 network: dhcp6pd: assign addresses in the delegated prefix instead of a subnet prefix /64 on upstream interface 2021-12-07 19:46:37 +09:00
Yu Watanabe 45aa0e841b network,udev: do not adjust local assignment bit of specified MAC address
People often assigns the MAC address of the enslaved interface to e.g.
bridge interface. So, the local assignment bit should not be adjusted.

Fixes #21649.
2021-12-07 15:01:04 +09:00
Yu Watanabe 133f65ef2c test-network: start dhcpd after address is assigned 2021-12-06 19:18:55 +09:00
Yu Watanabe 5f7f1f824f test-network: make start_isc_dhcpd() take IP version 2021-12-06 19:18:55 +09:00
Yu Watanabe 6016f1cfbb test-network: re-arrange DHCP6-PD subnet IDs to test searching free subnet ID 2021-12-01 20:35:03 +09:00
Yu Watanabe 6c8d6bdd40 test-network: add testcases for uplink interface detection for RADV with DHCPv6-PD 2021-12-01 20:35:03 +09:00
Yu Watanabe 6387cac3f3 test-network: add tests for creating routes to wireguard's AllowedIPs= 2021-12-01 04:00:16 +09:00
Yu Watanabe 94f0bd624b test-network: add more basic tests for network json formats 2021-11-30 10:03:51 +09:00
Yu Watanabe 007899f43e network/netdev: verify specified MAC address
Drop multicast bit and set local bit of the specified MAC address.

This also makes failure in generating persistent MAC address
non-critical.
2021-11-27 06:39:04 +09:00
Zbigniew Jędrzejewski-Szmek 66a8eddd6d
Merge pull request #21360 from yuwata/network-json
network: json: add more information
2021-11-26 11:04:52 +01:00
Yu Watanabe 146726b2f5 test-network: add basic tests of json output 2021-11-25 22:35:35 +09:00
Yu Watanabe a8840714f3 network: make MACAddress= takes hardware address with its length is INFINIBAND_ALEN
Also, the multicast and local bits in the specified MAC address for
ethernet are adjusted.
2021-11-25 22:03:19 +09:00
Yu Watanabe b36caceb88 test-network: check if actually alternative name is set
Fixes #21404.
2021-11-17 12:58:08 +09:00
Yu Watanabe 3e3b0d2a40 test-network: make udevd also generate debugging logs 2021-11-17 08:32:45 +09:00
Yu Watanabe 7a2e124b08 test-network: add testcases for Token=prefixstable with UUID 2021-11-14 13:29:44 +09:00
Yu Watanabe 0b251e8bf9 test-network: add testcases for CAKE settings 2021-11-09 10:58:44 +09:00
Yu Watanabe ab7b261663
Merge pull request #21210 from yuwata/network-dhcp-server-introduce-router-setting
network: dhcp-server: introduce Router= setting to specify router address
2021-11-03 12:41:34 +09:00
Yu Watanabe 32d97330df test-network: add a testcase for Router= setting 2021-11-03 03:15:05 +09:00
Yu Watanabe 0874be35c3 test-network: add test case for MTUBytes= for veth 2021-11-02 12:35:07 +09:00
Yu Watanabe 1ac845ffbe test-network: add more tests for [Address] section 2021-10-28 02:12:34 +09:00