Commit Graph
61 Commits
Author SHA1 Message Date
Yu Watanabe ad350e6ecf network: drop serialization of DHCP lease
No one use it now anymore. Let's drop it.
2026-05-17 01:31:42 +09:00
Zbigniew Jędrzejewski-Szmek b8514cff52 libsystemd-network: use DEFINE_POINTER_ARRAY_FREE_FUNC, rename cleanup function 2026-04-10 15:08:02 +02:00
Yu Watanabe 2900f04c82 network: do not create state file for removed interface
Fixes #40817.
2026-02-26 08:50:50 +01:00
Oleksandr AndrushchenkoandYu Watanabe f8a4c3d375 network: add ModemManager support
[Match]
Name=wwan*

[Network]
LLDP=no
LinkLocalAddressing=no
IPv6AcceptRA=no

[ModemManager]
SimpleConnectPropertie]s=apn=internet ip-type=ipv4 allow-roaming=no pin=1111 operator-id=25503
RouteMetric=200
UseGateway=yes

Co-authored-by: Yu Watanabe <watanabe.yu+github@gmail.com>
2026-02-16 13:22:21 +09:00
Yu Watanabe 93378148d4 tree-wide: normalize comment style 2025-12-15 08:50:13 +09:00
Yu Watanabe 5bd37b352c network/state-file: coding style fixlet
Follow-up for 168ad243cc.
2025-07-23 22:24:19 +09:00
Yu Watanabe 5489a9c409 network/state-file: ignore any errors in sd_dhcp6_lease_get_dnr()
Follow-up for 168ad243cc.

For consistency with other places.
2025-07-23 22:24:19 +09:00
haxibami 238c427aa9 network/dhcp6: add SIP server support 2025-07-22 17:05:13 +09:00
Yu Watanabe 2c154c54e1 network: use dns_name_hash_ops_free to manage domains 2025-06-14 00:17:14 +09:00
Daan De Meyer baa3fadfb7 network: Clean up includes
Split out of #37344.
2025-05-22 02:15:43 +09:00
Daan De Meyer 1cf40697e3 tree-wide: Sort includes
This was done by running a locally built clang-format with
https://github.com/llvm/llvm-project/pull/137617 and
https://github.com/llvm/llvm-project/pull/137840 applied on all .c
and .h files.
2025-04-30 09:30:51 +02:00
Yu Watanabe 4cf443e644 network/link: use hash_ops with destructor for managing Link objects 2025-04-13 10:15:02 +09:00
Ronan Pigott 57feaaece3 network: handle ENODATA better with DNR
It is normal for DHCP leases not to have DNR options. We need to be less
verbose and more forgiving in these cases. Also, if either DHCP does not
have DNR options, make sure to still consider any DHCPv6/RA options.

Fixes: c7c9e3c7c0 (network: adjust log message about DNR)
2024-11-06 05:01:55 +09:00
Yu Watanabe ef45f5c8d0 network: refuse further requests when manager is in MANAGER_STOPPED
In that case, requests will never be processed anyway. But further more,
we cannot call link_ref() at that stage. Otherwise, we trigger assertion.
2024-11-03 09:14:36 +09:00
Ronan Pigott c7c9e3c7c0 network: adjust log message about DNR
The only possible error return in this position is -ENODATA, which is
not interesting.
2024-10-23 10:24:39 +02:00
Ronan Pigott 65187c46ef network: Serialize ipv6ra DNR
Serialize DNR servers acquired by ipv6ra option, same as the V4/V6 DNR
DHCP options.
2024-10-21 09:10:20 -07:00
Ronan Pigott 168ad243cc network: Serialize DHCPv6 DNR servers
This serializes DNR servers acquired by V6_DNR option, equivalent to the
V4_DNR option.
2024-10-21 09:10:19 -07:00
Ronan Pigott 3fd6708cde network: Serialize DNR servers
Implement serialization/deserialization for DNR servers. This re-uses
the string format in place for user configuration of DoT servers, and as
a consequence non-DoT servers are discarded when recording the link
configuration, for correctness.

This also enables sd-resolved to use these servers as it would other DNS
servers.
2024-10-21 09:10:19 -07:00
Ronan Pigott b0e716310d network: Add serialization for DoT resolvers
For now only DoT is supported, so DoT resolvers are represented using
the existing configuration format.
2024-10-21 09:10:19 -07:00
Yu Watanabe f49c8e6553 network/state-file: save assigned .netdev file even if the interface is unmanaged
Follow-up for 2cf9b1a0ee.
2024-09-10 19:30:17 +09:00
Mike Yuan 2cf9b1a0ee network: store netdev drop-in paths and dump into state file 2024-09-09 23:20:41 +02:00
Mike Yuan 4c8dc66438 networkd-state-file: use ASSERT_PTR where appropriate 2024-09-09 21:45:42 +02:00
Yu Watanabe d12fb2bc7b network: introduce link_get_use_ntp()
No functional change, just refactoring.
2024-04-19 10:23:00 +09:00
Yu Watanabe 9646ffe2ca network: introduce link_get_use_dns()
No functional change, just refactoring.
2024-04-19 10:23:00 +09:00
Yu Watanabe 7a169cb40f network: introduce link_get_use_domains()
No functional change, just refactoring.
2024-04-19 10:23:00 +09:00
Yu Watanabe 78f5c649e2 network: rename DHCPUseDomains -> UseDomains
As it is also used for NDisc.
2024-04-19 10:23:00 +09:00
Yu Watanabe e188243d1f network: fix use of wrong flag
Fixes a bug introduced by 86a66e9b95 (v255).
2024-04-16 14:17:43 +09:00
Ronan Pigott 64761f38cc network: save the real rdnss address
... instead of the router that informed us

Fixes: 86a66e9b95 ("network: also save NTP servers and friends obtained by other protocols")
2024-03-29 09:30:42 +09:00
Yu Watanabe 5a0f6adbb2 network/lldp: do not save LLDP neighbors under /run/systemd
Now LLDP neighbors are exposed through varlink. Hence, it is not
necessary to save to a file.
2024-03-01 09:40:26 +09:00
Yu Watanabe 52672db3f8 network/ndisc: rename Network.ipv6_accept_ra -> Network.ndisc
These settings are leated to sd-ndisc and Neighbor Discovery protocol.
Let's use more suitable name.
2024-02-26 11:38:57 +01:00
Yu Watanabe a853cc99e6 network: adjust default RequiredForOnline= and RequiredFamilyForOnline= setting
E.g. a bonding port does not support addressing, hence the default
should be 'enslaved'.

Follow-up for 3255bda698.

Closes #27724.
2024-02-02 15:38:30 +09:00
Mike Yuan 215286a405 fileio: fputs_with_space → _with_separator and modernization 2024-01-26 00:37:59 +08:00
Yu Watanabe 2278d9f66e network: several cleanups for LinkOperationalState
- introduce link_required_operstate_for_online() helper function,
- use recently introduced macros and helper functions,
- unconditionally serialize the minimum and maximum of required
  operational state.
2024-01-17 04:05:43 +09:00
Yu Watanabe 2e1113b7d0 network: split out manager_clean_all() from manager_dirty_handler()
And rename manager_dirty_handler() to manager_post_handler().

No functional change, just refactoring.
2023-12-21 04:27:09 +09:00
Yu Watanabe bd7d902884 network: also synchronously update manager state file 2023-10-24 18:39:47 +09:00
Yu Watanabe a70c27b834 network: make link_save() static 2023-10-24 18:39:47 +09:00
Yu Watanabe 86a66e9b95 network: also save NTP servers and friends obtained by other protocols
Previously, only servers that statically configursd or obtained by
DHCPv4 protocol are saved in the manager state file.

NTP servers obtained by DHCPv6 could not be used by timesyncd.

Fixes #29148.
2023-10-08 13:06:28 +09:00
Lennart Poettering 7b9da3861a Revert "tree-wide: Mount file descriptors via /proc/<pid>/fd" 2023-09-08 22:13:09 +01:00
Daan De Meyer 2af02e6165 tree-wide: Always include <net/if.h> before related linux headers
Otherwise, we get redefinition errors if <net/if.h> is included later
on by another header.
2023-08-14 13:16:46 +02:00
Yu Watanabe 6341ea5467 network: introduce link_get_captive_portal()
Then, downgrade log level of the message about mis-match of captive
portals in different protocols.
2023-07-06 14:55:46 +09:00
Ronan Pigott d74c4ce103 network: Introduce UseCaptivePortal IPv6RA option
Accepts a boolean. When enabled retains captive portal configuration
advertised by the router.
2023-07-02 01:13:43 -07:00
Ronan Pigott a75feb554b network: Introduce UseCaptivePortal DHCPv6 option
Acepts a boolean. When enabled requests and retains captive portal
configuration from the DHCPv6 server.
2023-07-02 01:13:43 -07:00
Ronan Pigott edb88a7201 network: Introduce UseCaptivePortal DHCPv4 option
Accepts a boolean. When enabled, UseCaptivePortal will request and
retain the captive portal configuration from the DHCP server.
2023-07-02 01:13:43 -07: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
Luca Boccassi da60182759 Merge pull request #24933 from keszybz/erradicate-strerror
Erradicate strerror
2022-10-11 21:47:38 +02:00
Zbigniew Jędrzejewski-Szmek 0b6a47957b tree-wide: drop () around the first argument of a ternary op
https://github.com/systemd/systemd/pull/24933#discussion_r991242789
2022-10-11 16:59:00 +02:00
Yu Watanabe 44085d63f0 network: drop unnecessary call of ndisc_vacuum()
After the commit 773024685b, DNS servers
or domains are dropped when their lifefime become zero. Hence, it is not
necessary to try to them when writing state file.

Of course, because of the accuracy of the timer event source or priority
of event sources, a possibility is introduced that a DNS server or domain
with zero lifetime is stored in the state file. However, such entry will
be dropped soon when the timer event source is triggered. Hence, that
should not cause any real issues.
2022-10-07 14:17:28 +09:00
Yu Watanabe 56437e33a6 network: state-file: do not append dynamic entries when specified by DBus method
Fixes #21515.
2021-12-07 06:43:14 +09:00
Yu Watanabe 2756fb24ee network: state-file: honor dhcp6_use_domains flag 2021-12-07 01:58:35 +09:00
Yu Watanabe 4c78dc17e5 network: do not update state files when running in test mode
Fixes #20862.
2021-09-29 20:50:37 +09:00