Commit Graph
1706 Commits
Author SHA1 Message Date
Yu Watanabe c4efe0e51e sd-dhcp-client: gracefully ignore OFFER with Rapid Commit option
Fixes #29904.
2023-11-07 16:13:54 +01:00
Yu Watanabe 498a6de596 dhcp6: enterprise ID is 32bit
Follow-up for 6b44099b3b.

Fixes #29800.
2023-11-01 13:19:59 +00:00
Yu Watanabe 78101ca9cc Merge pull request #29247 from naraghavan/naraghavan/dhcpv6-vendor-options
networkd: Add DHCP vendor specific sub options to dbus API
2023-10-31 17:14:20 +09:00
Yu Watanabe d19434fbf8 tree-wide: fix typo 2023-10-31 14:35:33 +09:00
Nandakumar Raghavan 6b44099b3b networkd: Add DHCP vendor specific options to dbus API
Add DHCP vendor specific options to expose in dbus API.
This will be added to the JSON output when we query
org.freedesktop.network1.Manager object.
2023-10-27 12:11:09 +00:00
Ronan Pigott 808b65a087 network: implement RFC4039 DHCP Rapid Commit
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.
2023-10-26 15:26:50 -07:00
Ronan Pigott 5516b0dd20 network: cleanup unreachable condition in dhcp client path
The client state is unconditionally set just above, making this
conditional unreachable.
2023-10-26 15:26:50 -07:00
Lennart Poettering 7113640493 fd-uitl: rename PIPE_EBADF → EBADF_PAIR, and add EBADF_TRIPLET
We use it for more than just pipe() arrays. For example also for
socketpair(). Hence let's give it a generic name.

Also add EBADF_TRIPLET to mirror this for things like
stdin/stdout/stderr arrays, which we use a bunch of times.
2023-10-26 22:30:42 +02:00
Frantisek Sumsal 25f7271c42 network: ENOTSUP → EOPNOTSUPP 2023-10-25 11:26:19 +02:00
Yu Watanabe 0bc30a2038 network,dhcp: restart client with 'networkctl renew' when delayed by IPv6 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.
2023-10-21 01:54:08 +09:00
Yu Watanabe 95bd6816d7 sd-dhcp-client: always use sd_dhcp_client.timeout_ipv6_only_mode for delaying subsequent task
Otherwise, sd_dhcp_client_set_ipv6_connectivity() may not work, as it
checks if the timer event source is enabled or not.
2023-10-21 01:54:08 +09:00
Yu Watanabe 74c102d7e9 sd-dhcp-client: add a short comment about IPv6 only mode 2023-10-21 01:54:08 +09:00
Yu Watanabe dab96fed0c sd-dhcp-client: only send RENEW message when the client is in bound state
Fixes an issue reported at
https://github.com/systemd/systemd/pull/29544#issuecomment-1762742561.
2023-10-21 01:54:08 +09:00
Yu Watanabe a43f922526 sd-dhcp-client: simplify the condition in sd_dhcp_client_get_lease()
The condition was outdated, e.g. SELECTING state does not have a lease.
See client_handle_offer() and client_enter_requesting().

The condition based on the state may become much complex in the future.
Let's use simpler condition.
2023-10-21 01:54:08 +09:00
Yu Watanabe 8664ded716 dhcp: split dhcp-internal.h into two 2023-10-21 01:54:08 +09:00
Yu Watanabe 40e4be7e8e dhcp: move DHCP client specific definitions to dhcp-client-internal.h 2023-10-21 01:54:08 +09:00
Yu Watanabe 9bcbb61458 dhcp: split out dhcp-network.h from dhcp-internal.h 2023-10-21 01:54:07 +09:00
Yu Watanabe 8320db407c dhcp: move DHCPState to dhcp-client-internal.h
All other definitions in dhcp-protocol.h are common for client and
server. Let's move DHCP client specific definitions.
2023-10-21 01:54:07 +09:00
Yu Watanabe f3d84e20c9 fuzz: include library headers first 2023-10-21 01:54:07 +09:00
Lennart Poettering bd1ae17833 io-util: split out "struct iovec" related calls into their own .c/.h files
This is preparation for #28891, which adds a bunch more helpers around
"struct iovec", at which point this really deserves its own .c/.h file.

The idea is that we sooner or later can consider "struct iovec" as an
entirely generic mechanism to reference some binary blob, and is the
go-to type for this purpose whenever we need one.
2023-10-20 10:34:33 +02:00
Frantisek Sumsal 4820c9d417 fuzz: unify logging setup
Make sure we don't log anything when running in "fuzzing" mode. Also,
when at it, unify the setup logic into a helper, pretty similar to
the test_setup_logging() one.

Addresses:
  - https://github.com/systemd/systemd/pull/29558#pullrequestreview-1676060607
  - https://github.com/systemd/systemd/pull/29558#discussion_r1358940663
2023-10-19 10:05:20 +01:00
Yu Watanabe 39ba10f19e sd-dhcp-server: make sd_dhcp_server_is_running() silently work with NULL
We already do in the same way for sd-dhcp-client and friends.
2023-10-12 18:35:59 +09:00
Yu Watanabe a91b888fff sd-dhcp-client: support IPv6 only mode
This makes sd-dhcp-client optionally request IPv6 only preferred
option (RFC 8925).
2023-10-11 21:42:13 +09:00
Susant SahaniandYu Watanabe 14bd102e3c sd-dhcp-server: support IPv6 only mode
This makes sd-dhcp-server send IPv6 only preferred option (RFC 8925).

Co-authored-by: Yu Watanabe <watanabe.yu+github@gmail.com>
2023-10-11 21:42:13 +09:00
Yu Watanabe 042c91459a fuzz: suppress log messages 2023-10-06 13:26:16 +09:00
Yu Watanabe 8b50b3198b libsystemd-network: introduce $SYSTEMD_NETWORK_TEST_MODE environment variable
Then, drop dhcp_client_set_test_mode() and friends.
2023-10-06 13:25:23 +09:00
Alexandre Peixoto Ferreira 13abd00685 sd-dhcp-client: reject NAKs from servers that we did not send an offer to (#29290)
To support multiple DHCP servers in a network.
2023-09-25 11:46:41 +09:00
Luca Boccassi f5f4486c65 Merge pull request #29254 from yuwata/sd-ndisc-use-usec_t
sd-ndisc: make sd_ndisc return time values in usec
2023-09-22 21:46:50 +01:00
Yu Watanabe f9edbb80e9 sd-dhcp-client: split out client_parse_message()
No functional change, just refactoring and preparation for later
commits.
2023-09-23 01:38:21 +09:00
Yu Watanabe db849df5a1 sd-dhcp-client: introduce dhcp_lease_unref_and_replace() 2023-09-23 01:38:21 +09:00
Yu Watanabe 8fc725052a sd-dhcp-client: do not set fallback subnet mask if it is already set 2023-09-23 01:38:21 +09:00
Yu Watanabe 2ff1e23036 sd-dhcp-client: split out client_enter_requesting()
No functional change, just refactoring and preparation for later
commits.
2023-09-23 01:38:21 +09:00
Yu Watanabe 525717b87c sd-dhcp-client: split out client_enter_bound()
No functional change, just refactoring and preparation for later
commits.
2023-09-23 01:38:21 +09:00
Yu Watanabe 6197db53ba sd-ndisc: make sd_ndisc return time values in usec
This also introduces sd_ndisc_router_get_lifetime_timestamp() and
friends that return timestamp rather than timespan.
2023-09-23 01:34:56 +09:00
Zbigniew Jędrzejewski-Szmek a0fe45a93f Merge pull request #29224 from keszybz/netdev-config-parsing
Use a helper to simplify parsing of ranges in netdev config and related changes
2023-09-22 14:29:47 +02:00
Yu Watanabe 3231f624e6 sd-ndisc: rename function arguments for storing results 2023-09-22 02:17:31 +09:00
Luca Boccassi 45ad128d36 Merge pull request #29253 from yuwata/sd-radv-use-usec_t
sd-radv: use usec_t
2023-09-21 14:06:28 +01:00
Luca Boccassi 76859a9785 Merge pull request #29252 from yuwata/sd-dhcp6-client-use-usec_t
sd-dhcp6-client: use usec t
2023-09-21 11:30:02 +01:00
Yu Watanabe 511d96d3b7 sd-dhcp-client: use unaligned_be32_sec_to_usec()
Note, previously, we set 1 second if the time value is zero.
But the adjustment is dropped now, as for the lifetime we have explicit
check that the message has non-zero lifetime, and for T1 and T2 we have
better adjustment in client_set_lease_timeouts().
2023-09-21 09:52:03 +01:00
Yu Watanabe 8ff992d1a2 test-ndisc-ra: add tests for recently added functions 2023-09-21 04:01:24 +09:00
Yu Watanabe eca280c8c0 sd-radv: make sd_radv always take timespan in usec 2023-09-21 04:01:14 +09:00
Yu Watanabe 394fac52d0 sd-dhcp6-client: introduce sd_dhcp6_lease_get_t1() and friends 2023-09-21 03:59:00 +09:00
Yu Watanabe 9132cbd5ad sd-dhcp6-client: use be32_sec_to_usec() at more places 2023-09-21 03:59:00 +09:00
Yu Watanabe d8ec95c7ff sd-dhcp6-client: rework IA_NA or IA_PD getters
This splits sd_dhcp6_lease_get_address() into small pieces,
and introduce FOREACH_DHCP6_ADDRESS() macro.
Also, the lifetimes provided by _get_address_lifetime() are now in usec,
and _get_address_lifetime_timestamp() provides timestamp.

The same change is also applied for IA_PD.
2023-09-21 03:59:00 +09:00
Yu Watanabe fb70992d39 sd-dhcp6-client: introduce sd_dhcp6_lease_has_pd_prefix() and friend
No functional change, just refactoring.
2023-09-21 03:59:00 +09:00
Yu Watanabe a00076113b sd-dhcp-server: store lifetime and friends in usec_t 2023-09-20 05:04:03 +09:00
Yu Watanabe ca515c961b libsystemd-network: introduce several helper functions to handle time values
These will be used in later commits.
2023-09-20 05:04:03 +09:00
Zbigniew Jędrzejewski-Szmek f31fa08057 sd-network: modernize log error messages
SYNTHETIC_ERRNO() is used where appropriate.

Splits in message format strings are removed, so that it's easier to
read/grep/copy them.
2023-09-19 09:35:52 +02:00
Lennart Poettering 7b9da3861a Revert "tree-wide: Mount file descriptors via /proc/<pid>/fd" 2023-09-08 22:13:09 +01:00
Yu Watanabe 0ad8d953de sd-dhcp-client: introduce sd_dhcp_lease_has_6rd() helper function
No functional change, just refactoring.
2023-09-06 02:02:21 +09:00