Commit Graph
487 Commits
Author SHA1 Message Date
Yu Watanabe a6653a56c9 test-network: do not try to set too small quanta for ets
Since kernel v7.3 the kernel clamp quanta:
https://github.com/torvalds/linux/commit/1c38487f46b243bfeefec0c0c86023a3904f2214

So, too small values are now calmped to 256.
Let's change the values used in the test so that they are not clamped.
2026-09-21 13:31:06 +02:00
RamsesandYu Watanabe 3da5c65d87 network: register already enslaved interfaces when their master appears (#43557)
When networkd starts or restarts, links are enumerated in ifindex
order. A slave enumerated before its master cannot register itself in
link_append_to_master(), as the master Link object does not exist yet.
The master then wrongly believes it has no slaves until the next
RTM_NEWLINK message for the slave arrives.

The stale slaves set affects operational state propagation
(degraded-carrier detection) and any code that inspects the slaves of
a master.
For instance, on restart, when networkd thinks that the master has no
slaves yet, we try to set the bond fail-over policy, which the kernel
then refuses because in reality the bond does have slaves.

To fix the issue, this updates the list of slaves after enumeration.

Co-authored-by: Yu Watanabe <watanabe.yu+github@gmail.com>
2026-09-01 18:28:43 +09:00
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 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 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
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
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
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
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
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
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
Lennart Poettering a7fa29b1b5 networkd: add support for resolved hook for DHCP server
Let's synthesize DNS RRs for leases handed out by our DHCP server. This
way local VMs can have resolvable hostnames locally.

This does not implement reverse look ups for now. We can add this
later in similar fashion.
2025-11-15 07:52:42 +01:00
Chris Down 7f9c0c31d2 sd-dhcp-server: Add Hostname= option to static leases
This adds a new `Hostname=` option to the [DHCPServerStaticLease]
section in .network files, allowing an administrator to assign a
specific hostname to a client receiving a static lease.

We automatically select the correct DHCP option to use based on the
format of the provided string:

- Single DNS labels are sent as Option 12.
- Names with multiple DNS labels are sent as Option 81 in wire format.

Fixes: #39634
2025-11-14 07:50:13 +09:00
Lennart Poettering f2a365b982 network/dhcp-server: improvements for saving/loading leases (#37835) 2025-06-17 14:31:22 +02:00
Yu Watanabe 312e3835ee test-network: add tests for tunnel mode 2025-06-16 17:01:37 +09:00
Yu Watanabe ce5a54ed9b test-network: add test case for issue #37714
I cannot reproduce the issue with the current git HEAD.
Let's add a test case that is used by the reporter of the issue.
2025-06-15 09:33:23 +09:00
Yu Watanabe 009d64dddd test-network: add test case for PersistLeases=runtime 2025-06-14 03:42:24 +09:00
Avram DorfmanandYu Watanabe fb9076b994 test-network: add test case for bootp
Co-authored-by: Yu Watanabe <watanabe.yu+github@gmail.com>
2025-06-13 14:15:04 +09:00
Yu Watanabe 78f8d5ed71 network: also check ID_NET_MANAGED_BY property on reconfigure
Previously, the property was checked only when an uevent is received,
so even if an interface has ID_NET_MANAGED_BY property, the interface
will be configured by networkd when reconfiguration is triggered e.g.
when interface state is changed.

Follow-up for ba87a61d05.
Fixes #36997.
2025-06-12 14:24:50 +09:00
Yu Watanabe c6aae2cd8a test-network: add test case for issue #32186
The reporter said that the issue is caused by BindCarrier=, but
I cannot reproduce it. Anyway, let's test it.
2025-06-11 17:32:46 +09:00
Matteo Croce bcb9e72b6b networkd: ensure that unmanaged interfaces aren't touched
Extend the test_keep_configuration_on_restart in order to check
that the unmanaged interface isn't altered in any way.
2025-05-22 03:04:40 +09:00
Beniamino Galvani ec65c29e51 network: fix handling of routing policy rule fwmask
The firewall mask should be applied even if the mark is 0, to allow defining a
value of e.g. 0/255.

Fixes #36973
2025-04-17 09:18:54 +09:00
Beniamino Galvani f7996e2a33 network: add support for HSR netdev
Add support for creating HSR/PRP interfaces. HSR (High-availability Seamless
Redundancy) and PRP (Parallel Redundancy Protocol) are two protocols that
provide seamless failover against failure of any single network component. They
are both implemented by the "hsr" kernel driver.
2025-04-05 05:23:53 +09:00
Erik Larsson c88adbc01d networkd: add support for setting vlan_tunnel on bridge ports 2025-03-24 17:15:19 +09:00
Erik Larsson 6e529860ba networkd: add support for externally managed vxlan devices
With this a vxlan interface can be created which is managed by
for example a EVPN control plane.
2025-03-20 20:29:47 +09:00
Matteo CroceandYu Watanabe 912a48572d test-network: check that network configuration is stable with KeepConfiguration=yes
Check that when networkd restarts, and the network configures
KeepConfiguration=yes, the network configuration is never changed.

Ensure this by dumping the `ip monitor` output when networkd is restarting.

Co-authored-by: Yu Watanabe <watanabe.yu+github@gmail.com>
2025-03-15 10:26:20 +09:00
Yu Watanabe 5506aff98d test-network: replace symlink to 99-default.link with a copy
Then, we can drop ugly workaround in meson.build.
The .link file is not necessarily synced with 99-default.link.
Also, 99-default.link is not updated so frequently.
Let's manually sync it when necessary.
2025-03-10 02:41:40 +09:00
Yu Watanabe 011a83e42b network: fix KeepConfiguration=yes (#36414)
Fixes a regression in dd6d53a8dc (v257).
Fixes #36411.
2025-02-19 02:09:09 +09:00
Steve Ramage a4750ae156 network: doc and code typo fixes (#36422)
This fixes some typos in the documentation, both grammar as well as
incorrect field names.
It also changes the casing of CheckSum to Checksum in L2TP to match
other casings.
2025-02-19 02:08:16 +09:00
Yu Watanabe 1cac0676da test-network: add test case for KeepConfiguration=yes with RTPROT_BOOT
For issue #36411.
2025-02-18 23:01:53 +09:00
Luca Boccassi 382e8a03ca network: allow to configure routing policy rule even if requesting interface is not activated yet (#36257)
Fixes a regression caused by 4f8b153d90
(v257).
Fixes #36244.
2025-02-07 22:56:36 +00:00
Luca Boccassi 2ee81b556f network/route: improve Gateway=_dhcp4 handling (#36183)
- Also configures route to the gateway and prefix route in the specified
table, if necessary.
- Also set preferred source address of the route.

Closes #36168.
2025-02-05 12:19:01 +00:00
Yu Watanabe a10172b035 test-network: add test case for issue #35874 2025-02-05 09:40:31 +09:00
Yu Watanabe f7ae28fcec test-network: add test case for requesting routing policy rules by multiple interfaces
For issue #36244.
2025-02-04 12:28:59 +09:00
Jonas Gorski 08a26ecc47 network: bridge: add support for IFLA_BRPORT_MAB
Since linux commit a35ec8e38cdd1766f29924ca391a01de20163931 ("bridge:
Add MAC Authentication Bypass (MAB) support"), included since v6.2, it
is possible to enable MAC Authentication Bypass for bridge ports. In
this mode the locked port learns again, but the learned fdb entries are
locked, allowing user space to unlock hosts based seen MAC addresses.

This requires learning to be enabled on the port, and link-local
learning disabled for the bridge.

Add support to systemd-network for setting the new attribute for bridge
ports.
2025-01-28 12:22:26 +01:00
Jonas Gorski a434de6056 network: bridge: add support for IFLA_BRPORT_LOCKED
Since linux commit a21d9a670d81103db7f788de1a4a4a6e4b891a0b ("net:
bridge: Add support for bridge port in locked mode"), included since
v5.18,  it is possible to set bridge ports to locked.

Locked ports do not learn automatically, and discard any traffic from
unknown source MACs. To allow traffic, the userspace authenticator is
expected to create fdb entries for authenticated hosts.

Add support to systemd-network for setting the new attribute for bridge
ports.
2025-01-28 10:38:01 +01:00
Jonas Gorski d7de242ce7 network: bridge: add support for NO_LL_LEARN
When using locked ports on a bridge link-local learning needs to be
disabled to prevent the kernel from learning and automatically unlocking
hosts based on link-local traffic.

So add support for enabling NO_LL_LEARN for bridges.
2025-01-28 10:38:01 +01:00
Yu Watanabe 2ea15435fd test-network: add test case for Gateway=_dhcp4 with Table= 2025-01-27 08:39:09 +09:00
Yu Watanabe 5e5fe05896 test-network: add test cases for global [DHCPv4] ClientIdentifier= setting 2024-12-30 11:19:02 +09:00
Yu Watanabe af44a16ec7 test-network: add test case for MPLSRouting=yes 2024-12-13 15:36:45 +00:00
Yu Watanabe 16ccdc3748 test-network: split out check_router_preference() from test_router_preference()
This also drop high2.network and low2.network, and edit high.network and
low.network during the test.
2024-11-19 04:44:59 +09:00
Yu Watanabe bbef21e4e5 test-network: update KeepConfiguration=dhcp -> dynamic 2024-11-14 10:24:27 +09:00
Yu Watanabe 7f1b36a82a test-network: add test case for issue #35047 2024-11-11 13:59:41 +00:00
Michele Dionisio d865abf9eb networkd: add possibility to specify MulticastIGMPVersion 2024-11-06 15:50:27 +00:00
Yu Watanabe 80f38c1f65 test-network: add test case for tunnel Local=dhcp4
For issue #24854.
2024-10-31 18:41:44 +09:00