summaryrefslogtreecommitdiffstats
path: root/src/network/networkd-dhcp4.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* network: rename KeepConfiguration=dhcp -> dynamicYu Watanabe2024-11-141-6/+6
| | | | | KeepConfiguration=dhcp keeps not only DHCP configurations but also SLAAC or IPV4LL. Let's rename the value to 'dynamic'.
* network: make 'networkctl reconfigure' work safely even when ↵Yu Watanabe2024-11-111-5/+12
| | | | | | | | | | | | 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/dhcp-pd: do not remove unreachable route when reconfiguring ↵Yu Watanabe2024-11-111-1/+1
| | | | | | | | | | | | 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: keep dynamic configurations as possible as we can on reconfigureYu Watanabe2024-11-051-31/+51
| | | | | | | | | | E.g. when a .network file is updated, but DHCP setting is unchanged, it is not necessary to drop acquired DHCP lease. So, let's not stop DHCP client and friends in link_reconfigure_impl(), but stop them later when we know they are not necessary anymore. Still DHCP clients and friends are stopped and leases are dropped when the explicit reconfiguration is requested
* network/ipv4ll: not necessary to set initial address on each startYu Watanabe2024-11-021-13/+1
|
* network/dhcp4: do not restart IPv4LL client when KeepConfiguration=dhcpYu Watanabe2024-11-021-5/+5
| | | | | When KeepConfiguration=dhcp, we do not remove acquired address, hence not necessary to restart IPv4LL client.
* network: update tunnel or vxlan interface if the local address is changedYu Watanabe2024-10-311-0/+4
| | | | | | | If a tunnel or vxlan is configured with Local=dhcp4 or so, then the local address needs to be changed when it is changed. Fixes #24854.
* Merge pull request #30952 from rpigott/resolved-dnrLennart Poettering2024-10-221-0/+7
|\ | | | | RFC9463: Discovery of Network-designated Resolvers
| * network: Serialize DNR serversRonan Pigott2024-10-211-1/+1
| | | | | | | | | | | | | | | | | | | | 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.
| * network: Introduce UseDNR DHCPv4 optionRonan Pigott2024-10-211-0/+7
| | | | | | | | | | | | This option will control the use of DNR for choosing DNS servers on the link. Defaults to the value of UseDNS so that in most cases they will be toggled together.
* | network/dhcp4: use device_get_property_bool() at link_needs_dhcp_broadcast()Yu Watanabe2024-09-171-12/+19
|/ | | | No functional change, just refactoring.
* tree-wide: drop msg argument for DEFINE_CONFIG_PARSE() macro and friendsYu Watanabe2024-09-011-2/+1
| | | | | This makes the macros use log_syntax_parse_error(), hopefully which provides more informative log message in general, and reduces binary size.
* network/route: also update source, status, and so on EEXISTYu Watanabe2024-09-011-1/+2
| | | | | Otherwise, an existing route may be labeled as foreign even after we reconfigure it.
* network/ndisc: fix spurious log messagesYu Watanabe2024-06-251-8/+6
| | | | | | | | | | | - Fix swapped arguments: Before: veth99: Prefix 'in deny list' is 2002:da8:1::/64, ignoring After: veth99: Prefix '2002:da8:1::/64' is in deny list, ignoring. - Drop unnecessary DEBUG_LOGGING.
* network/dhcp4: do not set gateway if DNS server or friends is in the ↵Yu Watanabe2024-05-101-26/+26
| | | | | | | | | | | | | | | | acquired prefix Previously, even if a DNS server is in the acquired prefix, the route to the server might have gateway address. This makes the prefix route, which is always configured, is also handled as same as static routes, and do not use any gateway if the prefix route is the most suitable route to access the destination. The same change is also applied to route to NTP servers and semi-static routes. Fixes a regression introduced by 0ce86f5eeb0921b44a9782260a8c88aafb15ffde. Fixes #32715.
* network: introduce link_get_use_ntp()Yu Watanabe2024-04-191-2/+3
| | | | No functional change, just refactoring.
* network: introduce link_get_use_dns()Yu Watanabe2024-04-191-1/+1
| | | | No functional change, just refactoring.
* network: introduce link_get_use_domains()Yu Watanabe2024-04-191-1/+1
| | | | No functional change, just refactoring.
* network: rename DHCPUseDomains -> UseDomainsYu Watanabe2024-04-191-1/+1
| | | | As it is also used for NDisc.
* networkd: support setting dhcp server portMartin Ivicic2024-02-211-0/+5
|
* network/dhcp4: disable IPv6OnlyMode= by defaultYu Watanabe2024-02-081-1/+3
| | | | | | | As explained in #30891, IPv6OnlyMode= should be enabled with 464XLAT support, but we do not support it yet. Let's disable by default. Fixes #30891.
* network/route: introduce ref/unref functions for Route objectYu Watanabe2024-01-251-6/+6
| | | | | | | Then, Route object can live if it is detached from the owner (Manager, Network, or Wireguard object). This is the one for routes of ebd96906477aac2bbc6b9de0d6e9bd0f39db5581.
* network/route: introduce route_remove_and_cancel()Yu Watanabe2024-01-251-2/+1
| | | | | | | | | | | | Then, replace route_remove_and_drop() with it. If a route is requested, and the request is already called, we may not received its reply and notification from the kernel, and the corresponding Route object may not be remembered. Even in such case, we need to remove the route, otherwise the route will come later after the function called. This is the version for route of f22b586a215962416bdbd692aabb89b1ac2999d0.
* network/route: manage all routes by Manager objectYu Watanabe2024-01-241-3/+7
| | | | | | | | | | | | | | | | | | Previously, a Route object is owned by a Link object corresponding to the outgoing interface of the route, and a Route object that does not have outgoing interface is owned by the Manager object. However, there were several issues: - if a route has a nexthop ID, then the corresponding nexthop may be changed to use another interface, hence the outgoing interface of the route may be changed. - if a route requested with MultiPathRoute=, then the link who requests the route is different from the outgoing interface of the configured route. So, we need to find routes on other interfaces on reconfiguring or so. By this change, the limit of the number of routes per-interface is tentatively dropped. Let's re-introduce the limit later in a nicer way.
* network/route: drop unnecessary ownership transferYu Watanabe2024-01-191-11/+9
| | | | Let's free Route objects on the caller side.
* network/route: convert route before requestingYu Watanabe2024-01-191-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, 1. use the passed Route object as is when a route is requested, 2. when the route becomes ready to configure, convert the Route object if necessary, to resolve outgoing interface name, and split multipath routes, and save them to the associated interfaces, 3. configure the route with the passed Route object. However, there are several inconsistencies with what kernel does: - The kernel does not merge nor split IPv4 multipath routes. However, we unconditionally split multipath routes to manage. - The kernel does not set gateway or so to a route if it has nexthop ID. Fortunately, I do not find any issues caused by the inconsistencies. But for safety, let's manage routes in a consistent way with the kernel. This makes, 1. when a route is requested, split IPv6 multipath routes, but keep IPv4 multipath routes as is, and queue (possibly multiple) requests for the route. 2. when the route becomes ready to configure, resolve nexthop and interface name, and requeue request if necessary. 3. configure the (possibly split) route. By using the logic, - Now we manage routes in a mostly consistent way with the kernel. - We can drop ConvertedRoutes object. - Hopefully the code becomes much simpler.
* network: adjust nexthops of dynamic routes before requestingYu Watanabe2024-01-191-0/+4
| | | | No effective functionality is changed. Preparation for later commits.
* network/route-nexthop: introduce route_nexthops_copy()Yu Watanabe2024-01-191-1/+1
| | | | | | | This also introduce an extra argument for route_dup(), but it is currently unused, will be used later. No functional change, just preparation for later commits.
* network/route: also use RouteNextHop for managing gatewayYu Watanabe2024-01-151-12/+12
| | | | No functional change, just refactoring.
* network/dhcp4: use route_configure_handler_internal() at one more placeYu Watanabe2024-01-121-6/+3
|
* Merge pull request #30717 from yuwata/network-ref-unrefLuca Boccassi2024-01-101-1/+1
|\ | | | | network: introduce address_ref() and friends
| * network/address: introduce ref/unref functions for Address objectYu Watanabe2024-01-031-1/+1
| | | | | | | | | | Then, Address object can live if it is detached from the owner (Link or Network object).
* | network/route-metric: manage uint32_t RTAX_XYZ attributes in the same wayYu Watanabe2024-01-071-8/+12
| | | | | | | | | | | | | | | | Except for RTAX_CC_ALGO, all RTAX_XYZ attributes take uint32_t and the kernel's default value is zero. So, let's unify handling of the attributes. This should not change any effective behavior. Just refactoring.
* | network/route-metric: introduce RouteMetricYu Watanabe2024-01-071-8/+8
|/ | | | | | | | Then, split out route metric handling from networkd-route.c to networkd-route-metric.c. No functional change, just refactoring and preparation for later commits.
* network/address: introduce address_remove_and_cancel()Yu Watanabe2024-01-021-1/+1
| | | | | | | | | | Then, replace address_remove_and_drop() with it. If an address is requested, and the request is already called, we may not received its reply and notification from the kernel, and the corresponding address object may not be remmbered. Even in such case, we need to remove the address, otherwise the address will come later after the function called.
* network: use RET_GATHER() macroYu Watanabe2023-12-251-21/+8
|
* network/ipv4ll: do not start sd-ipv4ll on exitYu Watanabe2023-12-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | When assert_return() is critical, the following assertion is triggered on exit: --- #0 0x00007f8b1f6b0884 in __pthread_kill_implementation () from target:/lib64/libc.so.6 #1 0x00007f8b1f65fafe in raise () from target:/lib64/libc.so.6 #2 0x00007f8b1f64887f in abort () from target:/lib64/libc.so.6 #3 0x00007f8b208d02d6 in log_assert_failed (text=0x7f8b210009e0 "e->state != SD_EVENT_FINISHED", file=0x7f8b20fff403 "src/libsystemd/sd-event/sd-event.c", line=1252, func=0x7f8b21004400 <__func__.154> "sd_event_add_io") at ../src/basic/log.c:948 #4 0x00007f8b208d0457 in log_assert_failed_return (text=0x7f8b210009e0 "e->state != SD_EVENT_FINISHED", file=0x7f8b20fff403 "src/libsystemd/sd-event/sd-event.c", line=1252, func=0x7f8b21004400 <__func__.154> "sd_event_add_io") at ../src/basic/log.c:967 #5 0x00007f8b20c7d102 in sd_event_add_io (e=0x617000000080, ret=0x60c000000a20, fd=11, events=1, callback=0x7dfd85 <ipv4acd_on_packet>, userdata=0x60c000000a00) at ../src/libsystemd/sd-event/sd-event.c:1252 #6 0x00000000007e3934 in sd_ipv4acd_start (acd=0x60c000000a00, reset_conflicts=true) at ../src/libsystemd-network/sd-ipv4acd.c:597 #7 0x00000000007e72b9 in ipv4ll_start_internal (ll=0x6080000006a0, reset_generation=true) at ../src/libsystemd-network/sd-ipv4ll.c:278 #8 0x00000000007e7462 in sd_ipv4ll_start (ll=0x6080000006a0) at ../src/libsystemd-network/sd-ipv4ll.c:298 #9 0x00000000006047a1 in dhcp4_handler (client=0x617000000400, event=0, userdata=0x61a000000680) at ../src/network/networkd-dhcp4.c:1183 #10 0x000000000075b1ed in client_notify (client=0x617000000400, event=0) at ../src/libsystemd-network/sd-dhcp-client.c:783 #11 0x000000000075bf8d in client_stop (client=0x617000000400, error=0) at ../src/libsystemd-network/sd-dhcp-client.c:821 #12 0x000000000077710f in sd_dhcp_client_stop (client=0x617000000400) at ../src/libsystemd-network/sd-dhcp-client.c:2388 #13 0x000000000065cdd1 in link_stop_engines (link=0x61a000000680, may_keep_dhcp=true) at ../src/network/networkd-link.c:336 #14 0x000000000041f214 in manager_free (m=0x618000000080) at ../src/network/networkd-manager.c:613 #15 0x00000000004124e3 in manager_freep (p=0x7f8b1c800040) at ../src/network/networkd-manager.h:128 #16 0x00000000004139f6 in run (argc=1, argv=0x7ffffe4522e8) at ../src/network/networkd.c:24 #17 0x0000000000413b20 in main (argc=1, argv=0x7ffffe4522e8) at ../src/network/networkd.c:119 --- Prompted by https://github.com/systemd/systemd/pull/30049#issuecomment-1844087965.
* network/dhcp: disable RapidCommit= by default when AllowList=/DenyList= is ↵Yu Watanabe2023-11-211-0/+7
| | | | | | | | | | | | | | | | specified AllowList= and DenyList= filter only DHCPOFFER messages. So, if RapidCommit= is enabled, then networkd unconditionally accepts a rapid ACK message even if its sender is filtered out by the lists. As AllowList=/DenyList= implemented earlier than RapidCommit=, so enabling RapidCommit= unconditionally by default may break existing setups that use AllowList=/DenyList=. Let's disable RapidCommit= by default when AllowList=/DenyList= is enabled. Still the setting can be enabled by setting explicitly even AllowList=/DenyList= is also specified.
* network: implement RFC4039 DHCP Rapid CommitRonan Pigott2023-10-271-0/+4
| | | | | | This implements the DHCPv4 equivalent of the DHCPv6 Rapid Commit option, enabling a lease to be selected in an accelerated 2-message exchange instead of the typical 4-message exchange.
* network,dhcp: restart client with 'networkctl renew' when delayed by IPv6 ↵Yu Watanabe2023-10-201-0/+19
| | | | | | | | | only mode This is convenient when the server supports IPv6 only mode. Otherwise, we cannot request a new address during the client is waiting an IPv6 connectivity. Note, the minimal timespan is 5min, and a server may send a quite large value.
* network/dhcp4: support IPv6 only mode (RFC 8925)Yu Watanabe2023-10-111-2/+49
| | | | Co-authored-by: Susant Sahani <ssahani@gmail.com>
* network: introduce [DHCPv4] RequestAddress= settingYu Watanabe2023-10-041-6/+24
| | | | | | This may be useful when requesting a specific address. Closes #29437.
* network: skip to set request address when anonymizedYu Watanabe2023-10-041-4/+4
| | | | | | | In sd-dhcp-client.c, we do not set the option in the DHCPDISCOVER message when anonymized, and the specified address is ignored anyway. So, this does not change the behavior, but suppress misleading debugging log in dhcp4_set_request_address().
* network: drop duplicated address_set_broadcast()Yu Watanabe2023-09-071-1/+0
| | | | It will be called later in link_request_address().
* sd-dhcp-client: introduce sd_dhcp_lease_has_6rd() helper functionYu Watanabe2023-09-051-4/+4
| | | | No functional change, just refactoring.
* dhcp: introduce sd_dhcp_lease_get_timestamp()Yu Watanabe2023-09-051-7/+2
| | | | | | | | And drop sd_dhcp_client_get_lease_timestamp(). Also, this introduce sd_dhcp_lease_get_lifetime_timestamp() and friends, which provides timestamp of the lifetime and so on, while sd_dhcp_lease_get_lifetime() provides timestamp.
* sd-dhcp-client: store lifetime and friends in usec_tYu Watanabe2023-09-051-7/+6
|
* Adding dhcp client and dhcp6 client dbus status interfacepelaufer2023-09-021-0/+5
|
* network: introduce per DUID type settersYu Watanabe2023-08-241-11/+33
| | | | No functional change, just refactoring.
* network: use address_remove_and_drop()Yu Watanabe2023-07-291-3/+1
|