Commit Graph
5193 Commits
Author SHA1 Message Date
Sebastian Pucilowski e6c4b5dc52 network: DHCP version logging typos
Some DHCP client log messages report "DHCP4" or "DHCP6" instead of
"DHCPv4" or "DHCPv6" as used within the rest of the codebase. Typos
fixed.
2024-04-28 11:47:55 +09:00
Yu Watanabe d11ba681ab network/radv: use sd_ndisc_prefix and friends to manage prefixes and so on
No functional change, just refactoring.
2024-04-25 09:45:02 +09:00
Yu Watanabe 29d9672eb2 network/radv: rename pref64Prefix -> Prefix64
Also this made several coding style cleanups.
2024-04-25 09:44:57 +09:00
Yu Watanabe 30eab38020 network/route: use our definitions of route preference
Including linux/icmpv6.h easily trigger conflicts when another header
includes netinet/icmp6.h. Let's drop the dependency and use our
definition of the same values.
2024-04-25 09:23:31 +09:00
Yu Watanabe 6fe51dc50c network/radv: merge two boolean flags for prefix into one 2024-04-24 12:26:25 +09:00
Yu Watanabe 96dd66eddf sd-radv: send RA on update in caller side
As the caller may want to update multiple prefixes and friends.
Let's not automatically announce on update in library side.

Currently, only prefix is updated during running. Hence, this does not
change any effective behavior.
2024-04-24 12:22:05 +09:00
Yu Watanabe a05381d58b network/radv: drop unnecessary conditions
sd_radv_set_xyz() will handle invalid values gracefully.
2024-04-23 02:06:33 +09:00
Yu Watanabe c6ffb8789c network/radv: warn about non-zero preference with zero lifetime
Note that the misconfiguration will be handled gracefully. So it is not
necessary to adjust value here. Let's only warn about that.
2024-04-23 02:05:41 +09:00
Yu Watanabe efe96c34a0 network/radv: verify [IPv6Prefix] section or friends in network_adjust_radv()
Previously, network_drop_invalid_pref64_prefixes() was never called.
This also fixes that.
2024-04-23 02:04:18 +09:00
Yu Watanabe 59d475ba40 network/radv: introduce ReachableTimeSec= setting
To make the reachable time in the RA header sent by networkd
configurable.
2024-04-22 18:41:37 +09:00
Luca Boccassi 8f0de5c433 Merge pull request #32372 from yuwata/sd-radv-trivial-cleanups
sd-radv: several trivial cleanups
2024-04-20 15:24:02 +02:00
Yu Watanabe 201f76287f network/radv: sd-radv allows to update MAC address without stopping 2024-04-20 14:59:27 +09:00
Yu Watanabe 418f2dc755 network: introduce network- and protocol-independent default for UseDomains=
Follow-up for fb57300743.

Prompted by #32273.
2024-04-20 12:01:53 +09:00
Yu Watanabe f72e851fd3 conf-parser: move config_parse_timezone() to conf-parser.[ch]
Even though it is currently only used by networkd, the parser itself
is quite generic. Let's move it to the shared library.
2024-04-19 10:23:01 +09: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 8763e48342 network: move NTP related conf parsers to networkd-ntp.[ch]
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 54bb2c0e61 network: move DNS related conf parsers to networkd-dns.[ch]
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 769f9744b7 network/ndisc: disable Neighbor discovery client if RADV is enabled
Running both sd-ndisc and sd-radv should be mostly a misconfiguration,
but may not. So, let's only disable sd-ndisc by default when sd-radv is
enabled, but allow when both are explicitly requested.
2024-04-18 09:40:23 +09:00
Yu Watanabe 50ba4e401a sd-radv: refuse packet from the same interface
Prompted by https://github.com/systemd/systemd/pull/32267#discussion_r1566721306.
2024-04-18 09:40:23 +09:00
Yu Watanabe 78d5bad2f5 Merge pull request #32294 from yuwata/network-generator-creds
network-generator: also load drop-ins for networkd.conf from credentials
2024-04-16 16:42:59 +09:00
Yu Watanabe 30d10a08be Merge pull request #32297 from yuwata/networkctl-cat-without-args
networkctl: allow to call 'networkctl cat' without arguments
2024-04-16 16:42:46 +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
Yu Watanabe 78281bd53a networkctl: allow to call 'networkctl cat' without arguments
Then, show networkd.conf and its drop-ins.
2024-04-16 13:31:14 +09:00
Yu Watanabe e12e16e9f7 network-generator: also copy drop-ins for networkd.conf from credential
Follow-up for 1a30285590.
2024-04-16 12:45:08 +09:00
Yu Watanabe 6c15a28454 creds-util: move pick_up_credentials() from network-generator
The function is quite general, and can be used at other places.
Let's move to our shared library.
2024-04-16 09:42:20 +09:00
Yu Watanabe a40e495847 network-generator: rename NETWORKD_UNIT_... -> NETWORK_UNIT_...
As .link files are used by systemd-udevd, rather than systemd-networkd.

Also, this makes it ends with '/', to follow our recent coding style.
2024-04-16 09:42:20 +09:00
Luca Boccassi a4328b284e Merge pull request #32258 from yuwata/network-tc-fix-stack-overflow
network/tc: fix stack overflow
2024-04-15 22:34:39 +02:00
Yu Watanabe ae9fd433d6 Merge pull request #32194 from henryli001/lihl/add-defaultUseDomains-config
network: add mechanism to configure default UseDomains= setting
2024-04-14 13:40:06 +09:00
Henry Li fb57300743 network: add mechanism to configure default UseDomains= setting, update man page and add test 2024-04-13 16:54:31 -07:00
Yu Watanabe 632d321050 network/tc: fix stack overflow when dropping tclass or qdisc
Fixes a bug introduced by be8e933900 (v255).

Fixes #32247.
Fixes #32254.
2024-04-13 08:49:54 +09:00
Yu Watanabe 7f5c82aaf3 tree-wide: insert missing space after comma 2024-04-13 05:44:04 +09:00
Yu Watanabe 4dbcda1cca network/ndisc: fix typo
Follow-up for e42a74803a.
2024-04-13 05:21:42 +09:00
Yu Watanabe b263362254 network/ndisc: drop onlink prefix when valid lifetime is zero
Replaces 155d7a2c04.
2024-04-12 06:12:03 +09:00
Yu Watanabe 9f368d9eb2 network/ndisc: do nothing for existing routes if on-link flag is zero
This effectively reverts commit 155d7a2c04.

From RFC 4861 section 6.3.4:
> Note, however, that a Prefix Information option with the on-link flag
> set to zero conveys no information concerning on-link determination and
> MUST NOT be interpreted to mean that addresses covered by the prefix
> are off-link.

So, we should not drop previously configured routes when receieved a RA
with Prefix Information option without on-link flag.

Closes #28435.
2024-04-12 06:12:03 +09:00
Yu Watanabe 9944629eee network/ndisc: fix verification of sender of Redirect message
The sender must be the first-hop router of the destination. Previously,
we only accepted Redirect messages whose sender is the current default
router with the highest priority.

See RFC 4861 section 8.1 for more details.

Fixes #31981.
2024-04-12 04:59:42 +09:00
Yu Watanabe f76814757d network/ndisc: split out ndisc_redirect_verify_sender()
No functional change, preparation for later commits.
2024-04-12 04:59:42 +09:00
Yu Watanabe d9688518ff network/ndisc: drop ndisc_request_redirect_route()
It is now called by only ndisc_redirect_handler(), and the check in
ndisc_request_redirect_route() is redundant and already done by
ndisc_redirect_verify_sender().

No functional change, just refactoring.
2024-04-12 04:59:42 +09:00
Yu Watanabe ef6495ebb2 network/ndisc: redirect routes do not have lifetime
Hence, ndisc_router_update_redirect() does nothing. Let's remove it.
Also, ndisc_request_route() does not set lifetime for the route, it is
not necessary to set the third argument.
2024-04-12 04:59:42 +09:00
Yu Watanabe 33cab1d4ef network/ndisc: introduce ndisc_request_router_route()
Then, make ndisc_request_route() generic and usable for configuring
routes based on both Router Advertisement and Redirect messages.

Note, ndisc_request_router() never set lifetime, so the dropped comment
in ndisc_request_redirect_route() is wrong.

No functional change, just refactoring.
2024-04-12 04:59:42 +09:00
Yu Watanabe 2e73aa507b network/ndisc: do not set per-route MTU and hop limit
Setting MTU announced in RA message to routes is problematic, as the
value may be larger than the device MTU (IFLA_MTU), and in such case the
route cannot be used.

These two properties are now set per-interface, and gracefully handled
such invalid cases. Hence not necessary to set them to each route.

Follow-up for #32195.
2024-04-12 04:59:38 +09:00
Yu Watanabe e42a74803a network/ndisc: fix updating valid lifetime of configured address
This makes the logic mostly follows RFC 4862 section 5.5.3 (e),
as draft-ietf-6man-slaac-renum-07 is deprecated.

Fixes #31449.
2024-04-11 15:56:01 +09:00
Yu Watanabe 2d4c9c42ac network/ndisc: set provider address in caller
Follow-up for 43d184682d.

No functional change, just refactoring.
2024-04-11 15:56:01 +09:00
Luca Boccassi d0ea800943 Merge pull request #32195 from yuwata/network-ndisc-mtu
network: several cleanups for IPv6 MTU
2024-04-10 23:12:21 +01:00
Luca Boccassi bf5e509840 Merge pull request #32166 from yuwata/network-rfc7217-dad
network: generate another address on conflict
2024-04-10 22:59:01 +01:00
Yu Watanabe 8c9ef90b19 network/ndisc: set IPv6 MTU through sysctl
Closes #31496.
2024-04-10 12:22:43 +09:00
Yu Watanabe fb71748e4f network/sysctl: round IPv6 MTU with the current device MTU rather than the maximum MTU
Otherwise, writing IPv6 MTU may fail.

This also makes link_set_ipv6_mtu() take log level about rounding IPv6 MTU,
and downgrade the log level from LOG_WARNING -> LOG_INFO, as we usually
use LOG_WARNING for per-interface critical failure.
2024-04-10 12:15:33 +09:00
Yu Watanabe eb426caae7 network: always set IPv6 MTU when we detect the device MTU is changed
Then, we can keep the IPv6 MTU even if the device MTU is changed by an
external tool, e.g. 'ip link set' command.
2024-04-10 12:15:33 +09:00