Commit Graph
982 Commits
Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 3d0ef4aefe various: mark files with the usual license tags
For .clang-format and pytest.ini, MIT-0 is used because people might want
to copy those.
2026-08-28 06:26:09 +09:00
Yu Watanabe 30c177a937 test-network: add test cases for IPv6ProxyNDP=no
In that case, IPv6 proxy neighbor entries are ignored.

This also checks IPv6ProxyNDP=yes is implied if an IPv6 proxy neighbor
address is specified.
2026-08-17 17:19:09 +09:00
Yu Watanabe a9e74be13c network: adjust sysctl setting in network_adjust_neighbor_proxy()
This also makes IPv4 proxy neighbor entries independent of proxy_arp
sysctl. We can configure IPv4 proxy neighbor entries even if proxy_arp
is disabled.
2026-08-17 17:17:18 +09:00
Yu Watanabe 78ca255140 network: do not touch proxy_ndp sysctl when nothing requested
Even though the document says "When unset, the kernel's default will
be used." for IPv6ProxyNDP=, previously, when both IPv6ProxyNDP= and
IPv6ProxyNDPAddress= are unspecified, proxy_ndp sysctl was disabled.
This was also inconsistent to other sysctl settings.
2026-08-17 17:15:22 +09:00
Yu Watanabe 80922ebbc5 network: unify IPv4ProxyARPAddress= and IPv6ProxyNDPAddress=
It is not necessary to provide dedicated settings for IPv4 and IPv6
proxy neighbor entries. Let's unify them.

The IPv4ProxyARPAddress= setting was introduced after v261. Hence, we
can freely rename it.
2026-08-17 16:58:03 +09:00
Nandakumar Raghavan 13aec9fddf networkctl,networkd: add --no-reconfigure flag to networkctl reload
Add a new --no-reconfigure flag to 'networkctl reload' that reloads
.network and .netdev files from disk without reconfiguring any network
interfaces. This may be useful to avoid reconfiguring multiple interfaces
simultaneously when multiple .network files are updated, or when an updated
.network file is applied to multiple interfaces.

On the networkd side, manager_reload() gains a reconfigure_links parameter
that gates the per-link reconfiguration loop. A new io.systemd.Network.Reload
varlink method is added that exposes this as an optional reconfigureLinks
boolean (defaults to true). Both plain 'networkctl reload' and
'--no-reconfigure' now unconditionally call this method first. If an older
networkd returns MethodNotFound, plain reload falls back to
io.systemd.service.Reload for backward compatibility; '--no-reconfigure'
fails with a clear error in that case.
2026-07-20 14:35:04 +09:00
Aritra Basu 08bebda611 network: add IPv4ProxyARPAddress= and consolidate proxy ARP/NDP handling
This adds an IPv4 counterpart to `IPv6ProxyNDPAddress=` for adding
manual entries to the kernel's IPv4 neighbour proxy table (check via
`ip -4 neighbour show proxy dev <dev>`). systemd-networkd only exposed
`IPv4ProxyARP=` for per-interface `proxy_arp` sysctl (automatic proxy
ARP) with no way to manage manual entries from a .network file.

To avoid duplicating the IPv6 proxy NDP code path, both families are
now combined into a single new `networkd-neighbor-proxy` module. The
IPv6 behaviour is preserved: `IPv6ProxyNDPAddress=` still implies
`IPv6ProxyNDP=yes` unless `IPv6ProxyNDP=` is explicitly disabled and
entries are still dropped if the kernel has no IPv6 support.
The same rule is applied to `IPv4ProxyARPAddress=`. It implies
`IPv4ProxyARP=yes` when the sysctl is not explicitly set and has no
effect if `IPv4ProxyARP=` has been set to false.

This keeps the user model symmetric and predictable across both
families: a single per-address setting that turns on the matching
per-interface sysctl automatically, while still letting system
administrators opt out by setting the boolean explicitly to false.

Note that the IPv4 manual NTF_PROXY entries installed here would
actually function without `proxy_arp` (unlike IPv6, where `proxy_ndp`
gates the manual entries); the implication is kept for symmetry with
`IPv6ProxyNDPAddress=` and is now called out explicitly in the man
page, together with the fact that enabling `proxy_arp` also activates
interface-wide automatic proxy ARP for routed-toward addresses on
connected subnets.

Parser-time validation rejects addresses the kernel would refuse:
the ANY/null address for both families, IPv4 and IPv6 multicast
and the IPv4 limited broadcast 255.255.255.255.

Signed-off-by: Aritra Basu <aritrbas+gh@cisco.com>
2026-07-16 01:23:40 +09:00
Luca Boccassi 9e4248fbbf test: also check if networkd built with BTF support before BPF test
SUSE does not provide a vmlinux.h so the package is not built with
CO-RE support, hence the test fails. This was previously masked
by the fact that python3-packaging was never installed, so the
test always skipped everywhere as it could not detect the kernel
version.

Follow-up for c310106c15
2026-05-25 18:13:51 +01:00
Daan De Meyer e64337ee10 sd-dhcp-relay: reimplement DHCP relay agent and drop legacy DHCP relay mode from sd-dhcp-server (#42130) 2026-05-21 16:23:44 +02:00
Luca Boccassi d46dae085f network: several fixlets for NDisc (#42218)
Unfortunately, previously the path to test-ndisc-send has been wrong, so
some test cases have not been checked in our mkosi CIs. And two test
cases have been broken.

The test case `test_ndisc_redirect` was not updated when the logic in
networkd was changed by 9142bd5a8e. The
change itself should be OK. So, the test case is updated.

The test case `test_ndisc_mtu` was broken when the commit
32417c1723 is merged. The commit is not
correct, as we cannot set IPv6 MTU larger than interface MTU. So, the
offending commit is reverted.
2026-05-21 12:05:34 +01:00
Yu Watanabe cb2bba6b04 network: drop use of legacy DHCP relay agent in sd-dhcp-server
Then, this deprecates
- BindToInterface=
- RelayTarget=
- RelayAgentCircuitId=
- RelayAgentRemoteId=
settings in [DHCPServer] section.
These are gracefully translated as new settings.
2026-05-21 16:55:59 +09:00
Yu Watanabe 08b3ebf5f1 test-network: add test case for DHCP relay 2026-05-21 16:55:59 +09:00
Yu Watanabe dece52443c test-network: fix path to test-ndisc-send
Follow-up for 9dcdf16b25.

Previously, test cases that use test-ndisc-send executable did not
tested in our mkosi CIs...
2026-05-21 07:53:18 +09:00
Yu Watanabe d9b7fdf06a test-network: fix test case for Neighbor Announcement message handling
After 9142bd5a8e, when NA without router
flag is received, the corresponding redirect route and the default route
is removed, but the other routes are kept.

The corresponding test case was not updated by the commit, and the test
case has been unfortunately skipped...

This fixes the test case, and added more checks.
2026-05-21 07:53:12 +09:00
Yu Watanabe 0080566c92 test-network: add test cases for 'networkctl dhcp-lease' command
Addresses the request:
https://github.com/systemd/systemd/pull/42137#pullrequestreview-4305664376
2026-05-21 07:51:16 +09:00
Yu Watanabe 18f2e9bcfa test-network: try to stop test-modem-manager-mock.service only when necessary
Otherwise, all test cases that does not create/start the service emits
the following error:
```
Failed to stop test-modem-manager-mock.service: Unit test-modem-manager-mock.service not loaded.
```

Moreover, without this change, extra 'systemctl daemon-reload' is triggered after
all test cases. That's super heavy, especially when the test is running on
sanitizers.

Follow-up for abe3d570f8.
2026-05-21 07:10:50 +09:00
Yu Watanabe 52421acf17 test-network: use networkctl_status() helper function at one more place 2026-05-21 07:06:32 +09:00
Jörg Behrmann b54d167934 test-network: make masq a proper function 2026-05-18 09:43:36 +09:00
Jörg Behrmann 9ea0b5f688 test-network: factor out common functions 2026-05-18 09:42:34 +09:00
Jörg Behrmann 475fb5e44f test-network: factor out common enum 2026-05-18 09:41:23 +09:00
Jörg Behrmann 7cf552e481 test-network: remove unused variable 2026-05-18 09:41:22 +09:00
Yu Watanabe 1b94d7d7ec test-network: apply "ruff format" and "ruff check --fix" 2026-05-18 02:44:46 +09:00
Yu Watanabe 59199ec3bd test-network: drop old ip command support 2026-05-18 02:44:46 +09:00
Yu Watanabe 9c0c203db4 test-network: assume the test is running with newer udevd 2026-05-18 02:44:46 +09:00
Yu Watanabe cbc2990335 test-network: drop old kernel support and workaround for fixed kernel bug
- l3mdev in fib rules is supported since
https://github.com/torvalds/linux/commit/96c63fa7393d0a346acfe5a91e0c7d4c7782641b (v4.8).
- uid range in fib rules is supported since
https://github.com/torvalds/linux/commit/622ec2c9d52405973c9f1ca5116eb1c393adfc7d (v4.10).
- port range and ip proto in fib rules is supported since
https://github.com/torvalds/linux/commit/bfff4862653bb96001ab57c1edd6d03f48e5f035 (v4.17).
- interface alternative name is supported since
https://github.com/torvalds/linux/commit/36fbf1e52bd3ff8a5cb604955eedfc9350c2e6cc (v5.5).
- SRIOV on netdevsim is supported since
https://github.com/torvalds/linux/commit/79579220566cd33fe3b15ce8249c57e10251b258 (4.16).
- nexthop is supported since
https://github.com/torvalds/linux/commit/65ee00a9409f751188a8cdc0988167858eb4a536 (v5.3).
- bridge MDB entries on bridge master is supported since
https://github.com/torvalds/linux/commit/1bc844ee0faa1b92e3ede00bdd948021c78d7088 (v5.4).
2026-05-18 02:44:46 +09:00
Luca Boccassi 446b0393ff test-network: retry networkctl status in wait_operstate()
networkctl status may transiently fail right after start_networkd() because networkd has not yet picked up the freshly-created link from the kernel. The retry loop in wait_operstate() did not catch the resulting subprocess.CalledProcessError, so the test aborted on the first attempt instead of retrying for the configured timeout.

Observed in TEST-85-NETWORK-NetworkdBridgeTests, subtest test_bridge_configure_without_carrier[no-slave]:

  [   19.600156] systemd-networkd-tests.py[526]: Failed to issue io.systemd.Network.Link.Describe() varlink call: Invalid argument
  [   53.124982] systemd[1]: systemd-networkd.service: Changed start -> running
  [   53.336167] systemd-networkd-tests.py[526]: ERROR: test_bridge_configure_without_carrier (__main__.NetworkdBridgeTests.test_bridge_configure_without_carrier) (test='no-slave')
  [   53.336167] systemd-networkd-tests.py[526]:     self.wait_operstate('bridge99', operstate=r'(no-carrier|routable)', setup_state=None, setup_timeout=30)
  [   53.336167] systemd-networkd-tests.py[526]: subprocess.CalledProcessError: Command '['/usr/bin/networkctl', '-n', '0', 'status', 'bridge99']' returned non-zero exit status 1.

Co-developed-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 05:08:35 +09:00
Diego Viola 5d17215c7e treewide: fix typos in the entire codebase
Signed-off-by: Diego Viola <diego.viola@gmail.com>
2026-05-05 17:22:26 +02:00
Daan De Meyer b5f219d834 networkd: Add IPv4SrcValidMark= support (#41364)
Closes https://github.com/systemd/systemd/issues/40643
2026-04-22 15:48:50 +02:00
Jonathan Davies c87ab483e7 test-network: verify DHCP server PoolSize and PoolOffset DBus properties
Add integration test coverage for the PoolSize and PoolOffset properties
exposed on the org.freedesktop.network1.DHCPServer DBus interface.
2026-04-15 14:20:40 +00:00
ssahani 2f69c8e712 networkd: Add docs and tests for IPv4SrcValidMark=
Document the new setting in systemd.network(5) man page
and add coverage in the networkd integration tests.

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-30 06:25:00 +05:30
Luca Boccassi abe3d570f8 test: add a mock ModemManager for basic coverage of sd-networkd's integration
Just the minimal setup and test case required to cover
https://github.com/systemd/systemd/issues/41389 for now, can be
expanded in the future

Boring boilerplate is bot-made, don't @ me

Co-developed-by: Claude Opus 4.6 noreply@anthropic.com
2026-03-28 15:19:21 +00:00
Zbigniew Jędrzejewski-Szmek 9e8658b887 various: fix typos 2026-03-25 02:03:56 +01:00
Zbigniew Jędrzejewski-SzmekandCopilot Autofix powered by AI e799263ff4 test-network: handle the case where dnsmasq is slow to start better
> read_dnsmasq_log_file() will raise FileNotFoundError if dnsmasq hasn’t created the
> log file yet (or if the file was just removed by stop_dnsmasq() before the restart).
> This would error the test instead of retrying.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-03-13 12:02:07 +01:00
Yu Watanabe 8e764acf1e test-network: also check if DHCPRELEASE is sent on stopping networkd 2026-03-13 04:53:24 +09:00
Yu Watanabe bd061abd87 test-network: improve reliability of test case of DHCPRELEASE message 2026-03-13 04:53:20 +09:00
Yu Watanabe 67957b1464 test-network: drop duplicated definition of networkd_pid() 2026-03-13 04:44:12 +09:00
Yu Watanabe 5188882fbf test-network: add test case for sending DHCPv4 RELEASE message 2026-03-11 08:45:28 +09:00
Yu Watanabe f47d180b85 test-network: add test case for issue #40106 2026-03-09 12:31:41 +09:00
Yaping Li 23c639be6d metrics: add networkd related metrics 2026-02-18 17:58:33 +09:00
Yu Watanabe 6109cf8b61 meson,test: sort unit files 2026-02-18 17:57:17 +09:00
Yu Watanabe cb9d854207 network: Support interface-bound ECMP routes in MultiPathRoute= (#39742)
MultiPathRoute= can now specify device-only nexthops without a gateway
address, e.g. MultiPathRoute=@wg0. This enables ECMP configurations over
interfaces that don't use gateway addresses, such as WireGuard tunnels.

The syntax is extended from "address[@device] [weight]" to
"[address]@device [weight]". The address is now optional, but at least
one of gateway or device must be specified. The @ symbol must still be
present for device-only routes, making the syntax unambiguous: @wg0
specifies a device, while a bare IP address specifies a gateway.

Device-only nexthops are only available for IPv4 routes. Device-only
multipath routes for IPv6 are not supported by the kernel's netlink
interface and will be rejected with a warning.

This change is fully backwards compatible. All existing configurations
continue to work unchanged, as they always included a gateway address.

Closes #39699.
2026-01-02 09:25:43 +09:00
Yu Watanabe 72711b76e0 TEST-85-NETWORK: enable NetworkdSysctlTest
Note, each test case must be prefixed with 'test_'.

This also adds one more log check for issue #40051.

Follow-up for c78bcda461.
2025-12-11 14:37:04 +09:00
Luca Boccassi afcc0ca509 test-network: drop unused variable
Follow-up for e2fbcee030
2025-12-09 03:30:57 +09:00
Yu Watanabe 80cfe9abf2 test: several fixlets/workarounds for supporting postmarketOS (#39905) 2025-12-07 10:16:58 +09:00
Luca Boccassi e2fbcee030 test-network: fix invalid captive portal URL with dnsmasq 2.92 (#40011)
dnsmasq 2.92 started converting binary content to ascii so the previous
invalid URL is no longer invalid as it's escaped.

So the test started failing: https://bugs.debian.org/1122015

Use a '|' character instead, which is not a valid URL character but it's
also not escaped by dnsmasq.

Follow-up for 1219391c9f
2025-12-07 09:43:47 +09:00
Yu Watanabe 8374085f22 test-network: IPv4-mapped-IPv6 addresses may be shown as pure IPv6 address
It seems ip command built with musl always shows IPv6 addresses in the same way.
2025-12-07 09:09:03 +09:00
Yu Watanabe 193626bd8b test-network: also stop nftables.service
It is a firewall service used in postmarketOS.
When it is active, then e.g. DHCP packets are filtered, and many
tests will be failed.
2025-12-07 09:09:03 +09:00
Chris Down 23d02f6327 test: Add comprehensive tests for MultiPathRoute device-only syntax
Add unit tests for config_parse_multipath_route() covering the new
device-only nexthop syntax (@device). Tests verify basic parsing of
device-only routes, gateway with device routes, gateway-only routes,
interface index handling, etc. Also some checks on new hash/duplicate
semantics.

Also add an integration test to verify device-only multipath routes are
correctly installed in the kernel routing table.
2025-11-28 19:09:15 +08:00
Quentin Deslandes 5b0e262f45 network: clear existing routes if Gateway= is empty in [Network]
Add support for an empty Gateway= in [Network] to clear the existing
routes. This change will allow users to remove the default route from a
drop-in file.
2025-11-20 07:16:26 +09:00
Yu Watanabe d7cf08b735 test-network: drop two overly verbose outputs
Follow-up for 7f9c0c31d2.
2025-11-16 22:15:44 +09:00