summaryrefslogtreecommitdiffstats
path: root/src/network (follow)
Commit message (Collapse)AuthorAgeFilesLines
* network: several cleanups (#35267)Luca Boccassi2024-12-129-174/+191
|\
| * network: add missing template to networkd.confYu Watanabe2024-12-111-0/+6
| |
| * network/nexthop: replace unreachable condition with assertionYu Watanabe2024-12-111-2/+1
| |
| * network/nexthop: fix argument nameYu Watanabe2024-12-111-1/+1
| | | | | | | | Fixes copy-and-paste error in b5b42b516e791aae8b723866be94a7c3e6e99829.
| * network: introduce address_forget() and friends and use it where applicableYu Watanabe2024-12-115-158/+158
| | | | | | | | No functional change, just refactoring.
| * network/nexthop: ignore foreign nexthops when ManageForeignNextHops=noYu Watanabe2024-12-111-0/+5
| |
| * network/nexthop: drop outdated comment and add one debugging logYu Watanabe2024-12-111-3/+5
| | | | | | | | | | All NextHop objects are managed by Manager since 352eba2e49453a1b784ffbdb9509ba3f8a945b59.
| * network/ndisc: unref Route objects that depend on the nexthopYu Watanabe2024-12-111-2/+7
| | | | | | | | | | | | | | | | No functional change, as when this function is called, the set will be freed and contained Route objects will be unref()ed anyway soon later by nexthop_detach() -> nexthop_free(). Even though, when the routes are forgotten from the Manager, then it is not necessary to keep them by the nexthop. Let's unref earlier.
| * network/ndisc: constify several arguments and add several assertionsYu Watanabe2024-12-111-4/+6
| | | | | | | | | | | | Follow-up for 0f8afaf94dd29126981219b3ea2b3bc315cc2dd0. No functional change, just for safety.
| * network/nexthop: do not share NextHop.nexthops and NextHop.routes with ↵Yu Watanabe2024-12-111-0/+2
| | | | | | | | | | | | | | | | duplicated object Otherwise, these may be freed twice. But, fortunately, when this function is called, both are NULL. So, this should not change any behavior. But for safety.
| * network: drop outdated commentYu Watanabe2024-12-111-4/+0
| | | | | | | | | | All Route objects are managed by Manager since 8d01e44c1f0e00b414d36bd1b46ecff548242208.
* | network: optionally bring up interface before joining bridgeYu Watanabe2024-12-111-0/+20
| | | | | | | | Closes #34247.
* | network: introduce link_up_now()Yu Watanabe2024-12-112-7/+23
|/ | | | This is currently not used. Preparation for later commit.
* various: set info on varlink server objectZbigniew Jędrzejewski-Szmek2024-12-101-3/+2
| | | | | | The values that were previously hardcoded in sd-varlink.c are now defined in new varlink_set_info_systemd() and that function is called everywhere where we create a server.
* network/queue: do not increase reference counter when remove request is not ↵Yu Watanabe2024-11-272-3/+3
| | | | | | | queued Fixes a bug introduced by ef45f5c8d0bfbeda2a57b28bba9831f044b23b21. Fixes #35164.
* network: update state files before replying bus methodYu Watanabe2024-11-201-0/+8
| | | | Follow-up for 2b07a3211ba8b1b81d6cebb9650d5cb24554b08a.
* network/ndisc: first process options with zero lifetimeYu Watanabe2024-11-181-20/+50
| | | | | | | | | | | | | | | | | | Fixes IPv6 Core Conformance test failures reported at #33468. https://www.ipv6ready.org/docs/Core_Conformance.pdf Test v6LC.2.2.23 h and j: Processing Router Advertisement with Route Information Option (Host Only) When a RA contains route option with ::/0 prefix, then previously that may contradict with the default route requested with the RA header. If the route option has zero lifetime, the existing default route should be removed, and a new route based on the RA header should be configured. If the route option has non-zero lifetime, the RA header should be ignored. So, we first need to process options with zero lifetime (not only route option, as the similar reasons), then configure the default route based on the RA, finally process options with non-zero lifetime.
* network/ndisc: sd_ndisc_router_route_get_preference() does not return ↵Yu Watanabe2024-11-181-4/+0
| | | | -EOPNOTSUPP anymore
* network/netdev: fix typoYu Watanabe2024-11-181-1/+1
| | | | Follow-up for 09db4106064dd600c64d12a4e06bd88143b2e4f7.
* network/nexthop: fix copy-and-paste errorYu Watanabe2024-11-151-1/+1
| | | | Follow-up for 688f166972916b5cfc9287055582ac1aeef3d486.
* network/ndisc: fix coalescing of ndisc routes when multiple router exists ↵Yu Watanabe2024-11-146-52/+497
|\ | | | | | | | | (#35119) Fixes #33470.
| * network/ndisc: dynamically configure nexthops when routes with gateway are ↵Yu Watanabe2024-11-141-3/+292
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | requested Previously, when multiple routers send RAs with the same preference, then the kernel merges routes with the same gateway address: === default proto ra metric 1024 expires 595sec pref medium nexthop via fe80::200:10ff:fe10:1060 dev enp0s9 weight 1 nexthop via fe80::200:10ff:fe10:1061 dev enp0s9 weight 1 === This causes IPv6 Conformance Test v6LC.2.2.11 failure, as reported in #33470. To avoid the coalescing issue, we can use nexthop, as suggested by Ido Schimmel: https://lore.kernel.org/netdev/ZytjEINNRmtpadr_@shredder/ > BTW, you can avoid the coalescing problem by using the nexthop API. > # ip nexthop add id 1 via fe80::200:10ff:fe10:1060 dev enp0s9 > # ip -6 route add default nhid 1 expires 600 proto ra > # ip nexthop add id 2 via fe80::200:10ff:fe10:1061 dev enp0s9 > # ip -6 route append default nhid 2 expires 600 proto ra > # ip -6 route > fe80::/64 dev enp0s9 proto kernel metric 256 pref medium > default nhid 1 via fe80::200:10ff:fe10:1060 dev enp0s9 proto ra metric 1024 expires 563sec pref medium > default nhid 2 via fe80::200:10ff:fe10:1061 dev enp0s9 proto ra metric 1024 expires 594sec pref medium Fixes #33470. Suggested-by: Ido Schimmel <idosch@idosch.org>
| * network/nexthop: serialize/deserialize nexthopsYu Watanabe2024-11-143-29/+119
| |
| * network/nexthop: preparation for dynamically configuring nexthopsYu Watanabe2024-11-142-20/+86
| | | | | | | | Preparation for later commits.
* | network/netdev: follow-ups for reloading .netdev files (#34979)Luca Boccassi2024-11-1418-115/+240
|\ \ | |/ |/| Follow-ups for #34909.
| * network/tuntap: manage tun/tap fds by managerYu Watanabe2024-11-142-63/+71
| | | | | | | | | | Otherwise, when a .netdev file for tun or tap netdev is updated, reloading the file leaks the previous file descriptor.
| * network/bond: do not update several parameters if already up or has slavesYu Watanabe2024-11-141-8/+21
| | | | | | | | | | Some bonding parameters cannot be updated when the netdev is already up or already has at least one slave interface.
| * network/netdev: do not try to update if not supportedYu Watanabe2024-11-149-1/+32
| | | | | | | | | | Some netdevs cannot update there properties after created. Let's skip requests in that case.
| * network/netdev: fix counter handling if request is cancelledYu Watanabe2024-11-141-1/+13
| | | | | | | | | | | | | | | | | | | | | | Follow-up for 1003093604661bd984574889167f2ff4dfd6209c. If a netdev is detached for some reasons, then previously the request was simply cancelled, and the underlying interface never enter the configured state, as the 'stacked_netdevs_created' flag never set. This makes the counter decremented manually by the function, and set the flag. So, the underlying interface can eter the configured state.
| * network/netdev: always queue request of creating netdev then process it laterYu Watanabe2024-11-141-14/+2
| | | | | | | | | | | | | | After PR #34909, networkd tries to update an existing netdev interface if possible. But, when .netdev files are loaded on start, we have not enumerate interfaces, so we do not know if the corresponding interface exists or not. Let's delay processing request a bit.
| * network/netdev: enter ready state only when it is created by usYu Watanabe2024-11-141-18/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Follow-up for PR #34909. This fixes an issue that network interfaces cannot join a master netdev, like bond or bridge, when the corresponding .netdev is reloaded. With PR #34909, networkd supports reloading .netdev files. However, When a .netdev file is modified and reloaded, ifindex is copied from the old NetDev object to the new one. Thus, even if the interface is successfully updated, netdev_set_ifindex_impl() will return 0 and netdev_enter_ready() will never called. If the netdev is a kind of master netdev, then port interfaces cannot join the master netdev, as REQUEST_TYPE_SET_LINK_MASTER requires that the master netdev is in the ready state.
| * network/netdev: do not update MAC address if netdev is already runningYu Watanabe2024-11-148-7/+74
| | | | | | | | | | | | | | | | | | | | | | Follow-up for 17c5337f7b2993619d84acc2088b2ba1789e6477. Older kernels (older than v6.5) refuse RTM_NEWLINK messages with IFLA_ADDRESS attribute when the netdev already exists and is running, even if the MAC address is unchanged. So, let's not set IFLA_ADDRESS or IFLA_MTU if they are unchanged, and set the attributes only when we can update them.
| * network/netdev: set interface name only when creating a new netdevYu Watanabe2024-11-141-3/+8
| | | | | | | | Otherwise, the kernel older than v6.2 will refuse the netlink message.
* | network: rename KeepConfiguration=dhcp -> dynamicYu Watanabe2024-11-149-41/+79
| | | | | | | | | | KeepConfiguration=dhcp keeps not only DHCP configurations but also SLAAC or IPV4LL. Let's rename the value to 'dynamic'.
* | network/ipv4ll: use a foreign IPv4LL address when KeepConfiguration=dhcpYu Watanabe2024-11-141-0/+23
| | | | | | | | | | This is similar to what we do for DHCPv4 address, but for IPv4LL address.
* | network: keep all dynamically acquired configurations when ↵Yu Watanabe2024-11-141-18/+18
| | | | | | | | | | | | | | | | | | | | KeepConfiguration=dhcp-on-stop By the previous commit, configuration source of addresses and routes are saved on stop and restored on start. Hence, we can keep dynamic configurations on stop. Co-authored-by: Jian Zhang <zhangjian.3032@bytedance.com>
* | network: introduce manager_serialize()/deserialize()Yu Watanabe2024-11-148-68/+554
|/ | | | | | | | | | Currently, only configuration sources and providers of addresses and routes are serialized/deserialized. This should mostly not change behavior, as dynamic (except for DHCPv4) configurations will be dropped before stopping networkd, and for DHCPv4 protocol, we have already had another logic to handle DHCPv4 configurations. Preparation for later commits.
* network/ndisc: restore the original preference and priority before checking ↵Yu Watanabe2024-11-121-0/+9
| | | | | | | | | | if existing route can be updated Follow-up for 972f1d17ab461a51142a142609dd3ec50bae8440. This fixes the logic of removing unnecessary routes configured by the previously received RAs. Previously, we wrongly handled existing routes could be updated, and unexpected routes would be kept.
* network/ndisc: introduce ndisc_route_prepare() and ndisc_router_route_prepare()Yu Watanabe2024-11-121-16/+46
| | | | | | These applies common parameters to the route to be requested or removed. No functional change, just refactoring and preparation for later commits.
* network/ndisc: several cleanups for ndisc_remove_route()Yu Watanabe2024-11-121-10/+4
| | | | | | - drop unnecessary call of ndisc_set_route_priority() at the beginning, as it is called later in the loop below, - use RET_GATHER() and remove all possible routes even if failed.
* network/ndisc: introduce route_is_bound_to_link() helper function and use it ↵Yu Watanabe2024-11-123-4/+17
| | | | | | where applicable No functional change, and preparation for later commits.
* network/nexthop: also forget IPv4 nexthops when an interface went downYu Watanabe2024-11-113-0/+57
| | | | Similar to the previous commit, but for nexthop.
* network/route: forget IPv4 non-local routes when an interface went downYu Watanabe2024-11-113-0/+35
| | | | | | | When an interface went down, IPv4 non-local routes are removed by the kernel without any notifications. Let's forget the routes in that case. Fixes #35047.
* network/nexthop: forget dependent routes without trying to removeYu Watanabe2024-11-113-12/+16
| | | | | | When a nexthop is removed, routes depend on the removed nexthop are already removed. It is not necessary to remove them, as already commented. Let's forget them without trying to remove.
* network/nexthop: do not remove depending nexthops when a nexthop is removedYu Watanabe2024-11-111-13/+3
| | | | | Previously, when a nexthop is removed, depending nexthops were removed, but that's not necessary, as the kernel keeps them, at least with v6.11.
* network/route: update reference of the route from nexthopYu Watanabe2024-11-111-0/+2
| | | | | | Follow-up for 6f09031e4d04727cc72164fefcbc763e37556493. The function has been introduced by the commit, but it has never been used...
* network: make 'networkctl reconfigure' work safely even when ↵Yu Watanabe2024-11-117-57/+99
| | | | | | | | | | | | KeepConfiguration=dhcp or yes Previously, even if KeepConfiguration=dhcp or yes is specified in the new .network file, dynamic configurations like DHCP address and routes were dropped when 'networkctl reconfigure INTERFACE' is invoked. If the setting is specified, let's gracefully handle the dynamic configurations. Then, 'networkctl reconfigure' can be also used for an interface that has critical connections.
* network: drop static configs laterYu Watanabe2024-11-111-7/+0
| | | | | | | | | Follow-up for dd6d53a8dc58c5e6e310b09ba7f7a22600a87ba9. Unnecessary static configs will be anyway dropped later in link_configure() -> link_drop_unmanaged_config(). Hence, even if we are reconfiguring an interface cleanly, it is not necessary to drop static configs here.
* network/dhcp-pd: do not remove unreachable route when reconfiguring ↵Yu Watanabe2024-11-114-23/+62
| | | | | | | | | | | | non-upstream interface Unreachable routes are not owned by any interfaces, and its ifindex is zero. Previously, if a non-upstream interface is reconfigured, all routes including unreachable routes configured by the upstream interface are removed. This makes unreachable routes are always handled by the upstream interface, and only removed when the delegated prefixes are changed or lost.
* network: reorder dropping dynamic configurationYu Watanabe2024-11-111-2/+2
| | | | Follow-up for 451c2baf30f50b95d73e648058c7c2348dbf0c31.