summaryrefslogtreecommitdiffstats
path: root/src/libsystemd-network (follow)
Commit message (Collapse)AuthorAgeFilesLines
* network: Restrict the valid charset of DNR namesRonan Pigott2024-10-293-0/+16
| | | | | | | | | Not all possible DNS names will survive serialization. Restrict the set of valid dns names to LDH encoded names. Fixes: 25c33e350042 (network: parse RFC9463 DHCPv4 DNR option, 2024-01-16) Fixes: a07e83cc58f6 (network: Parse RFC9463 DHCPv6 DNR option, 2024-01-17) Fixes: 0c90d1d2f243 (ndisc: Parse RFC9463 encrypted DNS (DNR) option, 2024-01-19)
* network: add missing else in dhcp_lease_loadRonan Pigott2024-10-291-1/+2
| | | | Fixes: 3fd6708cde0f (network: Serialize DNR servers)
* tree-wide: replace for loop with FOREACH_ELEMENT or FOREACH_ARRAY macros ↵Integral2024-10-261-4/+3
| | | | (#34893)
* Merge pull request #34848 from ↵Lennart Poettering2024-10-223-42/+11
|\ | | | | | | | | yuwata/network-dhcpv6-do-not-request-ia-pd-on-info-req network/dhcp6: do not request IA_PD on information requesting mode
| * network/dhcp6: do not request IA_PD when running in the other-information modeYu Watanabe2024-10-213-42/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts the following commits: - 180cc5421d9712fb95a6bbc725dc8ba459360c8b "sd-dhcp6-client: allow to request IA_PD on information requesting mode" - cf7a403e470368049165ecff7ac7686928778d7c "sd-dhcp6-lease: adjust information refresh time with lifetime of IA_PD" - 1918eda30d12e1ba3ee55921c18ec53267463e24 "network/dhcp6: process hostname and IA_PD on information requesting mode" As per discussion in #34299, https://github.com/systemd/systemd/issues/34299#issuecomment-2425153221 the offending commits violate RFC 8415 section 18.2.6: > The client uses an Information-request message to obtain > configuration information without having addresses and/or delegated > prefixes assigned to it.
* | Merge pull request #30952 from rpigott/resolved-dnrLennart Poettering2024-10-2216-80/+1210
|\ \ | |/ |/| RFC9463: Discovery of Network-designated Resolvers
| * resolve: move sd-* api into libsystemd-networkRonan Pigott2024-10-214-0/+492
| | | | | | | | | | This duplicates the svc param constants for the benefit of the resolved-core library.
| * ndisc: implement ndisc_option_build_encrypted_dnsRonan Pigott2024-10-211-0/+140
| | | | | | | | This is only used by the fuzzer so far.
| * network: add dnr resolvers to networkctl status json outputRonan Pigott2024-10-211-1/+1
| |
| * ndisc: Parse RFC9463 encrypted DNS (DNR) optionRonan Pigott2024-10-213-0/+194
| | | | | | | | This option is equivalent to the V4/V6 DNR options for DHCP.
| * network: Introduce UseDNR DHCPv6 optionRonan Pigott2024-10-211-0/+1
| | | | | | | | This is equivalent to the DHCPv4 option introduced earlier.
| * network: Parse RFC9463 DHCPv6 DNR optionRonan Pigott2024-10-212-0/+106
| | | | | | | | | | Implement the parsing for V6_DNR DHCPv6 option. This does the same as the DHCP V4_DNR option.
| * dhcp6: use dns_name_from_wire_formatRonan Pigott2024-10-212-76/+5
| | | | | | | | | | Convert some of the option parsing to use dns_name_from_wire_format, introduced earlier. No change in behavior intended.
| * test-dhcp6: terminate fqdn optionRonan Pigott2024-10-211-4/+4
| | | | | | | | | | | | The encoded fqdn in this option must be properly terminated. We will soon validate that this field is correctly encoded, so correct it in the test.
| * network: Serialize DNR serversRonan Pigott2024-10-211-0/+17
| | | | | | | | | | | | | | | | | | | | 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: Add serialization for DoT resolversRonan Pigott2024-10-212-0/+97
| | | | | | | | | | For now only DoT is supported, so DoT resolvers are represented using the existing configuration format.
| * network: parse RFC9463 DHCPv4 DNR optionRonan Pigott2024-09-143-0/+154
| | | | | | | | | | | | | | | | This option is another way for DHCP servers to indicate preferred DNS servers for the network, but includes more detailed info like the server name, transport (DoT/DoH/DoQ etc.), and port. Allow our DHCPv4 client to parse this option.
* | sd-dhcp6-lease: adjust information refresh time with lifetime of IA_PDYu Watanabe2024-10-151-6/+29
| | | | | | | | For the case when IRT is too large but lifetime of IA_PD is too short.
* | sd-dhcp6-client: allow to request IA_PD on information requesting modeYu Watanabe2024-10-153-5/+13
| | | | | | | | To support RFC 7084, WPD-4.
* | sd-dhcp6-lease: use free_and_replace_full()Yu Watanabe2024-10-151-4/+2
| |
* | sd-radv: drop sd_radv_prefix and friends, and use sd_ndisc_option to manage ↵Yu Watanabe2024-10-143-784/+229
| | | | | | | | | | | | NDisc options No effective functional change, just refactoring.
* | network/dhcp4: add support for ARPHRD_RAWIP and ARPHRD_NONE network ↵Darsey Litzenberger2024-10-101-0/+29
| | | | | | | | | | | | | | interface types This should fix QMI wwan modems, as noted in https://github.com/systemd/systemd/issues/27219
* | tree-wide: replace reallocarray() with GREEDY_REALLOC()Yu Watanabe2024-10-081-20/+12
| |
* | tree-wide: drop doubled empty linesYu Watanabe2024-10-072-2/+0
| |
* | tree-wide: use strv_extend_strv_consume() where appropriateMike Yuan2024-09-211-1/+1
| |
* | sd-ipv4acd: fix assertion triggered when an ARP received in STARTED stateYu Watanabe2024-09-201-0/+1
|/ | | | | | | When a network is busy, an ARP may be received before the timer event source triggered first time. Fixes #34489.
* basic: split ifname related calls from format-util.h into format-ifname.hLennart Poettering2024-09-131-1/+1
| | | | | | | | This way we don't have to pull in net/if.h into format-util.h. This is supposed to address https://github.com/systemd/systemd/pull/32212#discussion_r1755639881 No actual code changes, just a .c/.h file split-up.
* missing_network: drop unnecessary definitionYu Watanabe2024-09-091-0/+1
| | | | Now we have ipv6.h, hence the definition is not necessary anymore.
* test-dhcp-server: Migrate to new assertion macrosDaan De Meyer2024-08-281-83/+86
|
* sd-dhcp-client: actually restart daemon after sending DECLINE messageYu Watanabe2024-08-211-8/+6
| | | | | client_stop() sets DHCP_STATE_STOPPED to client->state, thus the server never restarted.
* sd-dhcp-client: stop client without calling notification after sending RELEASEYu Watanabe2024-08-211-1/+5
| | | | | | Otherwise, even the acquired lease is released, the client may be in e.g. BOUND state or so, and may send renew or rebind after timeout later.
* sd-dhcp-client: refuse to send RELEASE or friends gracefully when the daemon ↵Yu Watanabe2024-08-211-16/+8
| | | | | | | | is stopped or so We can easily hit the assertions without checking the internal states of the DHCP client before calling these functions. That's annoying. Let's do more gracefully.
* sd-dhcp-client: do not call callback with SD_DHCP_CLIENT_EVENT_STOP if ↵Yu Watanabe2024-08-211-8/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | already stopped When an interface enters the failed state, even if the DHCP client is stopped, the acquired DHCP lease is not unreferenced, as the callback dhcp4_handler() do nothing in that case. When the failed interface is being reconfigured after that, the DHCP client is stopped again (though it is already stopped), and SD_DHCP_CLIENT_EVENT_STOP event is triggered and sd_dhcp_client_send_release() is called, and the assertion in the function is triggered. E.g. === systemd-networkd[98588]: wlp59s0: DHCPv4 address 192.168.86.250/24, gateway 192.168.86.1 acquired from 192.168.86.1 systemd-networkd[98588]: wlp59s0: Could not set DHCPv4 route: Nexthop has invalid gateway. Network is unreachable systemd-networkd[98588]: wlp59s0: Failed systemd-networkd[98588]: wlp59s0: State changed: configuring -> failed systemd-networkd[98588]: wlp59s0: The interface entered the failed state frequently, refusing to reconfigure it automatically. systemd-networkd[98588]: wlp59s0: DHCPv4 client: STOPPED systemd-networkd[98588]: wlp59s0: DHCPv4 client: State changed: bound -> stopped systemd-networkd[98588]: Got message type=method_call sender=:1.449 destination=org.freedesktop.network1 path=/org/freedesktop/network1 interface=org.freedesktop.network1.Manager member=ReconfigureLink ... systemd-networkd[98588]: wlp59s0: State changed: failed -> initialized systemd-networkd[98588]: wlp59s0: found matching network '/etc/systemd/network/50-wifi.network'. systemd-networkd[98588]: wlp59s0: Configuring with /etc/systemd/network/50-wifi.network. systemd-networkd[98588]: wlp59s0: DHCPv4 client: STOPPED systemd-networkd[98588]: Assertion 'sd_dhcp_client_is_running(client)' failed at src/libsystemd-network/sd-dhcp-client.c:2197, function sd_dhcp_client_send_release(). Aborting. ===
* Merge pull request #34014 from yuwata/network-ip-masqueradeLuca Boccassi2024-08-201-0/+1
|\ | | | | network: make IPMasquerade= imply global IP forwarding settings again
| * sd-lldp-tx: insert missing empty lineYu Watanabe2024-08-161-0/+1
| |
* | test-dhcp-server: Gracefully handle the network being downDaan De Meyer2024-08-191-1/+5
|/
* sd-dhcp-server: persist hardware addresses in leasesMary Strodl2024-07-231-1/+27
|
* tree-wide: port over to new builder apisLennart Poettering2024-06-192-23/+25
|
* various: move const ptr indicator to return valueZbigniew Jędrzejewski-Szmek2024-06-193-5/+5
|
* string-util: introduce string_is_safe_ascii helperMike Yuan2024-06-161-1/+1
|
* libsystemd: turn json.[ch] into a public APILennart Poettering2024-06-129-67/+70
| | | | | | | | | | | | | | | This is preparation for making our Varlink API a public API. Since our Varlink API is built on top of our JSON API we need to make that public first (it's a nice API, but JSON APIs there are already enough, this is purely about the Varlink angle). I made most of the json.h APIs public, and just placed them in sd-json.h. Sometimes I wasn't so sure however, since the underlying data structures would have to be made public too. If in doubt I didn#t risk it, and moved the relevant API to src/libsystemd/sd-json/json-util.h instead (without any sd_* symbol prefixes). This is mostly a giant search/replace patch.
* sd-dhcp-server: clear buffer before receiveYu Watanabe2024-06-121-1/+1
| | | | | | | | | I do not think this is necessary, but all other places in libsystemd-network we clear buffer before receive. Without this, Coverity warns about use-of-uninitialized-values. Let's silence Coverity. Closes CID#1469721.
* sd-ndisc: do not print "(null)" in the log messageYu Watanabe2024-05-222-5/+6
| | | | | | | | | If we received RA with no flags set, or with an invalid preference, previously "(null)" was printed. Follow-up for 238ed432c347ddf7dde7825feb2672b089583103. Fixes https://github.com/systemd/systemd/pull/32308#discussion_r1600940289.
* test: extend timeout for DHCP/NDisc testsYu Watanabe2024-05-203-3/+3
| | | | Fixes https://github.com/systemd/systemd/pull/32932#issuecomment-2120424121.
* Merge pull request #32818 from keszybz/libsystemd-network-size-checkLuca Boccassi2024-05-159-23/+24
|\ | | | | Check packet size in libsystemd-network
| * test: rename file with stub functionsZbigniew Jędrzejewski-Szmek2024-05-146-7/+7
| | | | | | | | | | | | icmp6-util-linux.c sounds like a specialized implementation of the functions in icmp6-util.c. But it's just a set of stub versions used in tests. Rename the file to make this more obvious.
| * libsystemd-network: use normal style for error checkingZbigniew Jędrzejewski-Szmek2024-05-141-13/+7
| | | | | | | | | | We generally use a flat list. The switch stmt was generating excessive indentation.
| * libsystemd-network: check size of icmpv6 packetsZbigniew Jędrzejewski-Szmek2024-05-142-0/+9
| | | | | | | | | | | | | | | | | | Coverity was complaining that we use the received packet size as a loop bound without checking. This is indeed a bit iffy, because depending on how the host is configured, the packet could be rather large. Let's refuse anything more than the standard size early to prevent suspicious activity. Resolves coverity CID#1534892, CID#1543949.
| * libsystemd-network: remove double initializationZbigniew Jędrzejewski-Szmek2024-05-141-3/+1
| |
* | libsystemd-network: skip dhcp server test in case of EAFNOSUPPORTRadoslav Kolev2024-05-141-1/+3
|/ | | | | We want to eanble running tests as part of the build, but our builds run in VMs with networking disabled.