Yu Watanabe
885ea2ab1c
ordered-set: introduce ordered_set_clear()
2022-02-14 14:58:49 +09:00
Yu Watanabe
1978efb9a5
sd-dhcp6-client: use struct hw_addr_data
2022-02-14 14:58:49 +09:00
Yu Watanabe
6f8ff34218
sd-dhcp6-client: stop IO event source when client entered bound state
...
Also when the client receives a reply when running in information
requesting mode.
2022-02-14 14:58:49 +09:00
Yu Watanabe
6f4490bb0c
sd-dhcp6-client: adjust assertions
2022-02-14 14:58:46 +09:00
Yu Watanabe
65b85f2340
sd-dhcp6-client: log state transition
2022-02-14 14:57:35 +09:00
Yu Watanabe
e5d69be216
sd-dhcp6-client: rename client_set_state() -> client_start_transaction()
...
Previously, it obeys state transition, but now it is only used when
(re-)starting transaction. Let's rename again in more explanative name.
2022-02-14 14:57:35 +09:00
Yu Watanabe
fa78d165bb
sd-dhcp6-client: use proper type for string table lookup funcs
2022-02-14 14:57:35 +09:00
Yu Watanabe
a8d1012f30
sd-dhcp6-client: voidify client_set_state()
2022-02-14 14:57:34 +09:00
Yu Watanabe
cfcc85bbca
sd-dhcp6-client: log message is processed before state is changed
2022-02-14 14:57:34 +09:00
Yu Watanabe
c50c9e509f
sd-dhcp6-client: move client_timeout_resend() and client_set_state()
...
These are deeply related to client_message_send(). Hence, move them near
the function.
2022-02-14 14:57:34 +09:00
Yu Watanabe
0eca25ba00
sd-dhcp6-client: move client_ensure_iaid()
...
No functional change.
2022-02-14 14:57:34 +09:00
Yu Watanabe
af2b484141
sd-dhcp6-client: merge client_start() and client_reset()
2022-02-14 14:56:54 +09:00
Yu Watanabe
ec7baf998d
sd-dhcp6-client: use event_reset_time_relative() at one more place
2022-02-14 14:54:08 +09:00
Yu Watanabe
22ad018b5e
sd-dhcp6-client: max_retransmit_count is only used when client is in DHCP6_STATE_REQUEST
2022-02-14 14:54:08 +09:00
Yu Watanabe
0f3b8b809c
sd-dhcp6-client: drop unnecessary event_source_disable()
...
The event source will be soon re-enabled in the same function.
The function client_timeout_resend() may return earlier without
re-enabling the timer souce. However,
- the timer event source is one shot by default. Hence, it is not
necessary to disable in the callback function,
- when it returns early, then client_set_state() or client_stop() is
called before return, and they re-ernable or disable the timer.
2022-02-14 14:51:19 +09:00
Yu Watanabe
3bb18e707c
sd-dhcp6-client: set lease expiration timer in client_enter_bound_state()
...
The timer must be active until the client get re-enter bound state,
and the timeout must be determined by the lease acquired when entering
the bound state.
2022-02-14 14:45:14 +09:00
Yu Watanabe
30b31359b0
sd-dhcp6-client: drop unnecessary assignment
2022-02-14 14:45:14 +09:00
Yu Watanabe
8ef959cd09
sd-dhcp6-client: initialize IO event source in sd_dhcp6_client_start()
2022-02-14 14:45:14 +09:00
Yu Watanabe
f814cd80de
sd-dhcp6-client: make state transition stricter
2022-02-14 14:45:14 +09:00
Yu Watanabe
c2c878d806
sd-dhcp6-client: prohibit spurious state transition
...
Previously, `client_set_state(client, DHCP6_STATE_STOPPED)` might make
the client enter the SOLICIT state.
2022-02-14 14:45:14 +09:00
Yu Watanabe
220a88ca75
sd-dhcp6-client: disable T1 timer on T2
...
Otherwise, the client may be enter RENEW state after REBIND state.
2022-02-14 14:45:14 +09:00
Yu Watanabe
c41bdb17fc
sd-dhcp6-client: call client_notify() in client_enter_bound_state()
2022-02-14 14:45:14 +09:00
Yu Watanabe
cdf3d8c584
sd-dhcp6-client: fix lifetime handling
...
This fixes the following issues:
- if T1 is finite and T2 is infinite, then the timer for T1 was not
enabled,
- after T1 and T2 are randomized, T1 may be longer than T2.
2022-02-14 14:45:07 +09:00
Yu Watanabe
1d6cb4ce2a
sd-dhcp6-client: use event_reset_time_relative()
2022-02-14 14:43:45 +09:00
Yu Watanabe
02354ee738
sd-dhcp6-client: introduce client_enter_bound_state()
...
To make client_set_state() smaller. This should not change any behavior.
2022-02-14 14:43:45 +09:00
Yu Watanabe
cc5184823f
sd-dhcp6-client: fix overflow in calculating timeout value
2022-02-14 14:43:45 +09:00
Yu Watanabe
d0875a07dd
sd-dhcp6-client: disable event source when client is stopped or freed
2022-02-14 14:43:45 +09:00
Yu Watanabe
7771233127
sd-dhcp6-client: use in6_addr_to_string()
2022-02-14 14:43:45 +09:00
Yu Watanabe
4db6334c9a
sd-dhcp6-client: stop client on error in client state transition
2022-02-14 14:43:45 +09:00
Yu Watanabe
bfa1139af4
sd-dhcp6-client: add missing one more error handling
2022-02-14 14:43:45 +09:00
Yu Watanabe
06d5e856f8
sd-dhcp6-client: rename client_start() -> client_set_state()
2022-02-14 14:43:45 +09:00
Yu Watanabe
07a3b3408b
sd-dhcp6-client: introduce client_process_*()
...
This is mostly for shortening `client_receive_message()`.
This also fixes the following:
- do not trigger SD_DHCP6_CLIENT_EVENT_INFORMATION_REQUEST notification
when non-reply message,
- add several missing error handlings caused in client_start().
2022-02-14 14:43:45 +09:00
Yu Watanabe
0123b2dbac
sd-dhcp6-client: fix possible unaligned read or write
2022-02-14 14:43:45 +09:00
Yu Watanabe
16347c15d8
sd-dhcp6-client: voidify client_reset()
2022-02-14 14:43:45 +09:00
Yu Watanabe
65ece4c85b
sd-dhcp6-client: introduce dhcp6_lease_new_from_message()
2022-02-14 14:43:45 +09:00
Yu Watanabe
c930925841
sd-dhcp6-client: use structured initializer
2022-02-14 14:43:45 +09:00
Yu Watanabe
f4fbea7a0f
sd-dhcp6-lease: unify lease lifetime calculation
2022-02-14 14:43:45 +09:00
Yu Watanabe
126277aceb
sd-dhcp6-client: always use ENODATA when a lease does not have requested data
2022-02-14 14:43:45 +09:00
Yu Watanabe
29858a0f9e
sd-dhcp6-client: unify dhcp6_option_append_{ia,pd}()
2022-02-14 14:43:45 +09:00
Yu Watanabe
877bfc78fd
sd-dhcp6-client: store PD prefix hint in ia_pd
...
And allows to specify multiple hints.
2022-02-14 14:43:45 +09:00
Yu Watanabe
e5b0b87f51
sd-dhcp6-client: introduce dhcp6_ia_free()
2022-02-14 14:43:45 +09:00
Yu Watanabe
4b0f27173c
sd-dhcp6-client: unify IA option header
...
This also fixes possible unaligned read of message.
2022-02-14 14:43:45 +09:00
Yu Watanabe
93bd7c4192
sd-dhcp6-lease: reset client or server ID when length is zero
...
Addresses https://github.com/systemd/systemd/pull/22406#issuecomment-1029391091 .
2022-02-14 14:43:45 +09:00
Yu Watanabe
049fddfa7d
sd-dhcp6-lease: convert assert_return() -> assert() in non-public functions
2022-02-14 14:43:45 +09:00
Yu Watanabe
7c999d38fa
sd-dhcp6-client: rename ia -> ia_na, pd -> ia_pd in sd_dhcp6_lease
...
The previous naming is quite misleading.
2022-02-14 14:43:45 +09:00
Yu Watanabe
43b7a412b1
sd-dhcp6-client: fix typo ia_pd -> ia_na
...
Fortunately, currently both ia_pd and ia_na in sd_dhcp6_client are
equivalent now.
2022-02-14 14:43:45 +09:00
Yu Watanabe
5e4d135c60
sd-dhcp6-client: introduce two helpers to create message
2022-02-14 14:43:45 +09:00
Yu Watanabe
6fcf356b9a
sd-dhcp6-client: trigger assertion whn invalid IA type is provided
...
If the condition hits, then it is an error in coding, instead of a user
misconfiguration or invalid receivd message.
2022-02-14 14:40:57 +09:00
Yu Watanabe
8448321571
sd-dhcp6-client: add missing address existence check
...
This adds similar check as 58da18251f .
2022-02-10 21:50:02 +09:00
Yu Watanabe
2d88df457a
Merge pull request #22471 from yuwata/network-bridge-vlan-protocol
...
network: bridge: fix vlan protocol
2022-02-10 20:40:04 +09:00