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
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
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
Yu Watanabe
a93538e892
dhcp: introduce sd_dhcp_lease_get_timestamp()
...
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.
2023-09-06 02:02:21 +09:00
Yu Watanabe
5fde4d37d4
sd-dhcp-client: store lifetime and friends in usec_t
2023-09-06 02:02:21 +09:00
Yu Watanabe
a832087979
Merge pull request #29023 from pelaufer/dhcp-prefix-dbus
...
Add dhcp client prefix lease information to networkd json output
2023-09-05 00:16:19 +09:00
Yu Watanabe
8b1bd20722
Merge pull request #29052 from yuwata/icmp6-util-cleanups
...
icmp6-util: several cleanups and fixlets
2023-09-05 00:15:23 +09:00
Susant Sahani
6e8f5e4c1f
network: ndisc - Allow to parse PREF64 prefix
2023-09-04 23:41:02 +09:00
Susant Sahani
6a6d27bc5b
network: sd-radv - Allow to configure Mobile IPv6 Home Agent
2023-09-04 23:40:40 +09:00
Yu Watanabe
690afe79dd
test: extract dummy icmp6 utils for tests
...
This extracts common implementation of dummy icmp6 utils used by tests.
2023-09-04 21:54:51 +09:00
Yu Watanabe
4961f56646
icmp6-util: make icmp6_receive() accept the null source address
...
Fixes #29050 .
2023-09-04 21:54:43 +09:00
Yu Watanabe
5121163832
icmp6-util: several cleanups for icmp6_receive()
...
- Rename the argument for storing the sender address,
- allow to call it with NULL for ret_xyz,
- reduce needless copy of timestamp when the message does not have
timestamp.
2023-09-04 21:52:55 +09:00
Yu Watanabe
4674f407b2
sd-ndisc,sd-radv: fix use of uninitialized value
...
When icmp6_receive() fails, then the source address is not initialized yet.
2023-09-04 19:31:40 +09:00
pelaufer
fd9b7f5bea
Adding dhcp client and dhcp6 client state interface
2023-09-02 14:51:03 -06:00
pelaufer
8412d4c878
Adding dhcp_state_to_string and dhcp client state change logging
2023-09-02 14:46:47 -06:00
pelaufer
8fb6320e4b
Add dhcp client prefix lease information to networkd json output
2023-09-02 13:45:03 -06:00
pelaufer
4502f82beb
Adding client_set_state to sd-dhcp-client.c to support a client state change hook
2023-09-01 12:34:13 -06:00
Yu Watanabe
3b981f7428
Revert "test-dhcp-client: add temporary workaround for assertion failure"
...
This reverts commit 1686c884bf .
The issue should be fixed by the previous commit. Let's drop the
workaround.
2023-08-30 17:37:22 +09:00
Yu Watanabe
5e2a89d84b
sd-dhcp-client: ensure IAID and DUID being set on start
...
After b2851e8d62 , if IAID and DUID are not
set on start, calling sd_dhcp_client_set_iaid_duid_en() in
client_message_init() triggers assertion, as the client is already
running at the stage. Let's set IAID and DUID earlier.
Fixes #28990 .
2023-08-30 17:37:03 +09:00
Susant Sahani
1a6b1214af
sd-radv: fix memory leak
2023-08-28 14:07:16 +01:00
Luca Boccassi
1686c884bf
test-dhcp-client: add temporary workaround for assertion failure
...
Workaround for https://github.com/systemd/systemd/issues/28990
Introduced by https://github.com/systemd/systemd/pull/28932 but CI was
green there. Add a workaround to get the CI back in shape while it is
being investigated.
2023-08-28 12:29:10 +01:00
Yu Watanabe
b2851e8d62
sd-dhcp-client: make client initially in stopped state
...
Previously, DHCP_STATE_STOPPED and DHCP_STATE_INIT are both handled as
not-running. Moreover, previously after sd_dhcp_client_start() is
called, the client still in INIT state (and thus handled as not-running)
even if its internal timer event sources are initialized.
Let's make only STOPPED state handled as not-running, and make the
client initially in STOPPED state.
Prompted by #28896 .
2023-08-28 10:25:14 +01:00
Susant Sahani
1925f829ab
network: sd-radv - Introduce pref64 support (RFC8781)
...
Implements: https://datatracker.ietf.org/doc/html/rfc8781
```
[IPv6PREF64Prefix]
Prefix=2003:da8:1:0::/64
ValidLifetimeSec=30m
Frame 16: 126 bytes on wire (1008 bits), 126 bytes captured (1008 bits) on interface veth99, id 0
Ethernet II, Src: 06:c7:41:95:1d:7f (06:c7:41:95:1d:7f), Dst: IPv6mcast_01 (33:33:00:00:00:01)
Internet Protocol Version 6, Src: fe80::4c7:41ff:fe95:1d7f, Dst: ff02::1
Internet Control Message Protocol v6
Type: Router Advertisement (134)
Code: 0
Checksum: 0x0ca0 [correct]
[Checksum Status: Good]
Cur hop limit: 0
Flags: 0x00, Prf (Default Router Preference): Medium
Router lifetime (s): 1800
Reachable time (ms): 0
Retrans timer (ms): 0
ICMPv6 Option (Source link-layer address : 06:c7:41:95:1d:7f)
ICMPv6 Option (Prefix information : 2002:da8:1::/64)
ICMPv6 Option (PREF64 Option)
Type: PREF64 Option (38)
Length: 2 (16 bytes)
0000 0111 0000 1... = Scaled Lifetime: 225
.... .... .... .001 = PLC (Prefix Length Code): 64 bits prefix length (0x1)
Prefix: 64:ff9b::
```
2023-08-25 15:13:06 +02:00
Zbigniew Jędrzejewski-Szmek
12455d6e87
Merge pull request #28918 from yuwata/network-dhcp-custom-duid
...
network/dhcp: allow to specify custom duid type
2023-08-24 15:45:07 +02:00
Lennart Poettering
24ae45cb65
alloc-util: add free_many() helper
...
We often free an array of things. Let's create a common helper for this,
and port some potential users over. (Not all, too lazy for that for
now).
2023-08-24 15:04:33 +02:00
Yu Watanabe
80500bb5d4
network/dhcp: make DUIDType= take an arbitrary integer
...
Closes #26745 .
2023-08-24 19:55:27 +09:00
Yu Watanabe
2da796cabb
dhcp: DUID-EN identifier has variable length
...
Also make `array[0]` -> `array[]`.
See RFC 8415, section 11.3.
2023-08-24 19:52:35 +09:00
Yu Watanabe
9291496011
network/dhcp: fix maximal DUID data size
...
The maximum DUID size is 128, but that includes type specified.
Hence, the maximal data size is 126.
2023-08-24 19:50:37 +09:00
Yu Watanabe
53488ea352
network: introduce per DUID type setters
...
No functional change, just refactoring.
2023-08-24 19:50:36 +09:00
Yu Watanabe
6ed69be98a
Revert "network: DHCP6 client- Allow to send manual DUID"
...
This reverts commits 89e73ce86f and
543d2a4d45 .
The commit assign "custom" to fixed DUID type 5. When making DUID fully
configurable, the type number should be also configurable. Also, the
fully custom DUID should be acceptable for DHCPv4.
2023-08-24 19:50:36 +09:00
Nandakumar Raghavan
a2fc6f2d59
networkd: Add T1 and T2 DHCPv6 options to expose in dbus API
...
Include T1 and T2 DHCPv6 options to expose in dbus API.
Introduced new field DHCPv6lease where these options are
added. This will be added to the JSON output when we query
org.freedesktop.network1.Manager object.
2023-08-23 12:43:09 +09:00
Susant Sahani
fdc4c67c2a
network/radv: allow to configure the time between retransmitted Neighbor Solicitation ( #28888 )
2023-08-23 12:37:44 +09:00
Lennart Poettering
cf1ab844a9
tree-wide: drop "static inline" use in .c files
...
"static inline" makes sense in .h files. But in .c files it's useless
decoration, the compiler should just make its own decisions there, and
it can do that.
hence, replace all remaining uses of "static line" by a simple" static"
in all .c files (but keep them in .h files, where they make sense)
2023-08-21 23:15:12 +02:00
Susant Sahani
9175002864
network: ndisc - Allow to use ICMP6 rate limit from received RA
2023-08-21 11:14:42 +02:00